Raised This Month: $ Target: $400
 0% 

Maximum amount of money


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 04-15-2009 , 07:26   Maximum amount of money
Reply With Quote #1

How do you make the maximum allowed cash 16,000 because now it gives up to 18,000 and then subtracts to 16,000 in the next round.

PHP Code:
cs_set_user_money(idcs_get_user_money(id) + get_cvar_num("amx_money_num"))
client_print(idprint_chat"%L"LANG_PLAYER"MONEY"get_cvar_num("amx_money_num")) 

Last edited by Debesėlis; 04-15-2009 at 12:38.
Debesėlis is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-15-2009 , 07:38   Re: Money
Reply With Quote #2

Quote:
Originally Posted by Debesėlis View Post
How do you make the maximum allowed cash 16,000 because now it gives up to 18,000 and then subtracts to 16,000 in the next round.
PHP Code:
new amx_money_num_pointer

public plugin_init()
{
    
amx_money_num_pointer register_cvar("amx_money_num""5000")
}

give_money(id)
{
    new 
iMoneyToGive get_pcvar_num(amx_money_num_pointer)
    new 
iPlayerMoney cs_get_user_money(id)
    
iMoneyToGive min(16000 iPlayerMoneyiMoneyToGive)
    
iPlayerMoney += iMoneyToGive
    cs_set_user_money
(id,  iPlayerMoney)
    
client_print(idprint_chat"%L"LANG_PLAYER"MONEY"iMoneyToGive
Less details :
PHP Code:
give_money(id)
{
    new 
iPlayerMoney cs_get_user_money(id)
    new 
iMoneyToGive min(16000 iPlayerMoneyget_pcvar_num(amx_money_num_pointer))
    
cs_set_user_money(id,  iPlayerMoney iMoneyToGive)
    
client_print(idprint_chat"%L"LANG_PLAYER"MONEY"iMoneyToGive
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-15-2009 at 08:50.
ConnorMcLeod is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 04-15-2009 , 07:38   Re: Money
Reply With Quote #3

Code:
new MaxMoney = 16000; new BonusMoney = get_cvar_num("amx_money_num"); // Should use PCVAR new TotalMoney = cs_get_user_money(id) + BonusMoney;   if (BonusMoney >= MaxMoney)         cs_set_user_money(id, MaxMoney); else         cs_set_user_money(id, TotalMoney);
EDIT: Too late.
__________________
hleV is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-15-2009 , 07:39   Re: Money
Reply With Quote #4

Quote:
Originally Posted by hleV View Post
Code:
new MaxMoney = 16000; new BonusMoney = get_cvar_num("amx_money_num"); // Should use PCVAR new TotalMoney = cs_get_user_money(id) + BonusMoney;   if (TotalMoney >= MaxMoney)         cs_set_user_money(id, MaxMoney); else         cs_set_user_money(id, TotalMoney);
EDIT: Too late.
Fixed.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 04-15-2009 , 08:04   Re: Money
Reply With Quote #5

Its a small bit of code from a plugin. Everything works fine, I just want to make the maximum ammount of money given to be 16,000.
When I added the code, you gave me, I started getting an error saying something about iPlayerMoney not being used...

PHP Code:
public money(id)
{
    if(
money_active[id] == 1)
    {    
        new 
iMoneyToGive min(16000 iPlayerMoneyget_pcvar_num(amx_money_num))
        
cs_set_user_money(id,  cs_get_user_money(id) + iMoneyToGive)
        
client_print(idprint_chat"%L"LANG_PLAYER"MONEY"iMoneyToGive)  
    }

Debesėlis is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-15-2009 , 08:50   Re: Money
Reply With Quote #6

Edited and should be fixed.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 04-15-2009 , 09:07   Re: Money
Reply With Quote #7

Quote:
Originally Posted by ConnorMcLeod View Post
Edited and should be fixed.
How do I get text that says money has been given to you or, if you've got 16,000, that your account is full.

PHP Code:
        new MaxMoney 16000;
        new 
BonusMoney get_cvar_num("amx_money_num");
        new 
TotalMoney cs_get_user_money(id) + BonusMoney;

        if (
TotalMoney >= MaxMoney)
                
cs_set_user_money(idMaxMoney);
        else
                
cs_set_user_money(idTotalMoney);
            
client_print(idprint_chat"%L"LANG_PLAYER"MONEY"get_cvar_num("amx_money_num"));
        
        if(
MaxMoney)
        {
            
client_print(idprint_chat"%L"LANG_PLAYER"MONEY_MAX"get_cvar_num("amx_money_num"));
        } 

Last edited by Debesėlis; 04-15-2009 at 11:05.
Debesėlis is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 04-15-2009 , 12:02   Re: Money
Reply With Quote #8

As per the Global Forum Rules, you need to have a descriptive topic title. If you wish for this topic to stay open, please correct the topic title before you post again.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 04-15-2009 , 12:35   Re: Help with money code
Reply With Quote #9

now better?
Debesėlis is offline
Reply


Thread Tools
Display Modes

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 02:21.


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