AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need Code (https://forums.alliedmods.net/showthread.php?t=168694)

Choose_Your_Destiny 10-02-2011 17:43

Need Code
 
How bpammo buying from the menu?

PHP Code:

public xxxx(id)
{
    if(
get_user_team(id))
    {
        new 
menu menu_create("\r#\w#\r#\w#\r#\w#\r#\w#\r= [CTMENU] \w=\r#\w#\r#\w#\r#\w#\r#\w#","yyy");
        
menu_additem(menu"\w90 Bpammo - 3750 $""1"0);
        
        
menu_setprop(menuMPROP_EXITMEXIT_ALL)
        
        
menu_display(idmenu0)
    }



plowed 10-02-2011 18:50

Re: Need Code
 
http://forums.alliedmods.net/showthread.php?t=46364

Choose_Your_Destiny 10-02-2011 19:05

Re: Need Code
 
I couldn't find :(

enjoi. 10-02-2011 19:26

Re: Need Code
 
you blinD?

Choose_Your_Destiny 10-02-2011 19:32

Re: Need Code
 
Hey man!!

I don't this ask.I want to say ; from menu get bpammo(for any weapon)

plowed 10-02-2011 19:33

Re: Need Code
 
Your menu is not even complete. Change the ammo with cs_set_user_bpammo and include <cstrike>

PHP Code:


#include <amxmodx>

public plugin_init() {
        
}

public 
xxxx(id)
{
    if(
get_user_team(id))
    {
        new 
menu menu_create("\r#\w#\r#\w#\r#\w#\r#\w#\r= [CTMENU] \w=\r#\w#\r#\w#\r#\w#\r#\w#","handler");
        
menu_additem(menu"\w90 Bpammo - 3750 $""1"0);
        
        
menu_setprop(menuMPROP_EXITMEXIT_ALL)
        
        
menu_display(idmenu0)
    }
}  

 public 
handler(idmenuitem)
 {
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    
    new 
data[6], szName[64];
    new 
accesscallback;
 
    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);

    new 
key str_to_num(data);

    switch(
key)
    {
        case 
1:
        {
            
//User selected the first item in the menu, 
        
}
    case 
2:
        {
            
//User selected the second item in the menu
        
}
    }

    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
 } 


Choose_Your_Destiny 10-02-2011 19:45

Re: Need Code
 
Ok. I know :)

DruGzOG 10-02-2011 20:04

Re: Need Code
 
Enjoi. Just link the topic next time lol.

Choose_Your_Destiny 10-03-2011 04:22

Re: Need Code
 
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 


BrundiX 10-05-2011 03:18

Re: Need Code
 
Quote:

Originally Posted by Choose_Your_Destiny (Post 1567500)
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 



something like this?
PHP Code:

#include <amxmodx>
#include <fun>
#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 costcost2cost3cost4;
new 
tag[]="^4[CTMENU]^1";

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
server_print(LOADINGPLUGINVERSIONAUTHOR);
    
    
cost    register_cvar("100 HP" "3750");
    
cost2    register_cvar("250 HP" "7500");
    
cost3    register_cvar("100 Armor" "11500");
    
cost4    register_cvar("30 Bpammo" "15000");
}

public 
CTMenu(id)
{
    if(
cs_get_user_team(id) == CS_TEAM_CT && is_user_alive(id))
    {
        
MakeMenu(id);
    }
}
        
MakeMenu(id)
{
    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);
    
    new 
player_cost cs_get_user_money(id);
    
    switch(
key)
    {
        case 
1:
        {
            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);
                
set_user_health(id100);
                
cs_set_user_money(idplayer_cost menu_cost);
            }
        }
        
        case 
2:
        {
            new 
menu_cost get_pcvar_num(cost2);
            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);
                
set_user_health(id250);
                
cs_set_user_money(idplayer_cost menu_cost);
            }
        }
        
        case 
3:
        {
            new 
menu_cost get_pcvar_num(cost3);
            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);
                
set_user_armor(id100);
                
cs_set_user_money(idplayer_cost menu_cost);
            }
        }
        
        case 
4:
        {
            new 
menu_cost get_pcvar_num(cost4);
            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(idget_user_weapon(id), 90);
                
cs_set_user_money(idplayer_cost menu_cost);
            }
        }
    }
    
menu_destroy(menu);
    return 
PLUGIN_CONTINUE;




All times are GMT -4. The time now is 19:31.

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