#include <amxmodx> #include <zombieplague> #include <fakemeta> #include <fun> new g_ent_playermodel[33]; new g_ent_weaponmodel[33]; new g_currentweapon[33]; new g_pcvar_active; new MenuKeys = (1 << 0) + (1 << 1) + (1 << 2) + (1 << 3) + (1 << 4) + (1 << 5) + (1 << 6) + (1 << 7) + (1 << 8)+ (1 << 9) new BuyMenuBodyText[256] public plugin_init() { register_plugin("[ZP] Select Models", "1.2", "Anggara_nothing") g_pcvar_active = register_cvar("zp_sem_enable", "1") register_message(get_user_msgid("CurWeapon"), "message_cur_weapon") SetupSelectMenu() register_clcmd("say /models", "ClCmdSelectModel") register_menucmd(register_menuid("rSelect your model:"), MenuKeys, "SelectIt") } public plugin_precache() { // Change your models here. engfunc(EngFunc_PrecacheModel, "models/player/arctic/arctic.mdl") engfunc(EngFunc_PrecacheModel, "models/player/gign/gign.mdl") engfunc(EngFunc_PrecacheModel, "models/player/gsg9/gsg9.mdl") engfunc(EngFunc_PrecacheModel, "models/player/guerilla/guerilla.mdl") engfunc(EngFunc_PrecacheModel, "models/player/leet/leet.mdl") engfunc(EngFunc_PrecacheModel, "models/player/sas/sas.mdl") engfunc(EngFunc_PrecacheModel, "models/player/terror/terror.mdl") engfunc(EngFunc_PrecacheModel, "models/player/urban/urban.mdl") } // Current Weapon info public message_cur_weapon(msg_id, msg_dest, msg_entity) { // Player not alive or not an active weapon if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1) return; // Get weapon id static weapon weapon = get_msg_arg_int(2) // Store weapon id for reference g_currentweapon[msg_entity] = weapon // Replace weapon models with custom ones fm_set_weaponmodel_ent(msg_entity) } // User Infected forward public zp_user_infected_post(id, infector) { // remove the glow. set_user_rendering(id, kRenderFxNone, 0,0,0,kRenderNormal, 255) // Remove Custom Model Entities fm_remove_model_ents(id) } public ClCmdSelectModel(id) { if(zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_survivor(id)) { client_print(id, print_chat, "This is just for human.") set_hudmessage(200, 155, 0, -1.0, 0.50, 0, 6.0, 8.0, 0.3, 0.5, 3) show_hudmessage(id, "This is just for human.") return PLUGIN_HANDLED; } else if(!get_pcvar_num(g_pcvar_active)) { set_hudmessage(200, 155, 0, -1.0, 0.50, 0, 6.0, 8.0, 0.3, 0.5, 3) show_hudmessage(id, "This ability has been disabled.") return PLUGIN_HANDLED; } else if(!is_user_alive(id)) { client_print(id, print_chat, "You must alive before using this.") set_hudmessage(200, 155, 0, -1.0, 0.50, 0, 6.0, 8.0, 0.3, 0.5, 3) show_hudmessage(id, "You must alive before using this.") return PLUGIN_HANDLED; } else { SetupSelectMenu() show_menu(id, MenuKeys, BuyMenuBodyText) } return PLUGIN_CONTINUE; } public SelectIt(id, key) { switch (key) { case 0: { fm_remove_model_ents(id) if (!pev_valid(g_ent_playermodel[id])) { g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")); if (!pev_valid(g_ent_playermodel[id])) return ; set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1) set_pev(g_ent_playermodel[id], pev_classname, "player_model") set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW) set_pev(g_ent_playermodel[id], pev_aiment, id) set_pev(g_ent_playermodel[id], pev_owner, id) // and change this. engfunc(EngFunc_SetModel, g_ent_playermodel[id], "models/player/arctic/arctic.mdl") fm_set_weaponmodel_ent(id) } } case 1: { fm_remove_model_ents(id) if (!pev_valid(g_ent_playermodel[id])) { g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")); if (!pev_valid(g_ent_playermodel[id])) return ; set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1) set_pev(g_ent_playermodel[id], pev_classname, "player_model") set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW) set_pev(g_ent_playermodel[id], pev_aiment, id) set_pev(g_ent_playermodel[id], pev_owner, id) // and change this. engfunc(EngFunc_SetModel, g_ent_playermodel[id], "models/player/gign/gign.mdl") fm_set_weaponmodel_ent(id) } } case 2: { fm_remove_model_ents(id) if (!pev_valid(g_ent_playermodel[id])) { g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")); if (!pev_valid(g_ent_playermodel[id])) return ; set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1) set_pev(g_ent_playermodel[id], pev_classname, "player_model") set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW) set_pev(g_ent_playermodel[id], pev_aiment, id) set_pev(g_ent_playermodel[id], pev_owner, id) // and change this. engfunc(EngFunc_SetModel, g_ent_playermodel[id], "models/player/gsg9/gsg9.mdl") fm_set_weaponmodel_ent(id) } } case 3: { fm_remove_model_ents(id) if (!pev_valid(g_ent_playermodel[id])) { g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")); if (!pev_valid(g_ent_playermodel[id])) return ; set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1) set_pev(g_ent_playermodel[id], pev_classname, "player_model") set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW) set_pev(g_ent_playermodel[id], pev_aiment, id) set_pev(g_ent_playermodel[id], pev_owner, id) // and change this. engfunc(EngFunc_SetModel, g_ent_playermodel[id], "models/player/guerilla/guerilla.mdl") fm_set_weaponmodel_ent(id) } } case 4: { fm_remove_model_ents(id) if (!pev_valid(g_ent_playermodel[id])) { g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")); if (!pev_valid(g_ent_playermodel[id])) return ; set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1) set_pev(g_ent_playermodel[id], pev_classname, "player_model") set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW) set_pev(g_ent_playermodel[id], pev_aiment, id) set_pev(g_ent_playermodel[id], pev_owner, id) // and change this. engfunc(EngFunc_SetModel, g_ent_playermodel[id], "models/player/leet/leet.mdl") fm_set_weaponmodel_ent(id) } } case 5: { fm_remove_model_ents(id) if (!pev_valid(g_ent_playermodel[id])) { g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")); if (!pev_valid(g_ent_playermodel[id])) return ; set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1) set_pev(g_ent_playermodel[id], pev_classname, "player_model") set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW) set_pev(g_ent_playermodel[id], pev_aiment, id) set_pev(g_ent_playermodel[id], pev_owner, id) // and change this. engfunc(EngFunc_SetModel, g_ent_playermodel[id], "models/player/sas/sas.mdl") fm_set_weaponmodel_ent(id) } } case 6: { fm_remove_model_ents(id) if (!pev_valid(g_ent_playermodel[id])) { g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")); if (!pev_valid(g_ent_playermodel[id])) return ; set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1) set_pev(g_ent_playermodel[id], pev_classname, "player_model") set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW) set_pev(g_ent_playermodel[id], pev_aiment, id) set_pev(g_ent_playermodel[id], pev_owner, id) // and change this. engfunc(EngFunc_SetModel, g_ent_playermodel[id], "models/player/terror/terror.mdl") fm_set_weaponmodel_ent(id) } } case 7: { fm_remove_model_ents(id) if (!pev_valid(g_ent_playermodel[id])) { g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")); if (!pev_valid(g_ent_playermodel[id])) return ; set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1) set_pev(g_ent_playermodel[id], pev_classname, "player_model") set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW) set_pev(g_ent_playermodel[id], pev_aiment, id) set_pev(g_ent_playermodel[id], pev_owner, id) // and change this. engfunc(EngFunc_SetModel, g_ent_playermodel[id], "models/player/urban/urban.mdl") fm_set_weaponmodel_ent(id) } } case 9: return ; } ClCmdSelectModel(id) return; } public SetupSelectMenu() { new menuLen = format(BuyMenuBodyText, 255, "rSelect your model:^n^n") menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "w1. artic^n") menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "w2. gign^n") menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "w3. gsg9^n") menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "w4. guerilla^n") menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "w5. leet^n") menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "w6. sas^n") menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "w7. terror^n") menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "w8. urban^n^n") menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "w0. Exit") return 1 } // Remove Custom Model Entities stock fm_remove_model_ents(id) { // Remove "playermodel" ent if present if (pev_valid(g_ent_playermodel[id])) { engfunc(EngFunc_RemoveEntity, g_ent_playermodel[id]) g_ent_playermodel[id] = 0 } // Remove "weaponmodel" ent if present if (pev_valid(g_ent_weaponmodel[id])) { engfunc(EngFunc_RemoveEntity, g_ent_weaponmodel[id]) g_ent_weaponmodel[id] = 0 } } // Set Weapon Model on Entity stock fm_set_weaponmodel_ent(id) { // Get player's p_ weapon model static model[100] pev(id, pev_weaponmodel2, model, sizeof model - 1) // Set model on entity or make a new one if unexistant if (!pev_valid(g_ent_weaponmodel[id])) { g_ent_weaponmodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")) if (!pev_valid(g_ent_weaponmodel[id])) return; set_pev(g_ent_weaponmodel[id], pev_classname, "weapon_model") set_pev(g_ent_weaponmodel[id], pev_movetype, MOVETYPE_FOLLOW) set_pev(g_ent_weaponmodel[id], pev_aiment, id) set_pev(g_ent_weaponmodel[id], pev_owner, id) } engfunc(EngFunc_SetModel, g_ent_weaponmodel[id], model) }
Dodaje: , ADMIN_IMMUNITY żeby wybrać ten model mógł tylko admin z flagą "a". Lecz nie pomaga.