15-10-2022, Saat: 10:47
Kod:
#include <amxmodx>
#include <reapi>
#include <nvault>
new const TAG[] = "Tayo Professional"
new const tag[] = "TPCS"
new const ney[] = "Escape Coin"
new const neykisa[] = "E.C"
new const SapkaMenu[][][] = {
//{"Sapka Adi","Model Yolu",Fiyati,Kacinci Sirada}
{"","",0,0},
{"Santa","models/hats/santahat2.mdl",1000,1},{"Clon","models/hats/clon.mdl",2000,2},{"Bomba","models/hats/bomba.mdl",3000,3},
{"Traje Gas","models/hats/traje.mdl",4000,4},{"Zombi Bomb","models/hats/bombainfect.mdl",5000,5},{"Angel","models/hats/angel.mdl",6000,6},
{"Mario","models/hats/mario.mdl",7000,7},{"Perro","models/hats/rotwaila.mdl",8000,8},{"JACK","models/hats/jack.mdl",9000,9},
{"Mars Attack","models/hats/marsjanin.mdl",10000,10},{"Nemesis","models/hats/neme_hat.mdl",11000,11}
};
new const XPMenu[][] = {
//{"Kac XP Alacak?","Kac Escape Coin verecek?"}
{0,0},
{2000,100},{5000,200},{8500,300},{11500,400}
};
native zp_get_user_zombie(iPlayer);
native zp_get_user_nemesis(iPlayer);
native set_user_xp(iPlayer,amount);
native get_user_xp(iPlayer);
new iHatModels[sizeof(SapkaMenu)+1],iHatEnt[MAX_CLIENTS+1],g_Jeton[MAX_CLIENTS+1],g_sapka[MAX_CLIENTS+1][sizeof(SapkaMenu)+3];
new iG_Vault;
public plugin_init() {
register_plugin(ney, "1.0", "Kalipso22,Tayo")
register_concmd("amx_coinver","pKrediVer",ADMIN_RCON,"<isim> <miktar>");
register_concmd("amx_coinsil","pKrediAl",ADMIN_RCON,"<isim> <miktar>");
}
public plugin_cfg(){
iG_Vault = nvault_open("jeton");
if ( iG_Vault == INVALID_HANDLE )
set_fail_state( "Error opening sapka nVault, file does not exist!" )
}
public plugin_end() nvault_close(iG_Vault)
public plugin_precache() {
for(new i = 1; i< sizeof(SapkaMenu);i++){
iHatModels[i] = precache_model(SapkaMenu[i][1]);}
}
public client_connect(iPlayer) {
sLoadVault(iPlayer);
}
public client_disconnected(iPlayer) {
sSaveVault(iPlayer,1);
sSaveVault(iPlayer,2);
g_Jeton[iPlayer] = 0;
}
public plugin_natives() {
register_native("get_user_jeton", "@NTV_Get");
register_native("set_user_jeton", "@NTV_Set");
register_native("sapka", "@sapka_menusu2", 1);
register_native("xpmenu", "@xp_menusu2", 1);
}
@NTV_Get() {
new iPlayer = get_param(1);
return g_Jeton[iPlayer];
}
@NTV_Set() {
new iPlayer = get_param(1),amount = get_param(2);
g_Jeton[iPlayer] = amount;
}
public pKrediVer(id,pLVL, cid){
if(~get_user_flags(id) & pLVL){
return PLUGIN_HANDLED;}
new pYazi1[32],pYazi2[18],pIsim[33];
read_argv(1,pYazi1,31);
read_argv(2,pYazi2,17);
new pUID = find_player("bl",pYazi1);
get_user_name(id, pIsim, 32);
new pDeger = str_to_num(pYazi2);
g_Jeton[pUID] += pDeger;
client_print_color(pUID,pUID,"^4[%s] ^3Size ^4%d ^3%s Verildi!",tag,pDeger,ney);
return PLUGIN_HANDLED;
}
public pKrediAl(id,pLVL, cid){
if(~get_user_flags(id) & pLVL){
return PLUGIN_HANDLED;}
new pYazi1[32],pYazi2[18],pIsim[33];
read_argv(1,pYazi1,31);
read_argv(2,pYazi2,17);
new pUID = find_player("bl",pYazi1);
get_user_name(id, pIsim, 32);
new pDeger = str_to_num(pYazi2);
g_Jeton[pUID] -= pDeger;
client_print_color(pUID,pUID,"^4[%s] ^3Sizden ^4%d ^3%s Alindi!",tag,pDeger,ney);
return PLUGIN_HANDLED;
}
@sapka_menusu2(const iPlayer) {
new Menu = menu_create(fmt("\w[\r%s\w] \w| \ySapka Menu",TAG), "@sapka_menusu3");
menu_additem(Menu,fmt("\wSapkayi \rCikar"),"333");
for(new i=1; i < sizeof(SapkaMenu); i++) {
if(g_sapka[iPlayer][i]){
menu_additem(Menu,fmt("\w%s",SapkaMenu[i][0]),fmt("%i",i));
}else{menu_additem(Menu,fmt("\d%s \r[%i %s]",SapkaMenu[i][0],SapkaMenu[i][2],neykisa),fmt("%i",i));}}
menu_setprop(Menu, MPROP_BACKNAME,"\w[\yOnceki Sayfa\w]"),menu_setprop(Menu, MPROP_NEXTNAME,"\w[\ySonraki Sayfa\w]"),menu_setprop(Menu, MPROP_EXITNAME,"\w[\yCikis\w]");
menu_display(iPlayer, Menu);
}
@sapka_menusu3(const iPlayer, const iMenu, const iItem) {
if(iItem == MENU_EXIT) { menu_destroy(iMenu);return PLUGIN_HANDLED; }
new iData[6],iL_Key;
menu_item_getinfo(iMenu, iItem, _, iData, charsmax(iData));
iL_Key = str_to_num(iData)
if(iL_Key == 333){
@SetUserHat(iPlayer,0);
client_print_color(iPlayer,iPlayer,"^4[%s] ^3Basarili bir sekilde sapkayi cikardin!",tag);
menu_destroy(iMenu);return PLUGIN_HANDLED;}
if(g_sapka[iPlayer][iL_Key] < 1){
if(g_Jeton[iPlayer] >= SapkaMenu[iL_Key][2][0]){
client_print_color(iPlayer,iPlayer,"^4[%s] ^3Basarili bir sekilde sapkayi satin aldin!",tag);
g_Jeton[iPlayer] -= SapkaMenu[iL_Key][2][0];
g_sapka[iPlayer][iL_Key] = true;}
else{
client_print_color(iPlayer,iPlayer,"^4[%s] ^3Bu sapkayi almak icin yeterli ^4%s ^3yok!",tag,neykisa);
@sapka_menusu2(iPlayer);}}
else{
@SetUserHat(iPlayer,0),@SetUserHat(iPlayer,iL_Key);
client_print_color(iPlayer,iPlayer,"^4[%s] ^3Basarili bir sekilde sapkayi taktin!",tag);}
menu_destroy(iMenu);
return PLUGIN_HANDLED;
}
@xp_menusu2(const iPlayer) {
new Menu = menu_create(fmt("\w[\r%s\w] \w| \yXP Menu",TAG), "@xp_menusu3");
for(new i=1; i < sizeof(XPMenu); i++) {
menu_additem(Menu,fmt("\dSatin Al \y%i XP \r[-%i %s]",XPMenu[i][0],XPMenu[i][1],neykisa),fmt("%i",i));}
menu_setprop(Menu, MPROP_BACKNAME,"\w[\yOnceki Sayfa\w]"),menu_setprop(Menu, MPROP_NEXTNAME,"\w[\ySonraki Sayfa\w]"),menu_setprop(Menu, MPROP_EXITNAME,"\w[\yCikis\w]");
menu_display(iPlayer, Menu);
}
@xp_menusu3(const iPlayer, const iMenu, const iItem) {
if(iItem == MENU_EXIT) { menu_destroy(iMenu);return PLUGIN_HANDLED; }
new iData[6],iL_Key;
menu_item_getinfo(iMenu, iItem, _, iData, charsmax(iData));
iL_Key = str_to_num(iData)
menu_item_getinfo(iMenu, iItem, _, iData, charsmax(iData));
if(g_Jeton[iPlayer] >= XPMenu[iL_Key][1]){
g_Jeton[iPlayer] -= XPMenu[iL_Key][1];
set_user_xp(iPlayer,get_user_xp(iPlayer) + XPMenu[iL_Key][0]);
client_print_color(iPlayer,iPlayer,"^4[%s] ^3Basariyla ^4%d %s ^3karsiliginda ^4%d XP ^3aldin.",tag,XPMenu[iL_Key][1],neykisa,XPMenu[iL_Key][0]);
}else{
client_print_color(iPlayer,iPlayer,"^4[%s] ^3Yeteri kadar ^4%s ^3yok!",tag,neykisa);
@xp_menusu2(iPlayer);}
menu_destroy(iMenu);
return PLUGIN_HANDLED;
}
public zp_user_infected_post(iPlayer, infector, nemesis ){
if(zp_get_user_zombie(iPlayer) || zp_get_user_nemesis(iPlayer)){
@SetUserHat(iPlayer,0);}
}
public zp_round_ended(WIN_HUMANS){
new players[32],inum;
static tempid;
get_players(players,inum)
for(new i; i<inum; i++){
tempid = players[i]
if(is_user_alive(tempid) && !zp_get_user_zombie(tempid)){
client_print(tempid, print_center, "+1 %s",ney),
g_Jeton[tempid] += 1;}}
return PLUGIN_HANDLED;
}
@SetUserHat(const iPlayer, const iHatNum) {
switch(iHatNum){
case 0:{
iHatEnt[iPlayer] > 0 ? rg_remove_entity(iHatEnt[iPlayer]):(iHatEnt[iPlayer] = 0);}
default:{
iHatEnt[iPlayer] = rg_create_entity("info_target");
set_entvar(iHatEnt[iPlayer],var_movetype,MOVETYPE_FOLLOW);
set_entvar(iHatEnt[iPlayer],var_aiment,iPlayer);
set_entvar(iHatEnt[iPlayer],var_rendermode,kRenderNormal);
set_entvar(iHatEnt[iPlayer],var_modelindex,iHatModels[iHatNum]);}}
}
rg_remove_entity(const iEnt){
if(is_entity(iEnt))
set_entvar(iEnt,var_flags,FL_KILLME);
}
sLoadVault(iPlayer){
new authid[MAX_AUTHID_LENGTH];
get_user_authid(iPlayer, authid, charsmax(authid))
for(new i=1; i < sizeof(SapkaMenu); i++) {
g_sapka[iPlayer][i] = (sGetIntData("%i>Sapka>%i>",authid,i) == 1) ? true : false;}
g_Jeton[iPlayer] = sGetIntData("%i>Coin",authid);
}
sSaveVault(iPlayer,iType){
new authid[MAX_AUTHID_LENGTH];
get_user_authid(iPlayer, authid, charsmax(authid))
switch(iType) {
case 1: {
for(new i=1; i < sizeof(SapkaMenu); i++) {
sSetIntData("%i>Sapka>%i>",g_sapka[iPlayer][i],authid,i);}
}
case 2: {
sSetIntData("%i>Coin",g_Jeton[iPlayer],authid);
}
}
}
stock sGetIntData(const sS_Key[],any:...){
new sL_FixedData[128];
vformat(sL_FixedData,127,sS_Key,2);
return nvault_get(iG_Vault,sL_FixedData);
}
stock sSetIntData(const sS_Key[],const iS_Data,any:...){
new sL_FixedData[128],sL_NumToStr[48];
vformat(sL_FixedData,127,sS_Key,3);
num_to_str(iS_Data,sL_NumToStr,47);
nvault_set(iG_Vault,sL_FixedData,sL_NumToStr);
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1254\\ deff0\\ deflang1055{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/