Code: Select all
/*** Plugin: JailBreak Shop* Autor: MaNuCs* * Credits: rubee* Gladius* capostrike93* apu*/ #include <amxmodx>#include <amxmisc>#include <hamsandwich>#include <cstrike>#include <fakemeta>#include <fun> #define is_valid_player(%1) (1 <= %1 <= 32) /*============================================================ Variables============================================================*/ new OnOff, precio1, precio2, precio3, precio4, precio5, precio6, precio7, Vida, Armor, glock1, glock2, g_killjp, g_killhsjp, g_startjp, g_maxjp, g_iMsgSayText, syncObj, Ronda[33], Speed[33], Speed2[33], g_jbpacks[33], quitar[33], regalar[33], gidPlayer[33] /*============================================================ Shop Sounds!============================================================*/new const Si[] = { "[Shop]JailBreak/Yes.wav" }new const No[] = { "[Shop]JailBreak/No.wav" } /*============================================================ Config============================================================*/ public plugin_init() { register_plugin("[JB] Shop", "2.9", "[M]aNuC[s]_") register_clcmd("say /shop", "Tienda") register_clcmd("say !shop", "Tienda") register_clcmd("say_team /shop", "Tienda") register_clcmd("say_team !shop", "Tienda") register_clcmd("JbPacks", "player") RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1) RegisterHam(Ham_TakeDamage, "player", "FwdTakeDamage", 0) RegisterHam(Ham_Killed, "player", "fw_player_killed") /*============================================================ Cvar's ============================================================*/ g_killjp = register_cvar("jb_killJP", "3"); g_killhsjp = register_cvar("jb_bonushsJP", "2"); g_startjp = register_cvar("jb_startJP", "7"); g_maxjp = register_cvar("jb_maxgiveJP", "10000"); OnOff = register_cvar("jb_Shop", "1")//1(ON) 0(OFF) precio1 = register_cvar("jb_pFlash", "8") precio2 = register_cvar("jb_pHe", "11") precio3 = register_cvar("jb_pHEFL", "22") precio4 = register_cvar("jb_pWalk", "25") precio5 = register_cvar("jb_pFast", "28") precio6 = register_cvar("jb_pDrugs", "30") precio7 = register_cvar("jb_pGlock", "36") Vida = register_cvar("jb_drLife", "200") Armor = register_cvar("jb_drArmor", "200") glock1 = register_cvar("jb_gClip", "20") glock2 = register_cvar("jb_gAmmo", "0") g_iMsgSayText = get_user_msgid("SayText") syncObj = CreateHudSyncObj() /*============================================================ Multi Lengual! ============================================================*/ register_dictionary("JBShop.txt")} /*============================================================ Precaches ============================================================*/public plugin_precache() { precache_sound(Si) precache_sound(No) return PLUGIN_CONTINUE} /*============================================================ ITEM'S MENU============================================================*/public Tienda(id){ if(get_pcvar_num(OnOff)) { if(get_pcvar_num(OnOff) && Ronda[id]) { if(is_user_alive(id)) { if (cs_get_user_team(id) == CS_TEAM_T ) { new contador=0; new players[32], num, tempid; get_players(players, num) for (new i=0; i<num; i++) { tempid = players[i] if (get_user_team(tempid)==1 && is_user_alive(tempid)) { contador++; } } if ( contador == 1 ) { ChatColor(id, "%L", LANG_PLAYER, "LAST") } else if ( contador >= 2 ) { static Item[64] formatex(Item, charsmax(Item),"\y%L", LANG_PLAYER, "SHOP") new Menu = menu_create(Item, "TiendaHandler") formatex(Item, charsmax(Item),"\w%L \r%d$",LANG_PLAYER, "FLASH", get_pcvar_num(precio1)) menu_additem(Menu, Item, "1") formatex(Item, charsmax(Item),"\w%L \r%d$",LANG_PLAYER, "HE", get_pcvar_num(precio2)) menu_additem(Menu, Item, "2") formatex(Item, charsmax(Item),"\w%L \r%d$",LANG_PLAYER, "HEFLASH", get_pcvar_num(precio3)) menu_additem(Menu, Item, "3") formatex(Item, charsmax(Item),"\w%L \r%d$",LANG_PLAYER, "FOOTSTEPS", get_pcvar_num(precio4)) menu_additem(Menu, Item, "4") formatex(Item, charsmax(Item),"\w%L \r%d$",LANG_PLAYER, "SPEED", get_pcvar_num(precio5)) menu_additem(Menu, Item, "5") formatex(Item, charsmax(Item),"\w%L \r%d$",LANG_PLAYER, "DRUGS", get_pcvar_num(precio6)) menu_additem(Menu, Item, "6") formatex(Item, charsmax(Item),"\w%L \r%d$",LANG_PLAYER, "GLOCK", get_pcvar_num(precio7)) menu_additem(Menu, Item, "7") menu_setprop(Menu, MPROP_EXIT, MEXIT_ALL) menu_display(id, Menu) } } else { ChatColor(id, "%L", LANG_PLAYER, "ONLY") } } else { ChatColor(id, "%L", LANG_PLAYER, "DEAD") } } else { ChatColor(id, "%L", LANG_PLAYER, "ONE_TIME") } } else { ChatColor(id, "%L", LANG_PLAYER, "SHOP_OFF") } return PLUGIN_HANDLED} public TiendaHandler(id, menu, item){ if( item == MENU_EXIT ) { menu_destroy(menu); return PLUGIN_HANDLED; } new data[6], iName[64]; new access, callback; menu_item_getinfo(menu, item, access, data,5, iName, 63, callback); new vivo = is_user_alive(id) new gmsg_SetFOV = get_user_msgid("SetFOV") new Obtener1 = get_pcvar_num(precio1) new Obtener2 = get_pcvar_num(precio2) new Obtener3 = get_pcvar_num(precio3) new Obtener4 = get_pcvar_num(precio4) new Obtener5 = get_pcvar_num(precio5) new Obtener6 = get_pcvar_num(precio6) new Obtener7 = get_pcvar_num(precio7) new vida1 = get_user_health(id) new vida2 = get_pcvar_num(Vida) new armor1 = get_user_armor(id) new armor2 = get_pcvar_num(Armor) new key = str_to_num(data); switch(key) { case 1: { if (g_jbpacks[id] >= Obtener1 && vivo) { g_jbpacks[id] -= Obtener1 ChatColor(id, "%L", LANG_PLAYER, "BUY_FLASH") give_item(id, "weapon_flashbang") give_item(id, "weapon_flashbang") emit_sound(id, CHAN_AUTO, Si, VOL_NORM, ATTN_NORM , 0, PITCH_NORM) Ronda[id] = 0 } else { ChatColor(id, "%L", LANG_PLAYER, "MONEY") emit_sound(id, CHAN_AUTO, No, VOL_NORM, ATTN_NORM , 0, PITCH_NORM) } } case 2: { if (g_jbpacks[id] >= Obtener2 && vivo) { g_jbpacks[id] -= Obtener2 ChatColor(id, "%L", LANG_PLAYER, "BUY_HE") give_item(id, "weapon_hegrenade") emit_sound(id, CHAN_AUTO, Si, VOL_NORM, ATTN_NORM , 0, PITCH_NORM) Ronda[id] = 0 } else { ChatColor(id, "%L", LANG_PLAYER, "MONEY") emit_sound(id, CHAN_AUTO, No, VOL_NORM, ATTN_NORM , 0, PITCH_NORM) } } case 3: { if (g_jbpacks[id] >= Obtener3 && vivo) { g_jbpacks[id] -= Obtener3 ChatColor(id, "%L", LANG_PLAYER, "BUY_HEFLASH") give_item(id, "weapon_hegrenade") give_item(id, "weapon_flashbang") give_item(id, "weapon_flashbang") emit_sound(id, CHAN_AUTO, Si, VOL_NORM, ATTN_NORM , 0, PITCH_NORM) Ronda[id] = 0 } else { ChatColor(id, "%L", LANG_PLAYER, "MONEY") emit_sound(id, CHAN_AUTO, No, VOL_NORM, ATTN_NORM , 0, PITCH_NORM) } } case 4: { if (g_jbpacks[id] >= Obtener4 && vivo) { g_jbpacks[id] -= Obtener4 ChatColor(id, "%L", LANG_PLAYER, "BUY_FOOTSTEPS") set_user_footsteps(id, 1) emit_sound(id, CHAN_AUTO, Si, VOL_NORM, ATTN_NORM , 0, PITCH_NORM) Ronda[id] = 0 } else { ChatColor(id, "%L", LANG_PLAYER, "MONEY") emit_sound(id, CHAN_AUTO, No, VOL_NORM, ATTN_NORM , 0, PITCH_NORM) } } case 5: { if (g_jbpacks[id] >= Obtener5 && vivo) { g_jbpacks[id] -= Obtener5 ChatColor(id, "%L", LANG_PLAYER, "BUY_SPEED") set_user_maxspeed(id, 500.0) Speed[id] = 1 emit_sound(id, CHAN_AUTO, Si, VOL_NORM, ATTN_NORM , 0, PITCH_NORM) Ronda[id] = 0 } else { ChatColor(id, "%L", LANG_PLAYER, "MONEY") emit_sound(id, CHAN_AUTO, No, VOL_NORM, ATTN_NORM , 0, PITCH_NORM) } } case 6: { if (g_jbpacks[id] >= Obtener6 && vivo) { g_jbpacks[id] -= Obtener6 ChatColor(id, "%L", LANG_PLAYER, "BUY_DRUGS") set_user_armor(id, armor1 + armor2) set_user_health(id, vida1 + vida2) set_user_maxspeed(id, 380.0) Speed2[id] = 1 message_begin( MSG_ONE, gmsg_SetFOV, { 0, 0, 0 }, id ) write_byte( 180 ) message_end( ) emit_sound(id, CHAN_AUTO, Si, VOL_NORM, ATTN_NORM , 0, PITCH_NORM) Ronda[id] = 0 } else { ChatColor(id, "%L", LANG_PLAYER, "MONEY") emit_sound(id, CHAN_AUTO, No, VOL_NORM, ATTN_NORM , 0, PITCH_NORM) } } case 7: { if (g_jbpacks[id] >= Obtener7 && vivo) { g_jbpacks[id] -= Obtener7 ChatColor(id, "%L", LANG_PLAYER, "BUY_GLOCK") cs_set_weapon_ammo( give_item( id, "weapon_glock18" ), get_pcvar_num(glock1)) cs_set_user_bpammo(id, CSW_GLOCK18, get_pcvar_num(glock2)) emit_sound(id, CHAN_AUTO, Si, VOL_NORM, ATTN_NORM , 0, PITCH_NORM) Ronda[id] = 0 } else { ChatColor(id, "%L", LANG_PLAYER, "MONEY") emit_sound(id, CHAN_AUTO, No, VOL_NORM, ATTN_NORM , 0, PITCH_NORM) } } } menu_destroy(menu); return PLUGIN_HANDLED;} public client_putinserver(id) { g_jbpacks[id] = get_pcvar_num(g_startjp) set_task(1.0, "JailbreakPacks", id, _, _, "b")} public JailbreakPacks(id){ set_hudmessage(142, 239, 39, 0.50, 0.90, 0, 6.0, 2.5) ShowSyncHudMsg(id, syncObj,"JBPacks: %i", g_jbpacks[id])} public player(id){ new say[300] read_args(say, charsmax(say)) remove_quotes(say) if(!is_str_num(say) || equal(say, "")) return PLUGIN_HANDLED jbpacks(id, say) return PLUGIN_CONTINUE} jbpacks(id, say[]) { new amount = str_to_num(say) new victim = gidPlayer[id] new vname[32] if(victim > 0) { get_user_name(victim, vname, 31) if(regalar[id]) { if(amount > get_pcvar_num(g_maxjp)) { g_jbpacks[victim] = get_pcvar_num(g_maxjp) } else { g_jbpacks[victim] = g_jbpacks[victim] + amount } ChatColor(0, "%L", LANG_PLAYER, "GIVE_MSG", amount, vname) } if(quitar[id]) { if(amount > g_jbpacks[victim]) { g_jbpacks[victim] = 0 ChatColor(0, "%L", LANG_PLAYER, "TAKE_ALL", vname) } else { g_jbpacks[victim] = g_jbpacks[victim] - amount ChatColor(0, "%L", LANG_PLAYER, "TAKE_MSG", amount, vname) } } } return PLUGIN_HANDLED} public Fwd_PlayerSpawn_Post(id){ if (is_user_alive(id)) { if(get_user_team(id) == 1) strip_user_weapons(id); give_item(id, "weapon_knife") set_user_footsteps(id, 0) Speed[id] = 0 Speed2[id] = 0 Ronda[id] = 1 }} public fw_player_killed(victim, attacker, shouldgib){ if(get_user_team(attacker) == 1) { g_jbpacks[attacker] += get_pcvar_num(g_killjp) if(get_pdata_int(victim, 75) == HIT_HEAD) { g_jbpacks[attacker] += get_pcvar_num(g_killhsjp) } }} public Event_Change_Weapon(id){ switch (get_user_team(id)) { case 1: { if(Speed[id]) { set_user_maxspeed(id, 500.0) } if(Speed2[id]) { set_user_maxspeed(id, 380.0) } } } return PLUGIN_CONTINUE } /*============================================================ Stocks!============================================================*/stock ChatColor(const id, const input[], any:...){ new count = 1, players[32] static msg[191] vformat(msg, 190, input, 3) replace_all(msg, 190, "!g", "^4") // Green Color replace_all(msg, 190, "!y", "^1") // Default Color replace_all(msg, 190, "!team", "^3") // Team Color 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, g_iMsgSayText, _, players[i]) write_byte(players[i]); write_string(msg); message_end(); } } }} stock ham_strip_weapon(id,weapon[]){ if(!equal(weapon,"weapon_",7)) return 0; new wId = get_weaponid(weapon); if(!wId) return 0; new wEnt; while((wEnt = engfunc(EngFunc_FindEntityByString,wEnt,"classname",weapon)) && pev(wEnt,pev_owner) != id) {} if(!wEnt) return 0; if(get_user_weapon(id) == wId) ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt); if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt)) return 0; ExecuteHamB(Ham_Item_Kill,wEnt); set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId)); return 1;} /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }*/
P.S. JBP tikriausia reikejo palikt?