Raised This Month: $ Target: $400
 0% 

Need Code


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Choose_Your_Destiny
Senior Member
Join Date: May 2011
Old 10-03-2011 , 04:22   Re: Need Code
Reply With Quote #9

Ok. But, I don't know weapons in the hands of the players?

PHP Code:
#include <amxmodx>
#include <fun>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <colorchat>

#define PLUGIN    "CT Menu"
#define VERSION    "1.0"
#define AUTHOR    "Choose"
#define LOADING    "^n^t%s v%s, Copyright (C) 2011 by %s^n"

new cost
new tag[]="^4[CTMENU]^1"

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
server_print(LOADINGPLUGINVERSIONAUTHOR);
    
    
RegisterHam(Ham_Spawn"player""CTMenu"1);
    
    
cost    register_cvar("100 HP" "3750")
    
cost    register_cvar("250 HP" "7500")
    
cost    register_cvar("100 Armor" "11500")
    
cost    register_cvar("30 Bpammo" "15000")
}

public 
CTMenu(id)
{
    if(
get_user_team(id) == CS_TEAM_CT)
    {
        new 
menu menu_create("\r#\w#\r#\w#\r#\w#\r#\w#\r= [CTMENU] - What would buy?: \w=\r#\w#\r#\w#\r#\w#\r#\w#","CTMenuHandler");
        
menu_additem(menu"\w100 HP - 3750 CT Cost""1"0);
        
menu_additem(menu"\w250 HP - 7500 CT Cost""2"0);
        
menu_additem(menu,  "\w100 Armor - CT Cost""3"0);
        
menu_additem(menu"\w90 Bpammo - CT Cost""4"0);
        
        
menu_setprop(menuMPROP_EXITMEXIT_ALL)
        
        
menu_display(idmenu0)
    }
}

public 
CTMenuHandler(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64]
    new 
accescallback
    menu_item_getinfo
(menuitemaccesdata5iName63callback)
    
    new 
key str_to_num(data)
    
    switch(
key)
    {
        case 
1:
        {
            new 
player_cost cs_get_user_money(id)
            new 
menu_cost get_pcvar_num(cost)
            if (
player_cost menu_cost)
            {
                
ColorChat(0NORMAL"^4%s^1: Don't have enough CT money.!",tag)
                return 
PLUGIN_HANDLED
            
}
            else if (
player_cost >= menu_cost)
            {
                
ColorChat(0NORMAL"^4%s^1: 100 HP purchased.!",tag)
                
cs_set_user_health(id100)
                
cs_set_user_money(idplayer_cost menu_cost)
            }
        }
        
        case 
2:
        {
            new 
player_cost cs_get_user_money(id)
            new 
menu_cost get_pcvar_num(cost)
            if (
player_cost menu_cost)
            {
                
ColorChat(0NORMAL"^4%s^1: Don't have enough CT money.!",tag)
                return 
PLUGIN_HANDLED
            
}
            else if (
player_cost >= menu_cost)
            {
                
ColorChat(0NORMAL"^4%s^1: 250 HP purchased.!",tag)
                
cs_set_user_health(id250)
                
cs_set_user_money(idplayer_cost menu_cost)
            }
        }
        
        case 
3:
        {
            new 
player_cost cs_get_user_money(id)
            new 
menu_cost get_pcvar_num(cost)
            if (
player_cost menu_cost )
            {
                
ColorChat(0NORMAL"^4%s^1: Don't have enough CT money.!",tag)
                return 
PLUGIN_HANDLED
            
}
            else if (
player_cost >= menu_cost)
            {
                
ColorChat(0NORMAL"^4%s^1: 100 Armor purchased.!",tag)
                
cs_set_user_armor(id100)
                
cs_set_user_money(idplayer_cost menu_cost)
            }
        }
        
        case 
4:
        {
            new 
player_cost cs_get_user_money(id)
            new 
menu_cost get_pcvar_num(cost)
            if (
player_cost menu_cost )
            {
                
ColorChat(0NORMAL"^4%s^1: Don't have enough CT money.!",tag)
                return 
PLUGIN_HANDLED
            
}
            else if (
player_cost >= menu_cost)
            {
                
ColorChat(0NORMAL"^4%s^1: 90 bpammo purchased.!",tag)
                
cs_set_user_bpammo(idCSW_xxxxx90)
                
cs_set_user_money(idplayer_csot menu_cost)
            }
        }
    }


PHP Code:
CSW_xxxxx 

Last edited by Choose_Your_Destiny; 10-03-2011 at 04:44.
Choose_Your_Destiny 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 19:31.


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