#include <amxmodx>
#include <reapi>
new const sModels[][][] = {
{"M4a1 Modeli","models/v_m4a1.mdl",CSW_M4A1,"weapon_m4a1"},
{"Ak47 Modeli","models/v_ak47.mdl",CSW_AK47,"weapon_ak47"},
{"Awp Modeli","models/v_awp.mdl",CSW_AWP,"weapon_awp"},
{"Usp Modeli","models/v_usp.mdl",CSW_USP,"weapon_usp"},
{"Deagle Modeli","models/v_deagle.mdl",CSW_DEAGLE,"weapon_deagle"},
{"Glock18 Modeli","models/v_glock18.mdl",CSW_GLOCK18,"weapon_glock18"},
{"Knife Modeli","models/v_knife.mdl",CSW_KNIFE,"weapon_knife"}
}
new bool:iWeapon[MAX_PLAYERS+1][32];
public plugin_init() {
register_plugin("Yeni Eklenti", "1.0", "PawNod',suriyelikene")
register_clcmd("say /model","@ModelChanger");
RegisterHookChain(RG_CBasePlayerWeapon_DefaultDeploy, "@WeaponDeploy", .post = false);
}
@ModelChanger(const iPlayer) {
new i,Menu = menu_create(fmt("\wOrjinal Model Yapma Menüsü"), "@ModelChanger_");
for(i = 0; i < sizeof(sModels);i++) {
menu_additem(Menu,fmt("\w%s \d[%s\d]",sModels[i][0][0],iWeapon[iPlayer][sModels[i][2][0]] ? "\yAçık":"\rKapalı"),fmt("%i",i));
}
menu_setprop(Menu, MPROP_BACKNAME,"Önceki Sayfa");menu_setprop(Menu, MPROP_NEXTNAME,"Sonraki Sayfa");
menu_setprop(Menu, MPROP_EXITNAME,"\wKapat");menu_display(iPlayer, Menu);
}
@ModelChanger_(const iPlayer,const iMenu, const iItem) {
if(iItem == MENU_EXIT) { menu_destroy(iMenu);return PLUGIN_HANDLED; }
new iData[6], iKey;
menu_item_getinfo(iMenu, iItem, _, iData, charsmax(iData));
iKey = str_to_num(iData);
iWeapon[iPlayer][sModels[iKey][2][0]] = !(iWeapon[iPlayer][sModels[iKey][2][0]]);
client_print_color(iPlayer, iPlayer, "^1%s %s",sModels[iKey][0][0],iWeapon[iPlayer][sModels[iKey][2][0]] ? "^4Açıldı":"^4Kapandı");
if(rg_has_item_by_name(iPlayer,sModels[iKey][3][0])) {
rg_remove_item(iPlayer,sModels[iKey][3][0]);
rg_give_item(iPlayer,sModels[iKey][3][0]);
}
menu_destroy(iMenu);return PLUGIN_HANDLED;
}
@WeaponDeploy(const iEnt, szViewModel[], szWeaponModel[], iAnim, szAnimExt[], skiplocal) {
new iPlayer = get_member(iEnt, m_pPlayer),iNumeric,iWeaponID = get_member(iEnt, m_iId);
if(!is_user_alive(iPlayer)) return;
if(iWeapon[iPlayer][iWeaponID]) {
for(new i;i < sizeof(sModels);i++)
if(sModels[i][2][0] == iWeaponID) iNumeric = i;
SetHookChainArg(2, ATYPE_STRING, sModels[iNumeric][1][0]);
}
}