Once again I am here to try to solve my problem
what I'm trying to do is pull the models by "Name", "Time", "Gender".
Exemple:
CT
Male Models - Male Menu
Female Models - Female Menu
TR
Male Models - Male Menu
Female Models - Male Menu
So when the player type /MODELS it will appear menu there will be two options
Male and Female then from there you choose which type of skin you want remembering to "szTeam
I tried to do this yesterday and I was almost 3 hours and could not please someone help me
I tried to use switch(item)
case 1, 2 and I couldn't and now I'm trying to use switch(iTeam)
PHP Code:
#include <amxmodx>
#include <cromchat>
#include <cstrike>
#include <hamsandwich>
#include <cs_player_models_api>
#if !defined MAX_PLAYERS
const MAX_PLAYERS = 32
#endif
new g_iUserGender[MAX_PLAYERS + 1];
enum _:ModelInfo
{
szModelName[64],
CsTeams:szTeam,
iGender,
szModelPath[64]
}
enum {
Male = 1,
Female = 2
}
new const g_eModels[][ModelInfo] =
{
{ "Special_CT", CS_TEAM_CT, Male, "models/player/Special_CT/Special_CT.mdl" },
{ "Special_CT2", CS_TEAM_CT, Male, "models/player/Special_CT2/Special_CT2.mdl" },
// CT Female
{ "Perfect", CS_TEAM_CT, Female, "models/player/Perfect/Perfect.mdl" },
{ "Pirate", CS_TEAM_CT, Female, "models/player/pirate/pirate.mdl" },
// TR Male
{ "Trey", CS_TEAM_T, Male, "models/player/trey/trey.mdl" },
{ "Fast", CS_TEAM_T, Male, "models/player/fast/fast.mdl" },
// TR Female
{ "Ashley", CS_TEAM_T, Female, "models/player/ashley/ashley.mdl" },
{ "Nyjon", CS_TEAM_T, Female, "models/player/Nyjon/Nyjon.mdl" },
}
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 /vip", "Cmd_VipSkin")
register_clcmd("say_team /vip", "Cmd_VipSkin")
CC_SetPrefix("&x04[Prefix]")
}
public plugin_precache()
{
for(new i; i < sizeof(g_eModels); i++)
{
precache_player_model(g_eModels[i][szModelName])
}
}
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][szModelName])
}
public Cmd_VipSkin(id)
{
if(!has_menu_access(id))
{
CC_SendMessage(id, "Only vips can open this menu, sorry!")
return PLUGIN_HANDLED
}
static iTeam
iTeam = get_user_team(id);
new szMenu[62]
formatex(szMenu, charsmax(szMenu), "Selecione Sua skin111")
new iMenu = menu_create(szMenu, "VipSkin_Handler")
switch(iTeam)
{
case CS_TEAM_T:
{
}
case CS_TEAM_CT:
{
}
}
menu_setprop(iMenu, MPROP_EXITNAME, "Sair")
menu_display(id, iMenu)
return PLUGIN_HANDLED
}
public VipSkin_Handler(id, iMenu, item)
{
static iTeam
iTeam = get_user_team(id)
switch(iTeam)
{
case CS_TEAM_T:
{
}
case CS_TEAM_CT:
{
}
}
}
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)
}