My plugin
Well, my first plugin have a one bug.
I create the plugin for Vip Shop with itens less expensive of shop free.
Soy, when i will test him, when a bought item, my money don't less.
Example: I have 16000 of money and i bought deagle with cost 12000. I gave item but i continue with 16000.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <colorchat>
#define VERSION "1.0"
#define TAG "[DH Shop VIP]"
#define AUTHOR "Nunes!"
new vip_deagle_cost,
vip_he_cost,
vip_flash_cost,
vip_smoke_cost,
vip_usp_cost,
vip_godmode_cost,
vip_life_cost,
vip_gravity_cost,
vip_speed_cost,
vip_mp5_cost,
vip_deagle_ammo,
vip_he_ammo,
vip_flash_ammo,
vip_smoke_ammo,
vip_usp_ammo,
vip_mp5_ammo,
vip_gravity_time,
vip_godmode_time,
vip_speed_time,
vip_life_hp,
syncObj;
public plugin_init() {
register_plugin("[DH] Shop VIP Jail Break", "1.0", "Nunes")
register_clcmd("say /vmshop", "vip_shop_menu", ADMIN_LEVEL_H, "SHOP JAIL BREAK VIP")
register_clcmd("say_team /vmshop", "vip_shop_menu", ADMIN_LEVEL_H, "SHOP JAIL BREAK VIP")
register_clcmd("say vmshop", "vip_shop_menu", ADMIN_LEVEL_H, "SHOP JAIL BREAK VIP")
register_clcmd("say_team vmshop", "vip_shop_menu", ADMIN_LEVEL_H, "SHOP JAIL BREAK VIP")
/* Cvars */
vip_deagle_cost = register_cvar("jbv_deagle_cost", "12000")
vip_he_cost = register_cvar("jbv_he_cost", "5000")
vip_flash_cost = register_cvar("jbv_flash_cost", "5000")
vip_smoke_cost = register_cvar("jbv_smoke_cost", "6000")
vip_usp_cost = register_cvar("jbv_usp_cost", "11000")
vip_godmode_cost = register_cvar("jbv_godmode_cost", "11000")
vip_life_cost = register_cvar("jbv_life_cost", "7000")
vip_gravity_cost = register_cvar("jbv_gravity_cost", "6000")
vip_speed_cost = register_cvar("jbv_speed_cost", "8000")
vip_mp5_cost = register_cvar("jbv_mp5_cost", "16000")
vip_deagle_ammo = register_cvar("jbv_deagle_ammo", "0")
vip_he_ammo = register_cvar("jbv_he_ammo", "1")
vip_flash_ammo = register_cvar("jbv_flash_ammo", "2")
vip_smoke_ammo = register_cvar("jbv_smoke_ammo", "1")
vip_usp_ammo = register_cvar("jbv_usp_ammo", "0")
vip_mp5_ammo = register_cvar("jbv_mp5_ammo", "10")
vip_gravity_time = register_cvar("jbv_gravity_time", "15")
vip_godmode_time = register_cvar("jbb_godmode_time", "5")
vip_speed_time = register_cvar("jbv_speed_time", "10")
vip_life_hp = register_cvar("jbv_life_hp", "255")
syncObj = CreateHudSyncObj();
}
/* VIP Shop Menu */
public vip_shop_menu(id, level, cid)
{
new menu
if(!cmd_access(id, level, cid,1))
{
client_cmd(id, "speak Sound/DH_register/button_locked.wav")
ColorChat(id, RED, "Somente VIP tem acesso a este menu - Adquira Ja: www.darkhunterscs.com", TAG)
}
else
{
if(cs_get_user_team(id) == CS_TEAM_T){
client_cmd(id, "speak Sound/DH_register/button_accept.wav")
menu = menu_create("DH: Shop VIP Menu","vip_shop_menu_handler")
new menu_str[128]
formatex(menu_str,charsmax(menu_str),"Pistola Deagle ---> [%i]", get_pcvar_num(vip_deagle_cost))
menu_additem(menu, menu_str,"1")
formatex(menu_str,charsmax(menu_str),"1 He ---> [%i]", get_pcvar_num(vip_he_cost))
menu_additem(menu, menu_str,"2")
formatex(menu_str,charsmax(menu_str),"2 Flash ---> [%i]", get_pcvar_num(vip_flash_cost))
menu_additem(menu, menu_str,"3")
formatex(menu_str,charsmax(menu_str),"1 Bomba Paintball ---> [%i]", get_pcvar_num(vip_smoke_cost))
menu_additem(menu, menu_str,"4")
formatex(menu_str,charsmax(menu_str),"Pistola USP ---> [%i]", get_pcvar_num(vip_usp_cost))
menu_additem(menu, menu_str,"5")
formatex(menu_str,charsmax(menu_str),"God Mod ---> [%i]", (vip_godmode_cost))
menu_additem(menu, menu_str,"6")
formatex(menu_str,charsmax(menu_str),"Vida ---> [%i]", get_pcvar_num(vip_life_cost))
menu_additem(menu, menu_str,"7")
formatex(menu_str,charsmax(menu_str),"Gravidade Baixa ---> [%i]", get_pcvar_num (vip_gravity_cost))
menu_additem(menu, menu_str,"8")
formatex(menu_str,charsmax(menu_str),"Velocidade ---> [%i]", get_pcvar_num(vip_speed_cost))
menu_additem(menu, menu_str,"9")
formatex(menu_str,charsmax(menu_str),"Arma de PaintBall ---> [%i]", get_pcvar_num(vip_mp5_cost))
menu_additem(menu, menu_str,"10")
menu_display(id,menu)
}
}
}
public vip_shop_menu_handler(id,menu,item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new acess,callback, info[4],name[32], get_info
menu_item_getinfo(menu,item, acess, info,charsmax(info), name,charsmax(name), callback)
get_info = str_to_num(info)
switch(get_info)
{
case 1:
{
new money = cs_get_user_money(id);
if (id, money >= get_pcvar_num(vip_deagle_cost))
{
(id, money - get_pcvar_num(vip_deagle_cost))
give_item(id, "weapon_deagle") && cs_set_user_bpammo(id, CSW_DEAGLE, get_pcvar_num(vip_deagle_ammo))
ColorChat(id, RED, "[DH Shop VIP] Voce comprou 1 Pistola Deagle !!!", TAG)
}
else
{
ColorChat(id, RED, "Voce nao tem dinheiro suficiente para comprar este item!", TAG)
}
}
case 2:
{
new money = cs_get_user_money(id);
if (id, money >= get_pcvar_num(vip_he_cost))
{
(id, money - get_pcvar_num(vip_he_cost))
give_item(id, "weapon_hegrenade") && cs_set_user_bpammo(id, CSW_HEGRENADE, get_pcvar_num(vip_he_ammo))
ColorChat(id, RED, "[DH Shop VIP] Voce adquiriu 1 Bomba He !!!", TAG)
}
else
{
ColorChat(id, RED, "Voce nao tem dinheiro suficiente para comprar este item!", TAG)
}
}
case 3:
{
new money = cs_get_user_money(id);
if (id, money >= get_pcvar_num(vip_flash_cost))
{
(id, money - get_pcvar_num(vip_flash_cost))
give_item(id, "weapon_flashbang") && cs_set_user_bpammo(id, CSW_FLASHBANG, get_pcvar_num(vip_flash_ammo))
ColorChat(id, RED, "[DH Shop VIP] Voce comprou 2 Bombas de Flash!", TAG, get_pcvar_num(vip_flash_ammo))
}
else
{
ColorChat(id, RED, "Voce nao tem dinheiro suficiente para comprar este item!", TAG)
}
}
case 4:
{
new money = cs_get_user_money(id);
if (id, money >= get_pcvar_num(vip_smoke_cost))
{
(id, money - get_pcvar_num(vip_smoke_cost))
give_item(id, "weapon_smokegrenade") && cs_set_user_bpammo(id, CSW_SMOKEGRENADE, get_pcvar_num(vip_smoke_ammo))
ColorChat(id, RED, "[DH Shop VIP] Voce comprou 1 Bomba de PaintBall!", TAG, get_pcvar_num(vip_smoke_ammo))
}
else
{
ColorChat(id, RED, "Voce nao tem dinheiro suficiente para comprar este item!", TAG)
}
}
case 5:
{
new money = cs_get_user_money(id);
if (id, money >= get_pcvar_num(vip_usp_cost))
{
(id, money - get_pcvar_num(vip_usp_cost))
give_item(id, "weapon_usp") && cs_set_user_bpammo(id, CSW_USP, get_pcvar_num(vip_usp_ammo))
ColorChat(id, RED, "[DH Shop VIP] Voce comprou 1 USP!", TAG, get_pcvar_num(vip_usp_ammo))
}
else
{
ColorChat(id, RED, "Voce nao tem dinheiro suficiente para comprar este item!", TAG)
}
}
case 6:
{
new money = cs_get_user_money(id);
if (id, money >= get_pcvar_num(vip_godmode_cost))
{
(id, money - get_pcvar_num(vip_godmode_cost))
set_user_godmode(id, 1)
set_task(5.0, "remove_godmode", id)
ColorChat(id, RED, "[DH Shop VIP] Voce comprou God Mode por 5 segundos !!!", TAG, get_pcvar_num(vip_godmode_time))
}
else
{
ColorChat(id, RED, "Voce nao tem dinheiro suficiente para comprar este item!", TAG)
}
}
case 7:
{
new money = cs_get_user_money(id);
if (id, money >= get_pcvar_num(vip_life_cost))
{
(id, money - get_pcvar_num(vip_life_cost))
set_user_health(id, 255)
ColorChat(id, RED, "[DH Shop VIP] Voce comprou 255 de Vida !!!", TAG, get_pcvar_num(vip_life_hp))
}
else
{
ColorChat(id, RED, "Voce nao tem dinheiro suficiente para comprar este item!", TAG)
}
}
case 8:
{
new money = cs_get_user_money(id);
if (id, money >= get_pcvar_num(vip_gravity_cost))
{
(id, money - get_pcvar_num(vip_gravity_cost))
set_user_gravity(id, 0.5)
set_task(10.0, "remove_gravity", id)
ColorChat(id, RED, "[DH Shop VIP] Voce comprou Gravidade Reduzida por 10 segundos !!!", TAG, get_pcvar_num(vip_gravity_time))
}
else
{
ColorChat(id, RED, "Voce nao tem dinheiro suficiente para comprar este item!", TAG)
}
}
case 9:
{
new money = cs_get_user_money(id);
if (id, money >= get_pcvar_num(vip_speed_cost))
{
(id, money - get_pcvar_num(vip_speed_cost))
set_user_maxspeed(id, 300.0);
set_task(10.0, "remove_speed", id)
ColorChat(id, RED, "[DH Shop VIP] Voce comprou Velocidade por 10 segundos !!!", TAG, get_pcvar_num(vip_speed_time))
}
else
{
ColorChat(id, RED, "Voce nao tem dinheiro suficiente para comprar este item!", TAG)
}
}
case 10:
{
new money = cs_get_user_money(id);
if (id, money >= get_pcvar_num(vip_mp5_cost))
{
(id, money - get_pcvar_num(vip_mp5_cost))
give_item(id, "weapon_mp5navy") && cs_set_user_bpammo(id, CSW_MP5NAVY, get_pcvar_num(vip_mp5_ammo))
ColorChat(id, RED, "[DH Shop VIP] Voce comprou 1 Arma de PaintBall !!!", TAG, get_pcvar_num(vip_mp5_ammo))
}
else
{
ColorChat(id, RED, "Voce nao tem dinheiro suficiente para comprar este item!", TAG)
}
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
/* Remover Gravidade */
public remove_gravity(id)
{
set_user_gravity(id, 1.0)
client_print(id, print_chat, "A Gravidade Acabou!!!")
ColorChat(id, BLUE, "By Nunes!", TAG)
}
/* Remover God Mode */
public remove_godmode(id){
set_user_godmode(id, 0)
client_print(id, print_chat, "O God Mode Acabou!!!")
ColorChat(id, BLUE, "By Nunes!", TAG)
}
/* Remover Velocidade */
public remove_speed(id){
set_user_maxspeed(id, 256.0);
client_print(id, print_chat, "A Velocidade Acabou!!!")
ColorChat(id, BLUE, "By Nunes!", TAG)
}
|