So I got a code here in this section, which makes player console model back to It's previous when user tries to change It from console, example, If a player tries to use "model any_custom_model" on console and his model originally were, for example, GIGN, so It'll keep GIGN, I couldn't compile It at first but after some "modifications" I got able to
code I found
Code:
#include < amxmodx >
#include < cstrike >
#include < fakemeta >
public plugin_init()
register_forward(FM_SetClientKeyValue, "cmdSetClientKeyValue");
public cmdSetClientKeyValue(id, const infobuffer[], const key[])
{
if(equal(key, "model"))
{
new sCurModel[32];
cs_get_user_model(id, sCurModel, charsmax(sCurModel));
if(!equal(sCurModel, PlayerChoice[id]))
cs_set_user_model(id, PlayerChoice[id]);
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}
how I managed It to be compiled
Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
public plugin_init()
{
register_forward(FM_SetClientKeyValue, "cmdSetClientKeyValue");
}
public cmdSetClientKeyValue(id, const infobuffer[], const key[])
{
if(equal(key, "model"))
{
new PlayerChoice[32]
new sCurModel[32];
cs_get_user_model(id, sCurModel, charsmax(sCurModel));
if(!equal(sCurModel, PlayerChoice[id]))
cs_set_user_model(id, PlayerChoice[id])
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}
my player skins menu
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#define PLUGIN "Player Model Menu"
#define VERSION "1.0"
#define AUTHOR "redemptioN-"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /skins", "model_menu")
}
public plugin_precache()
{
precache_model("models/player/model1/model1.mdl")
precache_model("models/player/model2/model2.mdl")
}
public model_menu(id)
{
new menu = menu_create("[\wPlayer Models]", "menu_action")
menu_additem(menu, "\wRemove Skins", "1", 0)
menu_additem(menu, "\wModel1", "2", 0)
menu_additem(menu, "\wModel2", "3", 0)
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
}
public menu_action(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64]
new acces, callback
menu_item_getinfo(menu, item, acces, data, 5, iName, 63, callback)
new key = str_to_num(data)
switch(key)
{
case 1 : cs_set_user_model(id, "")
case 2 : cs_set_user_model(id, "model1")
case 3 : cs_set_user_model(id, "model2")
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
The plugin seems to be working, but when I use my player skins model menu to change skins, It stops blocking console model's change and I can use any model on console again, can someone try to fix and post the code please?
OBS: I need to fix It 'cause I only want players to use available players model, making them unable to reach future VIP or Admin menu player models that I'm planning to put in, and even prevent abuse from using other team models.