Raised This Month: $ Target: $400
 0% 

HELP with shop plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
KeDa2
Junior Member
Join Date: Dec 2014
Old 12-04-2014 , 09:06   HELP with shop plugin
Reply With Quote #1

Guys, can anyone please help i have this plugin. But i have no idea how i can change that some items are not only for one round, but till death. Anyone?

PHP Code:
#define PLUGIN_NAME "Custom Shop"
#define PLUGIN_VERSION "1.1"
#define PLUGIN_AUTHOR "NEC"

#define SHOP_ACCESS ADMIN_RESERVATION
#define m_pActiveItem 373

#define sNo "buttons/button11.wav"
#define sOver "buttons/blip2.wav"

new const szPrefix[] = "^4[Custom Shop]"

enum Color
{
    
NORMAL 1// clients scr_concolor cvar color
    
GREEN// Green Color
    
TEAM_COLOR// Red, grey, blue
    
GREY// grey
    
RED// Red
    
BLUE// Blue
}

new 
TeamName[][] = 
{
    
"",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}

new const 
g_playerModels[][] = {
    
"arctic",
    
"guerilla",
    
"leet",
    
"terror",
    
"gign",
    
"gsg9",
    
"sas",
    
"urban"
}

new const 
g_itemSounds[][] = {
    
"items/smallmedkit1.wav"// Item "a": +50 Health [1000$]
    
"items/ammopickup2.wav"// Item "b": +50 Armor [1000$]
    
"items/gunpickup2.wav"// Item "c": Unlimited Clip [3000$]
    
"items/gunpickup2.wav"// Item "d": Unlimited Ammo [200$]
    
"items/gunpickup2.wav"// Item "e": All Grenades [800$]
    
"x/x_pain2.wav"// Item "f": Bomber [1600$]
    
"items/gunpickup2.wav"// Item "g": Silent Footsteps [3000$]
    
"misc/bipbip.wav"// Item "h": Faster Speed [4300$]
    
"items/gunpickup2.wav"// Item "i": Low Gravity [2800$]
    
"items/gunpickup2.wav"// Item "j": Chameleon [9000$]
    
"items/gunpickup2.wav"// Item "k": Drugs (Speed + Health) [8000$]
    
"items/gunpickup2.wav"// Item "l": Transparency [2500$]
    
"hornet/ag_buzz1.wav"// Item "m": Invisibility (15 Seconds) [16000$]
    
"items/gunpickup2.wav"// Item "n": Double Damage [10000$]
    
"misc/stinger12.wav"// Item "o": GodMode (5 Seconds) [16000$]
    
"items/suitchargeok1.wav"// Item "p": Health Regeneration [1800$]
    
"items/suitchargeok1.wav" // Item "q": Armor Regeneration [2000$]
}

new 
DisabledItemsVIPOnlygmsg_SetFOV
new HealthAmmountHealthPrizeArmorAmmountArmorPrizeUnlimitedClipPrizeUnlimitedAmmoPrizeAllGrenadesPrizeBomberPrizeBomberAmmountSilentFootstepsPrize
new FasterSpeedAmmountFasterSpeedPrizeLowGravityAmmountLowGravityPrizeChameleonPrizeDrugsSpeedAmmountDrugsHealthAmmountDrugsPrize
new TransparencyAmmountTransparencyPrizeInvisibilityTimeInvisibilityPrizeDoubleDamagePrizeGodModeTimeGodModePrizeHealthRegenAmmountHealthRegenTime
new HealthRegenMaxHealthRegenPrizeArmorRegenAmmountArmorRegenTimeArmorRegenMaxArmorRegenPrize
new InfoMessageEnabledInfoMessageTimeShopEquip

new cantactivate[33]
new 
cshop_speed[33], cshop_ddamage[33], cshop_healthregen[33], cshop_armorregen[33]

public 
plugin_init()
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
register_dictionary("custom_shop.txt")
    
    
register_event("CurWeapon""change_weapon""be""1=1")
    
RegisterHam(Ham_Spawn"player""ham_spawn"1)
    
RegisterHam(Ham_TakeDamage"player""ham_damage")
    
    
register_clcmd("say /shop""cshop_main")
    
register_clcmd("say_team /shop""cshop_main")
    
    
DisabledItems register_cvar("customshop_disableditems""")
    
VIPOnly register_cvar("customshop_viponly""0")
    
    
HealthAmmount register_cvar("customshop_health_ammount""50")
    
HealthPrize register_cvar("customshop_health_prize""1500")
    
ArmorAmmount register_cvar("customshop_armor_ammount""100")
    
ArmorPrize register_cvar("customshop_armor_prize""1000")
    
UnlimitedClipPrize register_cvar("customshop_unlclip_prize""3000")
    
UnlimitedAmmoPrize register_cvar("customshop_unlammo_prize""200")
    
AllGrenadesPrize register_cvar("customshop_allgrenades_prize""800")
    
BomberPrize register_cvar("customshop_bomber_prize""1600")
    
BomberAmmount register_cvar("customshop_bomber_ammount""20")
    
SilentFootstepsPrize register_cvar("customshop_silentsteps_prize""3000")
    
FasterSpeedAmmount register_cvar("customshop_fasterspeed_ammount""300.0")
    
FasterSpeedPrize register_cvar("customshop_fasterspeed_prize""4300")
    
LowGravityAmmount register_cvar("customshop_lowgravity_ammount""0.5")
    
LowGravityPrize register_cvar("customshop_lowgravity_prize""2800")
    
ChameleonPrize register_cvar("customshop_chameleon_prize""9000")
    
DrugsSpeedAmmount register_cvar("customshop_drugs_speedammount""300.0")
    
DrugsHealthAmmount register_cvar("customshop_drugs_healthammount""200")
    
DrugsPrize register_cvar("customshop_drugs_prize""8000")
    
TransparencyAmmount register_cvar("customshop_transparency_ammount""75")
    
TransparencyPrize register_cvar("customshop_transparency_prize""2500")
    
InvisibilityTime register_cvar("customshop_invisibility_time""15.0")
    
InvisibilityPrize register_cvar("customshop_invisibility_prize""16000")
    
DoubleDamagePrize register_cvar("customshop_doubledamage_prize""10000")
    
GodModeTime register_cvar("customshop_godmode_time""5.0")
    
GodModePrize register_cvar("customshop_godmode_prize""16000")
    
HealthRegenAmmount register_cvar("customshop_healthregen_ammount""1")
    
HealthRegenTime register_cvar("customshop_healthregen_time""0.5")
    
HealthRegenMax register_cvar("customshop_healthregen_max""150")
    
HealthRegenPrize register_cvar("customshop_healthregen_prize""1800")
    
ArmorRegenAmmount register_cvar("customshop_armorregen_ammount""10")
    
ArmorRegenTime register_cvar("customshop_armorregen_time""0.5")
    
ArmorRegenMax register_cvar("customshop_armorregen_max""150")
    
ArmorRegenPrize register_cvar("customshop_armorregen_prize""2000")
    
InfoMessageEnabled register_cvar("customshop_infomessage_enabled""1")
    
InfoMessageTime register_cvar("customshop_infomessage_time""90.0")
    
ShopEquip register_cvar("customshop_buyequip""1")
    
    if(
get_pcvar_num(ShopEquip) == 1register_clcmd("buyequip""cshop_main")
    
    
gmsg_SetFOV get_user_msgid("SetFOV")
    if(
get_pcvar_num(InfoMessageEnabled) == 1set_task(get_pcvar_float(InfoMessageTime), "infoMessage"1111""0"b"0)
}

public 
client_putinserver(id)
{
    
cshop_speed[id] = false
    cshop_ddamage
[id] = false
    cshop_healthregen
[id] = false
    cshop_armorregen
[id] = false
}

public 
ham_spawn(id)
{
    
cshop_speed[id] = false
    cshop_ddamage
[id] = false
    cshop_healthregen
[id] = false
    cshop_armorregen
[id] = false
    
if(is_user_alive(id))
    {
        
set_user_footsteps(id0)
        
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha255)
    }
    if(
is_user_connected(id)) cs_reset_user_model(id)
}

public 
change_weapon(id)
{
    if(
cshop_speed[id]) set_user_maxspeed(idget_pcvar_float(FasterSpeedAmmount))
}

public 
infoMessage()
    
ColorChat(0TEAM_COLOR"%s ^1%L"szPrefixLANG_SERVER"CSHOP_INFO"PLUGIN_NAMEPLUGIN_AUTHOR)

public 
cshop_main(id)
{
    if(
get_pcvar_num(VIPOnly) == 1)
    {
        if(!(
get_user_flags(id) & SHOP_ACCESS))
        {
            
ColorChat(idTEAM_COLOR"%s ^1%L"szPrefixLANG_SERVER"CSHOP_NOACCESS")
            
client_cmd(id"spk %s"sNo)
            return 
PLUGIN_HANDLED
        
}
    }
    
    if(!
is_user_alive(id))
    {
        
ColorChat(idTEAM_COLOR"%s ^1%L"szPrefixLANG_SERVER"CSHOP_NOTALIVE")
        
client_cmd(id"spk %s"sNo)
        return 
PLUGIN_HANDLED
    
}
    
    new 
menu_title[200], items[30]
    new 
money cs_get_user_money(id)
    
get_pcvar_string(DisabledItemsitems29)
    
    
formatex(menu_titlecharsmax(menu_title), "\yOciXCrom's \rCustom Shop^n\w%L: \r%i \d| \w%L:\d"LANG_SERVER"CSHOP_MONEY"moneyLANG_SERVER"CSHOP_PAGE")
    new 
customshop menu_create(menu_title"cshop_handler")
    
    new 
item[80], close[15], back[15], next[15]
    
    if(
contain(items"a") == -1// Item "a": +50 Health [1000$]
    
{
        if(
money >= get_pcvar_num(HealthPrize)) formatex(itemcharsmax(item), "+\y%i \w%L \r[%i$]"get_pcvar_num(HealthAmmount), LANG_SERVER"CSHOP_HEALTH"get_pcvar_num(HealthPrize))
        else 
formatex(itemcharsmax(item), "\d+%i %L \r[%i$]"get_pcvar_num(HealthAmmount), LANG_SERVER"CSHOP_HEALTH"get_pcvar_num(HealthPrize))
        
menu_additem(customshopitem"0"0)
    }
    
    if(
contain(items"b") == -1// Item "b": +50 Armor [1000$]
    
{
        if(
money >= get_pcvar_num(ArmorPrize)) formatex(itemcharsmax(item), "+\y%i \w%L \r[%i$]"get_pcvar_num(ArmorAmmount), LANG_SERVER"CSHOP_ARMOR"get_pcvar_num(ArmorPrize))
        else 
formatex(itemcharsmax(item), "\d+%i %L \r[%i$]"get_pcvar_num(ArmorAmmount), LANG_SERVER"CSHOP_ARMOR"get_pcvar_num(ArmorPrize))
        
menu_additem(customshopitem"1"0)
    }    
    
    if(
contain(items"c") == -1// Item "c": Unlimited Clip [3000$]
    
{
        
formatex(itemcharsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(UnlimitedClipPrize)) ? "" "\d"LANG_SERVER"CSHOP_UNLCLIP"get_pcvar_num(UnlimitedClipPrize))
        
menu_additem(customshopitem"2"0)
    }
    
    if(
contain(items"d") == -1// Item "d": Unlimited Ammo [200$]
    
{
        
formatex(itemcharsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(UnlimitedAmmoPrize)) ? "" "\d"LANG_SERVER"CSHOP_UNLAMMO"get_pcvar_num(UnlimitedAmmoPrize))  
        
menu_additem(customshopitem"3"0)
    }    
    
    if(
contain(items"e") == -1// Item "e": All Grenades [800$]
    
{
        
formatex(itemcharsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(AllGrenadesPrize)) ? "" "\d"LANG_SERVER"CSHOP_ALLGRENADES"get_pcvar_num(AllGrenadesPrize))
        
menu_additem(customshopitem"4"0)
    }    
    
    if(
contain(items"f") == -1// Item "f": Bomber [1600$]
    
{
        
formatex(itemcharsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(BomberPrize)) ? "" "\d"LANG_SERVER"CSHOP_BOMBER"get_pcvar_num(BomberPrize))
        
menu_additem(customshopitem"5"0)
    }    
    
    if(
contain(items"g") == -1// Item "g": Silent Footsteps [3000$]
    
{
        
formatex(itemcharsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(SilentFootstepsPrize)) ? "" "\d"LANG_SERVER"CSHOP_SILENTSTEPS"get_pcvar_num(SilentFootstepsPrize))
        
menu_additem(customshopitem"6"0)
    }    
    
    if(
contain(items"h") == -1// Item "h": Faster Speed [4300$]
    
{
        
formatex(itemcharsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(FasterSpeedPrize)) ? "" "\d"LANG_SERVER"CSHOP_FASTERSPEED"get_pcvar_num(FasterSpeedPrize))
        
menu_additem(customshopitem"7"0)
    }    
    
    if(
contain(items"i") == -1// Item "i": Low Gravity [2800$]
    
{
        
formatex(itemcharsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(LowGravityPrize)) ? "" "\d"LANG_SERVER"CSHOP_LOWGRAVITY"get_pcvar_num(LowGravityPrize))
        
menu_additem(customshopitem"8"0)
    }
    
    if(
contain(items"j") == -1// Item "j": Chameleon [9000$]
    
{
        
formatex(itemcharsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(ChameleonPrize)) ? "" "\d"LANG_SERVER"CSHOP_CHAMELEON"get_pcvar_num(ChameleonPrize))
        
menu_additem(customshopitem"9"0)
    }    
    
    if(
contain(items"k") == -1// Item "k": Drugs (Speed + Health) [8000$]
    
{
        if(
money >= get_pcvar_num(DrugsPrize)) formatex(itemcharsmax(item), "%L \y(%L) \r[%i$]"LANG_SERVER"CSHOP_DRUGS"LANG_SERVER"CSHOP_DRUGS2"get_pcvar_num(DrugsPrize))
        else 
formatex(itemcharsmax(item), "\d%L (%L) \r[%i$]"LANG_SERVER"CSHOP_DRUGS"LANG_SERVER"CSHOP_DRUGS2"get_pcvar_num(DrugsPrize))
        
menu_additem(customshopitem"10"0)
    }    
    
    if(
contain(items"l") == -1// Item "l": Transparency [2500$]
    
{
        
formatex(itemcharsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(TransparencyPrize)) ? "" "\d"LANG_SERVER"CSHOP_TRANSPARENCY"get_pcvar_num(TransparencyPrize))
        
menu_additem(customshopitem"11"0)
    }    
    
    if(
contain(items"m") == -1// Item "m": Invisibility (15 Seconds) [16000$]
    
{
        if(
money >= get_pcvar_num(InvisibilityPrize)) formatex(itemcharsmax(item), "%L \y(%i %L) \r[%i$]"LANG_SERVER"CSHOP_INVISIBILITY"get_pcvar_num(InvisibilityTime), LANG_SERVER"CSHOP_SECONDS"get_pcvar_num(InvisibilityPrize))
        else 
formatex(itemcharsmax(item), "\d%L (%i %L) \r[%i$]"LANG_SERVER"CSHOP_INVISIBILITY"get_pcvar_num(InvisibilityTime), LANG_SERVER"CSHOP_SECONDS"get_pcvar_num(InvisibilityPrize))
        
menu_additem(customshopitem"12"0)
    }    
    
    if(
contain(items"n") == -1// Item "n": Double Damage [10000$]
    
{
        
formatex(itemcharsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(DoubleDamagePrize)) ? "" "\d"LANG_SERVER"CSHOP_DDAMAGE"get_pcvar_num(DoubleDamagePrize))
        
menu_additem(customshopitem"13"0)
    }    
    
    if(
contain(items"o") == -1// Item "o": GodMode (5 Seconds) [16000$]
    
{
        if(
money >= get_pcvar_num(GodModePrize)) formatex(itemcharsmax(item), "%L \y(%i %L) \r[%i$]"LANG_SERVER"CSHOP_GODMODE"get_pcvar_num(GodModeTime), LANG_SERVER"CSHOP_SECONDS"get_pcvar_num(GodModePrize))
        else 
formatex(itemcharsmax(item), "\d%L (%i %L) \r[%i$]"LANG_SERVER"CSHOP_GODMODE"get_pcvar_num(GodModeTime), LANG_SERVER"CSHOP_SECONDS"get_pcvar_num(GodModePrize))
        
menu_additem(customshopitem"14"0)
    }    
    
    if(
contain(items"p") == -1// Item "p": Health Regeneration [1800$]
    
{
        
formatex(itemcharsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(HealthRegenPrize)) ? "" "\d"LANG_SERVER"CSHOP_HEALTHREGEN"get_pcvar_num(HealthRegenPrize))
        
menu_additem(customshopitem"15"0)
    }    
    
    if(
contain(items"q") == -1// Item "q": Armor Regeneration [2000$]
    
{
        
formatex(itemcharsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(ArmorRegenPrize)) ? "" "\d"LANG_SERVER"CSHOP_ARMORREGEN"get_pcvar_num(ArmorRegenPrize))
        
menu_additem(customshopitem"16"0)
    }    
    
    
formatex(closecharsmax(close), "%L"LANG_SERVER"CSHOP_EXIT")
    
formatex(backcharsmax(back), "%L"LANG_SERVER"CSHOP_BACK")
    
formatex(nextcharsmax(next), "%L"LANG_SERVER"CSHOP_NEXT")
    
    
menu_setprop(customshopMPROP_EXITNAMEclose)
    
menu_setprop(customshopMPROP_BACKNAMEback)
    
menu_setprop(customshopMPROP_NEXTNAMEnext)
    
    
menu_display(idcustomshop0)
    return 
PLUGIN_HANDLED
}

public 
cshop_handler(idcustomshopitem)
{
    if(!
is_user_alive(id) || item == MENU_EXIT)
    {
        
menu_destroy(customshop)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64], accesscallback
    menu_item_getinfo
(customshopitemaccessdatacharsmax(data), iNamecharsmax(iName), callback)

    new 
key str_to_num(data)
    new 
money cs_get_user_money(id)
    new 
weapon get_user_weapon(id)
    new 
message[192]
    
    switch(
key)
    {
        case 
0// Item "a": +50 Health [1000$]
        
{
            if(
money >= get_pcvar_num(HealthPrize))
            {
                
set_user_health(idget_user_health(id) + get_pcvar_num(HealthAmmount))
                
cs_set_user_money(idmoney get_pcvar_num(HealthPrize))
                
formatex(messagecharsmax(message), "%s ^1%L"szPrefixLANG_SERVER"CSHOP_BOUGHT"LANG_SERVER"CSHOP_HEALTH"get_pcvar_num(HealthPrize))
            }
            else
            {
                
notenough(id)
                return 
PLUGIN_HANDLED
            
}
        }
        case 
1// Item "b": +50 Armor [1000$]
        
{
            if(
money >= get_pcvar_num(ArmorPrize))
            {
                
set_user_armor(idget_user_armor(id) + get_pcvar_num(ArmorAmmount))
                
cs_set_user_money(idmoney get_pcvar_num(ArmorPrize))
                
formatex(messagecharsmax(message), "%s ^1%L"szPrefixLANG_SERVER"CSHOP_BOUGHT"LANG_SERVER"CSHOP_ARMOR"get_pcvar_num(ArmorPrize))
            }
            else
            {
                
notenough(id)
                return 
PLUGIN_HANDLED
            
}
        }
        case 
2// Item "c": Unlimited Clip [3000$]
        
{
            if(
money >= get_pcvar_num(UnlimitedClipPrize))
            {
                if(
weapon != CSW_KNIFE && weapon != CSW_HEGRENADE && weapon != CSW_FLASHBANG && weapon != CSW_SMOKEGRENADE && weapon != CSW_C4)
                {
                    
cs_set_weapon_ammo(get_pdata_cbase(idm_pActiveItem), 97280)
                    
cs_set_user_bpammo(idweapon0)
                    
cs_set_user_money(idmoney get_pcvar_num(UnlimitedClipPrize), 1)
                    
formatex(messagecharsmax(message), "%s ^1%L"szPrefixLANG_SERVER"CSHOP_BOUGHT"LANG_SERVER"CSHOP_UNLCLIP"get_pcvar_num(UnlimitedClipPrize))
                }
                else
                {
                    
cantactivate[id] = 1
                    cantactivateitem
(id)
                    return 
PLUGIN_HANDLED
                
}
            }
            else
            {
                
notenough(id)
                return 
PLUGIN_HANDLED
            
}
        }
        case 
3// Item "d": Unlimited Ammo [200$]
        
{
            if(
money >= get_pcvar_num(UnlimitedAmmoPrize))
            {
                if(
weapon != CSW_KNIFE && weapon != CSW_HEGRENADE && weapon != CSW_FLASHBANG && weapon != CSW_SMOKEGRENADE && weapon != CSW_C4)
                {
                    
cs_set_user_bpammo(idweapon99999)
                    
cs_set_user_money(idmoney get_pcvar_num(UnlimitedAmmoPrize), 1)
                    
formatex(messagecharsmax(message), "%s ^1%L"szPrefixLANG_SERVER"CSHOP_BOUGHT"LANG_SERVER"CSHOP_UNLAMMO"get_pcvar_num(UnlimitedAmmoPrize))
                }
                else
                {
                    
cantactivate[id] = 2
                    cantactivateitem
(id)
                    return 
PLUGIN_HANDLED
                
}
            }
            else
            {
                
notenough(id)
                return 
PLUGIN_HANDLED
            
}
        }
        case 
4// Item "e": All Grenades [800$]
        
{
            if(
money >= get_pcvar_num(AllGrenadesPrize))
            {
                
give_item(id"weapon_hegrenade")
                
give_item(id"weapon_flashbang")
                
give_item(id"weapon_flashbang")
                
give_item(id"weapon_smokegrenade")
                
cs_set_user_money(idmoney get_pcvar_num(AllGrenadesPrize))
                
formatex(messagecharsmax(message), "%s ^1%L"szPrefixLANG_SERVER"CSHOP_BOUGHT"LANG_SERVER"CSHOP_ALLGRENADES"get_pcvar_num(AllGrenadesPrize))
            }
            else
            {
                
notenough(id)
                return 
PLUGIN_HANDLED
            
}
        }
        case 
5// Item "f": Bomber [1600$]
        
{
            if(
money >= get_pcvar_num(BomberPrize))
            {
                
give_item(id"weapon_hegrenade")
                
cs_set_user_bpammo(idCSW_HEGRENADEget_pcvar_num(BomberAmmount))
                
cs_set_user_money(idmoney get_pcvar_num(BomberPrize))
                
formatex(messagecharsmax(message), "%s ^1%L"szPrefixLANG_SERVER"CSHOP_BOUGHT"LANG_SERVER"CSHOP_BOMBER"get_pcvar_num(BomberPrize))
            }
            else
            {
                
notenough(id)
                return 
PLUGIN_HANDLED
            
}
        }
        case 
6// Item "g": Silent Footsteps [3000$]
        
{
            if(
money >= get_pcvar_num(SilentFootstepsPrize))
            {
                
set_user_footsteps(id1)
                
cs_set_user_money(idmoney get_pcvar_num(SilentFootstepsPrize))
                
formatex(messagecharsmax(message), "%s ^1%L"szPrefixLANG_SERVER"CSHOP_BOUGHT"LANG_SERVER"CSHOP_SILENTSTEPS"get_pcvar_num(SilentFootstepsPrize))
            }
            else
            {
                
notenough(id)
                return 
PLUGIN_HANDLED
            
}
        }
        case 
7// Item "h": Faster Speed [4300$]
        
{
            if(
money >= get_pcvar_num(FasterSpeedPrize))
            {
                
cshop_speed[id] = true
                set_user_maxspeed
(idget_pcvar_float(FasterSpeedAmmount))
                
cs_set_user_money(idmoney get_pcvar_num(FasterSpeedPrize))
                
formatex(messagecharsmax(message), "%s ^1%L"szPrefixLANG_SERVER"CSHOP_BOUGHT"LANG_SERVER"CSHOP_FASTERSPEED"get_pcvar_num(FasterSpeedPrize))
            }
            else
            {
                
notenough(id)
                return 
PLUGIN_HANDLED
            
}
        }
        case 
8// Item "i": Low Gravity [2800$]
        
{
            if(
money >= get_pcvar_num(LowGravityPrize))
            {
                
set_user_gravity(idget_pcvar_float(LowGravityAmmount))
                
cs_set_user_money(idmoney get_pcvar_num(LowGravityPrize))
                
formatex(messagecharsmax(message), "%s ^1%L"szPrefixLANG_SERVER"CSHOP_BOUGHT"LANG_SERVER"CSHOP_LOWGRAVITY"get_pcvar_num(LowGravityPrize))
            }
            else
            {
                
notenough(id)
                return 
PLUGIN_HANDLED
            
}
        }
        case 
9// Item "j": Chameleon [9000$]
        
{
            if(
money >= get_pcvar_num(ChameleonPrize))
            {
                switch(
get_user_team(id))
                {
                    case 
1cs_set_user_model(idg_playerModels[random_num(47)])
                    case 
2cs_set_user_model(idg_playerModels[random_num(03)])
                }
                
cs_set_user_money(idmoney get_pcvar_num(ChameleonPrize))
                
formatex(messagecharsmax(message), "%s ^1%L"szPrefixLANG_SERVER"CSHOP_BOUGHT"LANG_SERVER"CSHOP_CHAMELEON"get_pcvar_num(ChameleonPrize))
            }
            else
            {
                
notenough(id)
                return 
PLUGIN_HANDLED
            
}
        }
        case 
10// Item "k": Drugs (Speed + Health) [8000$]
        
{
            if(
money >= get_pcvar_num(DrugsPrize))
            {
                
set_user_health(idget_pcvar_num(DrugsHealthAmmount))
                
set_user_maxspeed(idget_pcvar_float(DrugsSpeedAmmount))
                
message_begin(MSG_ONEgmsg_SetFOV, {000}, id)
                
write_byte(180)
                
message_end()
                
cs_set_user_money(idmoney get_pcvar_num(DrugsPrize))
                
formatex(messagecharsmax(message), "%s ^1%L"szPrefixLANG_SERVER"CSHOP_BOUGHT"LANG_SERVER"CSHOP_DRUGS"get_pcvar_num(DrugsPrize))
            }
            else
            {
                
notenough(id)
                return 
PLUGIN_HANDLED
            
}
        }
        case 
11// Item "l": Transparency [2500$]
        
{
            if(
money >= get_pcvar_num(TransparencyPrize))
            {
                
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlphaget_pcvar_num(TransparencyAmmount))
                
cs_set_user_money(idmoney get_pcvar_num(TransparencyPrize))
                
formatex(messagecharsmax(message), "%s ^1%L"szPrefixLANG_SERVER"CSHOP_BOUGHT"LANG_SERVER"CSHOP_TRANSPARENCY"get_pcvar_num(TransparencyPrize))
            }
            else
            {
                
notenough(id)
                return 
PLUGIN_HANDLED
            
}
        }
        case 
12// Item "m": Invisibility (15 Seconds) [16000$]
        
{
            if(
money >= get_pcvar_num(InvisibilityPrize))
            {
                
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha0)
                
set_task(get_pcvar_float(InvisibilityTime), "NoMoreInvis"id)
                
cs_set_user_money(idmoney get_pcvar_num(InvisibilityPrize))
                
formatex(messagecharsmax(message), "%s ^1%L"szPrefixLANG_SERVER"CSHOP_BOUGHT"LANG_SERVER"CSHOP_INVISIBILITY"get_pcvar_num(InvisibilityPrize))
            }
            else
            {
                
notenough(id)
                return 
PLUGIN_HANDLED
            
}
        }
        case 
13// Item "n": Double Damage [10000$]
        
{
            if(
money >= get_pcvar_num(DoubleDamagePrize))
            {
                
cshop_ddamage[id] = true
                cs_set_user_money
(idmoney get_pcvar_num(DoubleDamagePrize))
                
formatex(messagecharsmax(message), "%s ^1%L"szPrefixLANG_SERVER"CSHOP_BOUGHT"LANG_SERVER"CSHOP_DDAMAGE"get_pcvar_num(DoubleDamagePrize))
            }
            else
            {
                
notenough(id)
                return 
PLUGIN_HANDLED
            
}
        }
        case 
14// Item "o": GodMode (5 Seconds) [16000$]
        
{
            if(
money >= get_pcvar_num(GodModePrize))
            {
                
set_user_godmode(id1)
                
set_task(get_pcvar_float(GodModeTime), "NoMoreGod"id)
                
cs_set_user_money(idmoney get_pcvar_num(GodModePrize))
                
formatex(messagecharsmax(message), "%s ^1%L"szPrefixLANG_SERVER"CSHOP_BOUGHT"LANG_SERVER"CSHOP_GODMODE"get_pcvar_num(GodModePrize))
            }
            else
            {
                
notenough(id)
                return 
PLUGIN_HANDLED
            
}
        }
        case 
15// Item "p": Health Regeneration [1800$]
        
{
            if(
money >= get_pcvar_num(HealthRegenPrize))
            {
                
cshop_healthregen[id] = true
                set_task
(get_pcvar_float(HealthRegenTime), "healthRegenTicker"id""0"b"0)
                
cs_set_user_money(idmoney get_pcvar_num(HealthRegenPrize))
                
formatex(messagecharsmax(message), "%s ^1%L"szPrefixLANG_SERVER"CSHOP_BOUGHT"LANG_SERVER"CSHOP_HEALTHREGEN"get_pcvar_num(HealthRegenPrize))
            }
            else
            {
                
notenough(id)
                return 
PLUGIN_HANDLED
            
}
        }
        case 
16// Item "q": Armor Regeneration [2000$]
        
{
            if(
money >= get_pcvar_num(ArmorRegenPrize))
            {
                
cshop_armorregen[id] = true
                set_task
(get_pcvar_float(ArmorRegenTime), "armorRegenTicker"id""0"b"0)
                
cs_set_user_money(idmoney get_pcvar_num(ArmorRegenPrize))
                
formatex(messagecharsmax(message), "%s ^1%L"szPrefixLANG_SERVER"CSHOP_BOUGHT"LANG_SERVER"CSHOP_ARMORREGEN"get_pcvar_num(ArmorRegenPrize))
            }
            else
            {
                
notenough(id)
                return 
PLUGIN_HANDLED
            
}
        }
    }
    
    
emit_sound(idCHAN_ITEMg_itemSounds[item], VOL_NORMATTN_NORM0PITCH_NORM)
    
ColorChat(idTEAM_COLORmessage)
    
    
menu_destroy(customshop)
    return 
PLUGIN_HANDLED
}

public 
notenough(id)
{
    
ColorChat(idTEAM_COLOR"%s ^1%L"szPrefixLANG_SERVER"CSHOP_NOTENOUGH")
    
client_cmd(id"spk %s"sNo)
}

public 
cantactivateitem(id)
{
    switch(
cantactivate[id])
    {
        case 
1ColorChat(idTEAM_COLOR"%s ^1%L"szPrefixLANG_SERVER"CSHOP_CANNOT_ACTIVATE"LANG_SERVER"CSHOP_UNLCLIP")
        case 
2ColorChat(idTEAM_COLOR"%s ^1%L"szPrefixLANG_SERVER"CSHOP_CANNOT_ACTIVATE"LANG_SERVER"CSHOP_UNLAMMO")
    }
    
client_cmd(id"spk %s"sNo)
}

public 
NoMoreInvis(id)
{
    
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha255)
    
ColorChat(idTEAM_COLOR"%s ^1%L"szPrefixLANG_SERVER"CSHOP_NOMOREINVIS")
    
client_cmd(id"spk %s"sOver)
}

public 
NoMoreGod(id)
{
    if(
is_user_alive(id)) set_user_godmode(id0)
    
ColorChat(idTEAM_COLOR"%s ^1%L"szPrefixLANG_SERVER"CSHOP_NOMOREGOD")
    
client_cmd(id"spk %s"sOver)
}

public 
ham_damage(victiminflictorattackerFloat:damagedamage_bits)
{
    if(
is_user_alive(attacker) && cshop_ddamage[attacker] && attacker != victim)
        
SetHamParamFloat(4damage 2)
}

public 
healthRegenTicker(id)
{
    if(!
is_user_alive(id) || !cshop_healthregen[id]) remove_task(id)
    
    new 
health get_user_health(id)
    new 
healthammount get_pcvar_num(HealthRegenAmmount)
    new 
healthmax get_pcvar_num(HealthRegenMax)
    
    if(
cshop_healthregen[id] && is_user_alive(id))
    {
        if(
health healthmax)
        {
            if(
health healthammount healthmaxset_user_health(idhealthmax)
            else 
set_user_health(idhealth healthammount)
        }
    }
}

public 
armorRegenTicker(id)
{
    if(!
is_user_alive(id) || !cshop_armorregen[id]) remove_task(id)
    
    new 
armor get_user_armor(id)
    new 
armorammount get_pcvar_num(ArmorRegenAmmount)
    new 
armormax get_pcvar_num(ArmorRegenMax)
        
    if(
cshop_armorregen[id] && is_user_alive(id))
    {
        if(
armor armormax)
        {
            if(
armor armorammount armormaxset_user_armor(idarmormax)
            else 
set_user_armor(idarmor armorammount)
        }
    }
}

public 
plugin_precache()
{
    for(new 
0sizeof g_itemSoundsi++)
        
precache_sound(g_itemSounds[i])
}

/* ======================================================================================================= */
/* ColorChat */
/* ======================================================================================================= */
ColorChat(idColor:type, const msg[], {Float,Sql,Result,_}:...)
{
    if( !
get_playersnum() ) return;
    
    new 
message[256];

    switch(
type)
    {
        case 
NORMAL// clients scr_concolor cvar color
        
{
            
message[0] = 0x01;
        }
        case 
GREEN// Green
        
{
            
message[0] = 0x04;
        }
        default: 
// White, Red, Blue
        
{
            
message[0] = 0x03;
        }
    }

    
vformat(message[1], 251msg4);

    
replace_all(message191"!n""^x01")
    
replace_all(message191"!t""^x03")
    
replace_all(message191"!g""^x04")
    
    
// Make sure message is not longer than 192 character. Will crash the server.
    
message[192] = '^0';

    new 
teamColorChangeindexMSG_Type;
    
    if(
id)
    {
        
MSG_Type MSG_ONE;
        
index id;
    } else {
        
index FindPlayer();
        
MSG_Type MSG_ALL;
    }
    
    
team get_user_team(index);
    
ColorChange ColorSelection(indexMSG_Typetype);

    
ShowColorMessage(indexMSG_Typemessage);
        
    if(
ColorChange)
    {
        
Team_Info(indexMSG_TypeTeamName[team]);
    }
}

ShowColorMessage(idtypemessage[])
{
    static 
bool:saytext_used;
    static 
get_user_msgid_saytext;
    if(!
saytext_used)
    {
        
get_user_msgid_saytext get_user_msgid("SayText");
        
saytext_used true;
    }
    
message_begin(typeget_user_msgid_saytext_id);
    
write_byte(id)        
    
write_string(message);
    
message_end();    
}

Team_Info(idtypeteam[])
{
    static 
bool:teaminfo_used;
    static 
get_user_msgid_teaminfo;
    if(!
teaminfo_used)
    {
        
get_user_msgid_teaminfo get_user_msgid("TeamInfo");
        
teaminfo_used true;
    }
    
message_begin(typeget_user_msgid_teaminfo_id);
    
write_byte(id);
    
write_string(team);
    
message_end();

    return 
1;
}

ColorSelection(indextypeColor:Type)
{
    switch(
Type)
    {
        case 
RED:
        {
            return 
Team_Info(indextypeTeamName[1]);
        }
        case 
BLUE:
        {
            return 
Team_Info(indextypeTeamName[2]);
        }
        case 
GREY:
        {
            return 
Team_Info(indextypeTeamName[0]);
        }
    }

    return 
0;
}

FindPlayer()
{
    new 
= -1;

    while(
<= get_maxplayers())
    {
        if(
is_user_connected(++i))
            return 
i;
    }

    return -
1;


Last edited by KeDa2; 12-04-2014 at 09:06.
KeDa2 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode