Code_0xABC, косяк получается)
new const sz_Model[][] = {
"player1",
"player2",
"Admin",
"Lord",
"Imper",
"Mummy"
};
public zp_user_humanized_post(id) {
if(is_user_alive(id) && !zp_get_user_zombie(id) && !zp_get_user_survivor(id) && !zp_get_user_nemesis(id)){
zp_override_user_model(id, fmt("%s.mdl", sz_Model[CLASS_ZPLAYER1]));
open_menu(id);
}
}
public plugin_precache() {
for(new i; i < sizeof sz_Model; ++i)
engfunc(EngFunc_PrecacheModel, fmt("models/player/%s/%s.mdl", sz_Model[i], sz_Model[i]));
}
public Spawn_post(id) {
if(is_user_alive(id) && !zp_get_user_zombie(id) && !zp_get_user_survivor(id) && !zp_get_user_nemesis(id)){
open_menu(id);
zp_override_user_model(id, fmt("%s.mdl", sz_Model[g_class[id]]));
}
}
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>
enum any:DATA {
NAME_MODEL[MAX_NAME_LENGTH],
NAME_ITEMS[MAX_NAME_LENGTH],
ID_FLAGS
};
new const e_szModelsHuman[][DATA] = {
{"player1", "Дэвид Блек", 0},
{"player2", "707", 0},
{"Admin", "Крас.Футб", ADMIN_MENU},
{"Lord", "Пророк Санбой", ADMIN_LEVEL_A},
{"Imper", "Каель", ADMIN_LEVEL_D},
{"Mummy", "Джек", ADMIN_KICK},
{"Nano", "Киборг", ADMIN_LEVEL_G}
};
new g_class[MAX_PLAYERS +1];
public plugin_init() {
register_plugin("[ZP] Human Classes (1.1)", "1.1 - 11.03.2023", "deprkid");
register_clcmd("say /hc", "open_menu");
register_clcmd("hc", "open_menu");
RegisterHam(Ham_Spawn, "player", "Ham_Spawn_post", 1);
}
public plugin_precache() {
for(new i; i < sizeof e_szModelsHuman; i++)
engfunc(EngFunc_PrecacheModel, fmt("models/player/%s/%s.mdl", e_szModelsHuman[i][NAME_MODEL], e_szModelsHuman[i][NAME_MODEL]));
}
public zp_user_humanized_post(id, survivor) {
if(is_user_alive(id) && !survivor) {
g_class[id] = 0;
zp_override_user_model(id, szModelsHuman[g_class[id]]);
}
}
public client_disconnected(id)
g_class[id] = 0;
public Ham_Spawn_post(id) {
if(is_user_alive(id) && !zp_get_user_zombie(id) && !zp_get_user_survivor(id) && !zp_get_user_nemesis(id))
zp_override_user_model(id, e_szModelsHuman[g_class[id]][NAME_MODEL]);
}
public open_menu(const id) {
if(!is_user_alive(id) || zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_nemesis(id))
return;
new iMenu = menu_create("\yМеню Настройки \rСкина", "handler_menu");
for(new i, Simbol; i < sizeof e_szModelsHuman; ++i) {
Simbol = i > 1 && !(get_user_flags(id) & e_szModelsHuman[i][ID_FLAGS]) ? 'd' : 'w';
menu_additem(iMenu, fmt("\%c%s", Simbol, e_szModelsHuman[i][NAME_ITEMS]), fmt("%i", i +1));
}
menu_setprop(iMenu, MPROP_EXITNAME, "Выход");
menu_display(id, iMenu);
}
public handler_menu(const id, const iMenu, const iItem) {
menu_destroy(iMenu);
if(!is_user_alive(id) || zp_get_user_zombie(id) || iItem == MENU_EXIT)
return;
if(iItem > 1 && !(get_user_flags(id) & e_szModelsHuman[iItem][ID_FLAGS])) {
chat(id, "Зомби данная функция не доступна");
return;
}
g_class[id] = iItem;
zp_override_user_model(id, e_szModelsHuman[iItem][NAME_MODEL]);
chat(id, "[ZP] Выбран скин: %s, активируется в след. раунде", e_szModelsHuman[iItem][NAME_ITEMS]);
}
stock chat(const id, sBuffer[], any:...) {
#define MAX_LEN 190
new sMsg[MAX_LEN +1];
vformat(sMsg, MAX_LEN, sBuffer, 3);
#undef MAX_LEN
static msgSayText;
if(!msgSayText)
msgSayText = get_user_msgid("SayText");
message_begin(MSG_ONE_UNRELIABLE, msgSayText, .player = id);
write_byte(id);
write_string(sMsg);
message_end();
}