#pragma semicolon 1
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#include < cstrike >
#include < fun >
new const aeSilahConst[][][]={
{"AK47","models/v_ak47bn.mdl",CSW_AK47,16000,"1.9","weapon_ak47"},
{"M4A1","models/v_m4a1bn.mdl",CSW_M4A1,16000,"1.8","weapon_m4a1"},
{"Deagle","models/v_deaglebn.mdl",CSW_DEAGLE,14000,"2.0","weapon_deagle"}
};
new aeSilahKullandim[33][1];
new aeGenelChatTag[64],aeAltMenuTag[32],aeUstMenuTag[32];
public plugin_init(){
register_plugin("Naber","v1.0","Aconyonn");
register_clcmd("say /silahmenu","aeSilahMenu");
register_event("CurWeapon","aeWM","be","1=1");
RegisterHam(Ham_TakeDamage, "player", "aeTD");
new aeTag = register_cvar("ae_ChatTag","!n[!tWEBDiyo.COM!n]:");
get_pcvar_string(aeTag,aeGenelChatTag,charsmax(aeGenelChatTag));
new aeMenuTag = register_cvar("ae_MenuTag","\w[\rwD\w]");
get_pcvar_string(aeMenuTag,aeAltMenuTag,charsmax(aeAltMenuTag));
new aeUstTag = register_cvar("ae_UstMenuTag","WEBDiyo");
get_pcvar_string(aeUstTag,aeUstMenuTag,charsmax(aeUstMenuTag));
}
public plugin_precache(){
for(new i;i<sizeof(aeSilahConst);i++){
new aeVModel[196];
formatex(aeVModel,charsmax(aeVModel),"%s",aeSilahConst[i][1]);
if(file_exists(aeVModel)){
precache_model(aeVModel);
} else {
log_amx("%s: Servere Eksik Yuklenen Model [%s]",aeUstMenuTag,aeVModel);
}
}
}
public aeWM(aeID){
if(is_user_alive(aeID)){
new aeSilahID =get_user_weapon(aeID);
if(aeSilahConst[aeSilahKullandim[aeID][aeSilahID]][3][0]==aeSilahID){
new aeVModel[195];
formatex(aeVModel,charsmax(aeVModel),"%s",aeSilahConst[aeSilahKullandim[aeID][aeSilahID]][1]);
if(file_exists(aeVModel)){
set_pev(aeID,pev_viewmodel2,aeVModel);
} else {
renkli_yazi(aeID,"%s !gTanimlanamayan model !n> !g[!n%s!g]",aeGenelChatTag,aeVModel);
}
}
}
}
public aeTD(aeVictim,aeAttacker,Float:aeDamage){
if(is_user_alive(aeAttacker)){
new aeSilahID = get_user_weapon(aeAttacker);
if(aeSilahConst[aeSilahKullandim[aeAttacker][aeSilahID]][2][0]==aeSilahID){
new Float:aeConstHasar=str_to_float(aeSilahConst[aeSilahKullandim[aeAttacker][aeSilahID]][4]);
SetHamParamFloat(4,aeDamage*aeConstHasar*5.0);
}
}
}
public aeSilahMenu(aeID){
new aeMenu = aeMenuOlustur("Silah Market","aeSilahMenu_devam");
for(new i;i<sizeof(aeSilahConst);i++){
new aeNTS[6]; num_to_str(i,aeNTS,charsmax(aeNTS));
aeMenuSecenekEkle(aeMenu,"%s \w[\r%i$\w]",aeNTS,1,aeSilahConst[i][0],aeSilahConst[i][3]);
}
aeMenuBitir(aeID,aeMenu);
}
public aeSilahMenu_devam(aeID,aeMenu,aeMEsya){
if(aeMEsya == MENU_EXIT){ menu_destroy(aeMenu); return PLUGIN_HANDLED; }
new aeMVeri[6],aeBos;
menu_item_getinfo(aeMenu,aeMEsya,aeBos,aeMVeri,5,_,_,aeBos);
new aeKey = str_to_num(aeMVeri);
if(cs_get_user_money(aeID)>=aeSilahConst[aeKey][3][0]){
for(new i=CSW_P228;i<=CSW_P90;i++){
cs_set_user_money(aeID,cs_get_user_money(aeID)-aeSilahConst[aeKey][3][0]);
give_item(aeID,aeSilahConst[aeKey][5][0]),aeWM(aeID);
aeSilahKullandim[aeID][i]=aeKey;
renkli_yazi(aeID,"%s !gBasarili bir sekilde !n[!t%s!n] !gsatin aldiniz!n.",aeGenelChatTag,aeSilahConst[aeKey][0]);
}
} else {
renkli_yazi(aeID,"%s !gUzgunum !t%s !gsilahini almak icin !n%i$ !ggerekli!t!",aeGenelChatTag,aeSilahConst[aeKey][0],aeSilahConst[aeKey][3][0]);
}
menu_destroy(aeMenu);
return PLUGIN_HANDLED;
}
stock aeMenuOlustur(const aeBaslik[],const aeDevam[], any:...){
new aeYeniBaslik[256],aeDuzeltBaslik[256];
vformat(aeDuzeltBaslik,charsmax(aeDuzeltBaslik),aeBaslik,3);
formatex(aeYeniBaslik,charsmax(aeYeniBaslik),"\r( \w%s \r~\w> \yLutfen Silah Seciniz! \r) \y>> \r( \w%s \r)",aeUstMenuTag,aeDuzeltBaslik);
new aeMenu = menu_create(aeYeniBaslik,aeDevam);
return aeMenu;
}
stock aeMenuSecenekEkle(aeMenuID,const aeSecenekBaslik[],const aeBilgi[],aeTag = 1, any:...){
new aeYeniSecenekBaslik[256],aeSecenekDuzelt[256];
vformat(aeSecenekDuzelt,charsmax(aeSecenekDuzelt),aeSecenekBaslik,5);
if(aeTag == 1){
formatex(aeYeniSecenekBaslik,charsmax(aeYeniSecenekBaslik),"%s \w~\r> \w%s",aeAltMenuTag,aeSecenekDuzelt);
} else {
formatex(aeYeniSecenekBaslik,charsmax(aeYeniSecenekBaslik),"%s",aeSecenekDuzelt);
}
menu_additem(aeMenuID,aeYeniSecenekBaslik,aeBilgi);
}
stock aeMenuBitir(aeID,aeMenuID,aeSecenek = 1,aeCikis = 1,aeSayfa = 0){
menu_setprop(aeMenuID,MPROP_EXITNAME,"\rCikis");
menu_setprop(aeMenuID,MPROP_PERPAGE, aeSecenek ? 7:0 );
menu_setprop(aeMenuID,MPROP_EXIT,aeCikis ? MEXIT_ALL:MEXIT_NEVER);
menu_display(aeID,aeMenuID,aeSayfa);
/*
=> Eger menuyu 9 secenekli yapmak istiyorsan aeMenuBitir(aeID,aeMenu,0) yap
=> Ve bir ust satira yeni secenek olusturup gonderecegi secenegi 0 yap
*/
}
#if AMXX_VERSION_NUM < 183
stock renkli_yazi(const id, const input[], any:...){
new count = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!g", "^x01"); // Default Renk(Sarı)
replace_all(msg, 190, "!n", "^x04"); // Yeşil Renk
replace_all(msg, 190, "!t", "^x03"); // Takım Renk( CT mavi , T kırmızı )
if (id) players[0] = id; else get_players(players, count, "ch");{
for (new i = 0; i < count; i++){
if (is_user_connected(players[i])){
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]),write_string(msg),message_end();
}
}
}
}
#else
stock renkli_yazi(const id, const input[], any:...){
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!g", "^x01");
replace_all(msg, 190, "!n", "^x04");
replace_all(msg, 190, "!t", "^x03");
client_print_color(id, id, msg);
}
#endif