AlliedModders

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

zirualas 08-11-2010 05:27

BuyMenu
 
How I can do a buy menu like /drshop.
I know how do a simple menu i need to know remove a Money :).

GXLZPGX 08-11-2010 05:37

Re: BuyMenu
 
Quote:

Originally Posted by zirualas (Post 1267956)
How I can do a buy menu like /drshop.
I know how do a simple menu i need to know remove a Money :).

You need cstrike. #include cstrike

then use something like..

PHP Code:

new money cs_get_user_money(id)
cs_set_user_moneyidmoney 5000 

Replace the + sign with a - sign if you want to remove 5000$ from the player.

naven 08-11-2010 07:33

Re: BuyMenu
 
GX, remember about money bug...
PHP Code:

case //gravity
        
{
        if (
cs_get_user_money(id) < 1000){
        
get_user_name(idname31)
        
ColorChat(idGREEN"%s ^x03nie stac cie na to!"name//not enough money
        
return PLUGIN_HANDLED;
    }
        if (!
is_user_alive(id)){
        
ColorChat(idGREEN"%s ^x03musisz zyc mozgu!"name//need to be alive
        
return PLUGIN_HANDLED;
    }
        if (
cs_get_user_money(id) >= 1000 )
        
get_user_name(idname31)
        
ColorChat(0GREEN"%s ^x03wybral grawitacje 700!"name)//grav 700 bought
        
set_user_gravity(id0.87)                //gravity 700= 0.87
        
cs_set_user_money(id cs_get_user_money(id) - 10000)
    } 

Example from my very old never used plugin.

zirualas 08-11-2010 08:23

Re: BuyMenu
 
What's problem?
PHP Code:

//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// testas.sma
// C:\Program Files\Counter-strike\cstrike\addons\amxmodx\scripting\testas.sma(2
3) : error 017undefined symbol "fun_menu"
// C:\Program Files\Counter-strike\cstrike\addons\amxmodx\scripting\testas.sma(2
3) : warning 215expression has no effect
// C:\Program Files\Counter-strike\cstrike\addons\amxmodx\scripting\testas.sma(2
3) : warning 215expression has no effect
// C:\Program Files\Counter-strike\cstrike\addons\amxmodx\scripting\testas.sma(2
3) : error 001expected token";"but found ")"
// C:\Program Files\Counter-strike\cstrike\addons\amxmodx\scripting\testas.sma(2
3) : error 029invalid expressionassumed zero
// C:\Program Files\Counter-strike\cstrike\addons\amxmodx\scripting\testas.sma(2
3) : fatal error 107too many error messages on one line
//
// Compilation aborted.
// 4 Errors.
// Could not locate output file C:\Program Files\Counter-strike\cstrike\addons\a
mxmodx\scripting\compiled\testas.amx (compile failed).
//
// Compilation Time: 0.05 sec
// ----------------------------------------

Press enter to exit ... 

My code:
PHP Code:

#include <amxmodx>
#include <cstrike>

#define PLUGIN "Fun Buy"
#define VERSION "1.0"
#define AUTHOR "ZiruAl"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_clcmd"say /funbuy""FunBuy" );
    
register_clcmd"say_team /funbuy""FunBuy" );

}
public 
FunBuy(id)
{
    new 
menu menu_create("\gFun Buy Menu:""menu_handler");

    
menu_additem(menu"\w Low Gravity - \r4000""1"0);
    
menu_additem(menu"\w Low Gravity - \r4000""2"0);

    
menu_setprop(fun_menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0);
}
public 
menu_handler(idmenuitem);
{
    
ofitem == MENU_EXIT )
    {
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
    }
    new 
data[6], iName[64];
    new 
acvesscallback;

    
menu_item_getinfo(menuitemaccessdata,6iName63callback);
    
new_ key str_to_num(data);
    switch(
key)
    {
    case 
//gravity
        
{
            if (
cs_get_user_money(id) < 1000){
            
get_user_name(idname31)
            
ColorChat(idGREEN"%s ^x03Don't have enought money"name)
            return 
PLUGIN_HANDLED;
        }
            if (!
is_user_alive(id)){
            
ColorChat(idGREEN"%s ^x03need to be alive"name)
            return 
PLUGIN_HANDLED;
        }
            if (
cs_get_user_money(id) >= 1000 )
            
get_user_name(idname31)
            
ColorChat(0GREEN"%s ^x03Buy a gravitation"name)
            
set_user_gravity(id0.87)
            
cs_set_user_money(id cs_get_user_money(id) - 10000)
    }
        case 
2:
        {
            
client_print(idprint_chat"Testing..");
        }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
 } 


drekes 08-11-2010 08:33

Re: BuyMenu
 
PHP Code:

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

#define PLUGIN "Fun Buy"
#define VERSION "1.0"
#define AUTHOR "ZiruAl"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_clcmd"say /funbuy""FunBuy" );
    
register_clcmd"say_team /funbuy""FunBuy" );

}
public 
FunBuy(id)
{
    new 
menu menu_create("\gFun Buy Menu:""menu_handler");

    
menu_additem(menu"\w Low Gravity - \r4000""1"0);
    
menu_additem(menu"\w Low Gravity - \r4000""2"0);

    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0);
}

public 
menu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], iName[64];
    new 
acesscallback;

    
menu_item_getinfo(menuitemacessdata,6iName63callback);
    new 
key str_to_num(data);
    
    switch(
key)
    {
        case 
//gravity
        
{
            new 
name[32];
            
            if (
cs_get_user_money(id) < 1000)
            {
                
get_user_name(idname31)
                
ColorChat(idGREEN"%s ^x03Don't have enought money"name)
                return 
PLUGIN_HANDLED;
            }
            
            if (!
is_user_alive(id))
            {
                
ColorChat(idGREEN"%s ^x03need to be alive"name)
                return 
PLUGIN_HANDLED;
            }
            
            if (
cs_get_user_money(id) >= 1000 )
            {
                
get_user_name(idname31)
                
ColorChat(0GREEN"%s ^x03Buy a gravitation"name)
                
set_user_gravity(id0.87)
                
cs_set_user_money(id cs_get_user_money(id) - 10000)
            }
        }
        
        case 
2:
        {
            
client_print(idprint_chat"Testing..");
        }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
 } 


zirualas 08-11-2010 08:36

Re: BuyMenu
 
Oh! :DD I know i don't include <fun> :DD

zirualas 08-11-2010 09:45

Re: BuyMenu
 
Sorry for double post but i have a problem (not scripting I guest)
I set item in buy menu that person can buy a C4 but then i plant 1 bomb and i bougt new bomb he's write you are nor in plant, when i drop the c4 and pickup i can set bomb. So how i can do when i buy bomb and I immediately plant the BOMB :)

GXLZPGX 08-11-2010 11:20

Re: BuyMenu
 
Quote:

Originally Posted by zirualas (Post 1268081)
Sorry for double post but i have a problem (not scripting I guest)
I set item in buy menu that person can buy a C4 but then i plant 1 bomb and i bougt new bomb he's write you are nor in plant, when i drop the c4 and pickup i can set bomb. So how i can do when i buy bomb and I immediately plant the BOMB :)

You have to download porn. Go to google, and look for uTorrent, download it. Then search for "Gay Hairy Porn Torrents", after it's downloaded, you can successfully plant the bomb.

zirualas 08-11-2010 11:40

Re: BuyMenu
 
Whow you realy wath thees videos? I don't like if you like it you can watch ;)

drekes 08-11-2010 15:40

Re: BuyMenu
 
cs_set_user_plant()


All times are GMT -4. The time now is 21:55.

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