RSSy MYGO.pl Opublikowano Sierpień 22, 2021 o 00:02 RSSy Udostępnij Opublikowano Sierpień 22, 2021 o 00:02 Hi, I'm using this model menu from OxiCrom, but I would like to modify the following: Everytime a player changes team, they stay with the same model they chose in the first place. I would like to modify that since my server uses exclusive models for CT and TT, so every time, say, a CT changes team to TT, they have to choose the model again from the TT models menu. Thanks! PHP Code: #include <amxmodx> #include <cromchat> #include <cstrike> #include <hamsandwich> #if !defined MAX_PLAYERS const MAX_PLAYERS = 32 #endif enum _:ModelInfo { Name[32], CsTeams:Team, } new const g_eModels[][ModelInfo] = { { "Special_CT", CS_TEAM_CT }, { "Special_CT2", CS_TEAM_CT }, { "Special_T", CS_TEAM_T }, { "Special_T2", CS_TEAM_T } } const INVALID_SKIN = -1 const MENU_ACCESS_FLAG = ADMIN_LEVEL_H const Float:CONNECT_MSG_DELAY = 5.0 new g_iModel[MAX_PLAYERS + 1][CsTeams] public plugin_init() { register_plugin("Models Menu", "1.0", "OciXCrom") RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn", 1) register_clcmd("say /vipskin", "Cmd_VipSkin") register_clcmd("say_team /vipskin", "Cmd_VipSkin") CC_SetPrefix("&x04[Prefix]") } public plugin_precache() { for(new i; i < sizeof(g_eModels); i++) { precache_player_model(g_eModels[i][Name]) } } public client_putinserver(id) { for(new CsTeams:iTeam = CS_TEAM_UNASSIGNED; iTeam <= CS_TEAM_SPECTATOR; iTeam++) { g_iModel[id][iTeam] = INVALID_SKIN } set_task(CONNECT_MSG_DELAY, "DisplayMessage", id) } public DisplayMessage(id) { if(is_user_connected(id) && has_menu_access(id)) { CC_SendMessage(id, "Type &x03/vipskin &x01to open the &x04VIP Skin Menu") } } public OnPlayerSpawn(id) { if(!is_user_alive(id)) { return } new iModel = g_iModel[id][cs_get_user_team(id)] if(iModel == INVALID_SKIN) { return } cs_set_user_model(id, g_eModels[iModel][Name]) } public Cmd_VipSkin(id) { if(!has_menu_access(id)) { CC_SendMessage(id, "Only vips can open this menu, sorry!") return PLUGIN_HANDLED } new iMenu = menu_create("Select Your Skin", "VipSkin_Handler") for(new CsTeams:iTeam = cs_get_user_team(id), szNum[5], i; i < sizeof(g_eModels); i++) { if(g_eModels[i][Team] == iTeam) { num_to_str(i, szNum, charsmax(szNum)) menu_additem(iMenu, g_eModels[i][Name], szNum) } } menu_display(id, iMenu) return PLUGIN_HANDLED } public VipSkin_Handler(id, iMenu, iItem) { if(!has_menu_access(id)) { goto @destroy } static _unused[1] new szModelId[5] menu_item_getinfo(iMenu, iItem, _unused[0], szModelId, charsmax(szModelId), _unused, charsmax(_unused), _unused[0]) new iModel = str_to_num(szModelId) new CsTeams:iTeam = cs_get_user_team(id) if(g_eModels[iModel][Team] != iTeam) { goto @destroy } g_iModel[id][iTeam] = iModel CC_SendMessage(id, "You have selected the skin &x04%s", g_eModels[iModel][Name]) if(is_user_alive(id)) { cs_set_user_model(id, g_eModels[iModel][Name]) } @destroy: menu_destroy(iMenu) return PLUGIN_HANDLED } bool:has_menu_access(id) { return (get_user_flags(id) & MENU_ACCESS_FLAG) != 0 } precache_player_model(const szModel[], &id = 0) { new model[128] formatex(model, charsmax(model), "models/player/%s/%sT.mdl", szModel, szModel) if(file_exists(model)) id = precache_generic(model) static const extension[] = "T.mdl" #pragma unused extension copy(model[strlen(model) - charsmax(extension)], charsmax(model), ".mdl") return precache_model(model) } Przeczytaj cały wpis Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi