Raised This Month: $ Target: $400
 0% 

pcvar help.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 09-19-2011 , 15:38   pcvar help.
Reply With Quote #1

Like almost everyone knows, i'm making the JailBreakShop. I want to add a pcvar wich enables & disables the shop, but i don't know how i should call it in a function. Can someone help me?

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <cstrike>
#include <fun>
#include <colorchat>
#include <dhudmessage>

new const PLUGIN[] = "JailBreakShop"
new const VERSION[] = "v1.0"
new const AUTHOR[] = "NapoleoN#"

new const g_szPrefix[] = "^x04[JB-Shop]^x01"
new const JBINFO[] = "jbinfo.html"
new const CMD[] = "commands.html"

new g_pEnableShop
new g_pEnableInfo
new g_pEnableCommands
new g_pEnableGamble


public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /jbshop""JailBreakShop")
    
register_clcmd("say /shop""JailBreakShop")
    
register_clcmd("say /jailbreakshop""JailBreakShop")
    
register_clcmd("say_team /jbshop""JailBreakShop")
    
register_clcmd("say_team /shop""JailBreakShop")
    
register_clcmd("say_team /jailbreakshop""JailBreakShop")
    
    
register_clcmd("say /jbinfo""JailBreakInfo")
    
register_clcmd("say_team /jbinfo""JailBreakInfo")
    
register_clcmd("say /info""JailBreakInfo")
    
register_clcmd("say_team /info""JailBreakInfo")
    
    
register_clcmd("say /commands""Commands")
    
register_clcmd("say /cmds""Commands")
    
register_clcmd("say_team /commands""Commands")
    
register_clcmd("say_team /cmds""Commands")
    
    
register_clcmd("say /gamble""gamble")
    
register_clcmd("say /rtd""gamble")
    
register_clcmd("say_team /gamble""gamble")
    
register_clcmd("say_team /rtd""gamble")
    
    
g_pEnableShop register_cvar("jb_shop""1"FCVAR_SERVER)
    
g_pEnableInfo register_cvar("jb_info""1"FCVAR_SERVER)
    
g_pEnableCommands register_cvar("jb_commands""1"FCVAR_SERVER)
    
g_pEnableGamble register_cvar("jb_gamble""1"FCVAR_SERVER)
}

public 
JailBreakShop(id)
{
    if(
cs_get_user_team(id)==CS_TEAM_T && is_user_alive(id))
    {
        new 
ShopMenu menu_create("\rJailBreak \yShop \wMenu:""shop_handler")
        
menu_additem(ShopMenu"Deagle (7 Bullets) - \y3000$""1"id)
        
menu_additem(ShopMenu"Gravity (600) - \y2000$""2"id)
        
menu_additem(ShopMenu"Speed - \y1500$""3"id)
        
menu_additem(ShopMenu"Regenerate to 100 HP - \y4000$""4"id)
        
menu_additem(ShopMenu"Disable Footsteps - \y2000$""5"id)
        
menu_additem(ShopMenu"Invisebility 60 Seconds - \y6000$""6"id)
        
menu_additem(ShopMenu"Roll the dice!""7"id)
        
menu_display(idShopMenu0)
        
menu_setprop(ShopMenuMPROP_EXITMEXIT_ALL)
    }
    else if(
cs_get_user_team(id)==CS_TEAM_CT && is_user_alive(id))
    {
        new 
menu menu_create("\rJailBreak \yShop \wMenu:""menu_handler")
        
menu_additem(menu"Roll the dice!""1"id)
        
menu_display(idmenu0)
        
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    }
}

public 
shop_handler(idShopMenuitem)
{
    new 
money cs_get_user_money(id)
    if(
is_user_alive(id) && cs_get_user_team(id)==CS_TEAM_T)
    {
        switch(
item)
        {
            case 
0:
            {
                if(
money >= 3000)
                {
                    new 
setmoney money 3000
                    cs_set_user_money
(idclamp(setmoney016000))
                    
give_item(id"weapon_deagle")
                    
ColorChat(idTEAM_COLOR"%s You received a^x03 deagle^x01 with 7 bullets!"g_szPrefix)
                }
                else
                {
                    
ColorChat(idTEAM_COLOR"%s You do not have enough money to buy this item!"g_szPrefix)
                }
                return 
PLUGIN_CONTINUE
            
}
            case 
1:
            {
                if(
money >= 2000)
                {
                    new 
setmoney money 2000
                    cs_set_user_money
(idclamp(setmoney016000))
                    
set_user_gravity(id0.7)
                    
ColorChat(idTEAM_COLOR"%s You have now 600 Gravity!"g_szPrefix)
                }
                else
                {
                    
ColorChat(idTEAM_COLOR"%s You do not have enough money to buy this item!"g_szPrefix)
                }
                return 
PLUGIN_CONTINUE
            
}
            case 
2:
            {
                if(
money >= 1500)
                {
                    new 
setmoney money 1500
                    cs_set_user_money
(idclamp(setmoney016000))
                    
set_user_maxspeed(id320.0)
                    
ColorChat(idTEAM_COLOR"%s You have now more speed and you're ready to rebel!"g_szPrefix)
                }
                else
                {
                    
ColorChat(idTEAM_COLOR"%s You do not have enough money to buy this item!"g_szPrefix)
                }
                return 
PLUGIN_CONTINUE
            
}
            case 
3:
            {
                if(
money >= 4000)
                {
                    new 
setmoney money 4000
                    cs_set_user_money
(idclamp(setmoney016000))
                    
set_user_health(id100)
                    
ColorChat(idTEAM_COLOR"%s You regenerated your health to 100!"g_szPrefix)
                }
                else
                {
                    
ColorChat(idTEAM_COLOR"%s You do not have enough money to buy this item!"g_szPrefix)
                }
                return 
PLUGIN_CONTINUE
            
}
            case 
4:
            {
                if(
money >= 2000)
                {
                    new 
setmoney money 2000
                    cs_set_user_money
(idclamp(setmoney016000))
                    
set_user_footsteps(id1)
                    
ColorChat(idTEAM_COLOR"%s You don't have any footsteps anymore!"g_szPrefix)
                }
                else
                {
                    
ColorChat(idTEAM_COLOR"%s You do not have enough money to buy this item!"g_szPrefix)
                }
                return 
PLUGIN_CONTINUE
            
}
            case 
5:
            {
                if(
money >= 6000)
                {
                    new 
setmoney money 6000
                    cs_set_user_money
(idclamp(setmoney016000))
                    
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha15);
                    
ColorChat(idTEAM_COLOR"%s You are now invisable for 60 seconds!"g_szPrefix)
                    
set_task(60.0"RemoveInvis"id)
                }
                else
                {
                    
ColorChat(idTEAM_COLOR"%s You do not have enough money to buy this item!"g_szPrefix)
                }
                return 
PLUGIN_CONTINUE
            
}
            case 
6:
            {
                
gamble(id)
            }
        }
    }
    return 
PLUGIN_HANDLED
}

public 
client_putinserver(id)
{
    
set_task(10.0"ShowMessage"id)
    
set_task(20.0"ShowInfo"id)
}

public 
ShowMessage(id)
{
    if(
is_user_connected(id))
    {
        new 
szName[32]; get_user_name(idszNamecharsmax(szName))
        
ColorChat(idTEAM_COLOR"%s Welcome to the server, ^x04[%s]^x01!"g_szPrefixszName)
    }
}

public 
RemoveInvis(id)
{
    if(
is_user_alive(id))
    {
        
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha255)
        
ColorChat(idTEAM_COLOR"%s You are not invisable anymore!"g_szPrefix)
    }
}

public 
JailBreakInfo(id)
{
    if(
is_user_connected(id))
    {
        
show_motd(idJBINFO"JailBreak Shop Information!")
    }
}

public 
ShowInfo(id)
{
    if(
is_user_connected(id))
    {
        
ColorChat(idTEAM_COLOR"%s Type /info to check out the information about the JB Shop!"g_szPrefix)
    }
}

public 
Commands(id)
{
    if(
is_user_connected(id))
    {
        
show_motd(idCMD"JailBreak Shop Commands!")
    }
}

public 
gamble(id)
{
    new 
money cs_get_user_money(id)
    if(
money >= 500)
    {
        new 
Playernum random_num(1100)
        new 
Servernum random_num(25100)
        if(
Playernum Servernum)
        {
            new 
szName[32]; get_user_name(idszNamecharsmax(szName))
            new 
setmoney money 500
            cs_set_user_money
(idclamp(setmoney050000))
            
ColorChat(idTEAM_COLOR"%s %s has won the^x03 dice!^x04 %i^x01 versus^x04 %i"g_szPrefixszNamePlayernumServernum)
        
        }
        else if(
Servernum Playernum)
        {
            if(
money >= 500 )
            {
                new 
setmoney money 500
                cs_set_user_money
(idclamp(setmoney050000))
                
ColorChat(idTEAM_COLOR"%s Server! has won the ^x03 dice!^x04 %i^x01 versus^x03 %i"g_szPrefixServernumPlayernum)
            }
        }
    }
    else
    {
        
ColorChat(idTEAM_COLOR"%s You need atleast 500$ to gamble!"g_szPrefix)
    }
    return 
PLUGIN_CONTINUE
}

public 
menu_handler(idmenuitem)
{
    if(
is_user_alive(id) && cs_get_user_team(id)==CS_TEAM_CT)
    {
        switch(
item)
        {
            case 
0:
            {
                
gamble(id)
            }
        }
    }
    else
    {
        new 
szName[32]; get_user_name(idszNamecharsmax(szName))
        
ColorChat(idTEAM_COLOR"%s You have to be alive to enter the Shop, %s!"g_szPrefixszName)
    }
}

public 
enableshop(id)
{
    if(
get_pcvar_num(g_pEnableShop))
    {
        
    }
    if(!
get_pcvar_num(p_enableShop))
    {
        
    }

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
 



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 19:30.


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