Raised This Month: $51 Target: $400
 12% 

How to set money


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 03-18-2019 , 03:14   How to set money
Reply With Quote #1

Hi all . cs 1.6 . i want set money for my magice menu guns . how do this in code ??

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
#include <engine>
#include <csx>

public plugin_init()
{
    
register_plugin("My Menu""1.0""Me");
    
register_clcmd("say /vmenu""ShowMenu");
    
register_clcmd("say /vmenu""ShowMenu");
    
register_concmd("say /vmenu""ShowMenu" ADMIN_RESERVATION );
    
}

public 
ShowMenu(id)
{
    new 
menu menu_create("PubLic Menu :""MohammadHlwani");

    
menu_additem(menu"\r[\yTorNado\r]"""0); // case 0
    
menu_additem(menu"\r[\yFazaIi\r]"""0); // case 1

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);

    
menu_display(idmenu0);

    return 
PLUGIN_HANDLED;
}

public 
MohammadHlwani(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_cancel(id);
        return 
PLUGIN_HANDLED;
    }

    new 
command[6], name[64], accesscallback;

    
menu_item_getinfo(menuitemaccesscommandsizeof command 1namesizeof name 1callback);

    switch(
item)
    {
        case 
0client_cmd(id"tornado");
        case 
1client_cmd(id"say /link");

    }

    
menu_destroy(menu);

    return 
PLUGIN_HANDLED;

Mikaeel123 is offline
eat1k
Senior Member
Join Date: Apr 2018
Old 03-18-2019 , 07:19   Re: How to set money
Reply With Quote #2

cs_set_user_money
__________________
eat1k is offline
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 03-18-2019 , 07:23   Re: How to set money
Reply With Quote #3

i want when buy this guns lose example 10000 money
is it this ??
cs_set_user_money 10000
and what place that ??
Mikaeel123 is offline
iNvectus
Member
Join Date: Sep 2014
Location: Bulgaria
Old 03-18-2019 , 07:40   Re: How to set money
Reply With Quote #4

Quote:
Originally Posted by Mikaeel123 View Post
i want when buy this guns lose example 10000 money
is it this ??
cs_set_user_money 10000
and what place that ??
Here is an example code on how you can use it:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

public plugin_init() {
    
register_plugin("Give Money""1.00""iNvectus")

    
register_clcmd("say""cmdGiveMoney");
}

public 
cmdGiveMoney(id) {
    new 
args[192], cmd[63], name[63], cashGiven[63];
    
read_args(argscharsmax(args)); remove_quotes(args);

    
parse(argscmdcharsmax(cmd), namecharsmax(name), cashGivencharsmax(cashGiven));

    if(
equali(cmd"/give"))
    {
        if(!
strlen(name) || !strlen(cashGiven))
        {
            
client_print(idprint_chat"Usage: /give <nick> <money>.");
            
            return 
PLUGIN_HANDLED;
        }

        new 
target cmd_target(idname0);
        new 
moneyToGive str_to_num(cashGiven);

        if(!
target)
        {
            
client_print(idprint_chat"Enter whom you wanna give money.");
            
            return 
PLUGIN_HANDLED;
        }

        if(
moneyToGive <= 0)
        {
            
client_print(idprint_chat"You cannot give $0.");
            
            return 
PLUGIN_HANDLED;
        }

        
cs_set_user_money(targetcs_get_user_money(target) + moneyToGive);

        new 
names[32][63];
        
get_user_name(targetnames[0], charsmax(names[]));
        
get_user_name(idnames[1],  charsmax(names));

        
client_print(0print_chat"%s gave $%d to %s"names[1], moneyToGivenames[0]);

        return 
PLUGIN_HANDLED;    
    }

    return 
PLUGIN_CONTINUE;


Last edited by iNvectus; 03-18-2019 at 07:41.
iNvectus is offline
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 03-18-2019 , 07:49   Re: How to set money
Reply With Quote #5

i want take not want give
Mikaeel123 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-18-2019 , 07:58   Re: How to set money
Reply With Quote #6

Even a 5 year old would have figured out that he can use "-" instead of "+" if he wants to TAKE instead of GIVE. Did you not go to school or something? If you want to use this section and learn something, try using your brain.
__________________

Last edited by OciXCrom; 03-18-2019 at 07:59.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 03-18-2019 , 08:01   Re: How to set money
Reply With Quote #7

Quote:
cs_set_user_money(target, cs_get_user_money(target) + moneyToGive);
and this how much ^_^
Mikaeel123 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-18-2019 , 09:48   Re: How to set money
Reply With Quote #8

You can take with changing th3 given cash amount to negative
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 03-18-2019 , 10:16   Re: How to set money
Reply With Quote #9

First step,

know what is brain:
https://en.wikipedia.org/wiki/Brain

know what is subtraction:
https://en.wikipedia.org/wiki/Subtraction

know what is cs_set_user_money:
https://www.amxmodx.org/api/cstrike/cs_set_user_money

know what is cs_get_user_money:
https://www.amxmodx.org/api/cstrike/cs_get_user_money

then mix all that and... voila!
Code:
cs_set_user_money(target, cs_get_user_money(target) - 10000);
__________________









Last edited by CrazY.; 03-18-2019 at 10:23.
CrazY. is offline
SHIELD755
Veteran Member
Join Date: Feb 2018
Location: FROM MARVEL STUDIO
Old 03-18-2019 , 10:30   Re: How to set money
Reply With Quote #10

Quote:
Originally Posted by CrazY. View Post
First step,

know what is brain:
https://en.wikipedia.org/wiki/Brain

know what is subtraction:
https://en.wikipedia.org/wiki/Subtraction

know what is cs_set_user_money:
https://www.amxmodx.org/api/cstrike/cs_set_user_money

know what is cs_get_user_money:
https://www.amxmodx.org/api/cstrike/cs_get_user_money

then mix all that and... voila!
Code:
cs_set_user_money(target, cs_get_user_money(target) - 10000);
first: i cannot stop laughing
second : i love that first one , what brain hahah LOL
SHIELD755 is offline
Reply



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 12:59.


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