AlliedModders

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

tomy91 01-10-2007 11:50

cs_set_user_money
 
Hello, i need a little help with cs_set_user_money! I took the swear_filter plugin and tried to add myself a part that, if user says badword, it removes 500 $ from user's money! I tried to add like this: cs_set_user_money(id, -500) it works, but it doesn't remove 500 $ but sets user money -500$... If user had 5050 $, and he types a badword, his money sets to -500$! I need a help, how is the correct script when it removs that 500$ not sets the amount!

Thanks and sorry for incorrect engllish!

P34nut 01-10-2007 11:52

Re: cs_set_user_money
 
cs_set_user_money(id, get_user_money(id) - 500))

MaximusBrood 01-10-2007 12:24

Re: cs_set_user_money
 
Quote:

Originally Posted by P34nut (Post 425621)
cs_set_user_money(id, get_user_money(id) - 500))

The correct usage is:

cs_set_user_money(id, (cs_get_user_money(id) - 500));

tomy91 01-10-2007 12:51

Re: cs_set_user_money
 
Works, but: if money is 800, when i type badfwors, it removes 500, but after that on my screen it shows 1300 but the money isnt so much, so i can't buy anything! I wanted to say that it removes the money, but i don't know why it count together my money + 500$! How to get that it shows money correctly, too?

[ --<-@ ] Black Rose 01-10-2007 16:50

Re: cs_set_user_money
 
Quote:

Originally Posted by MaximusBrood (Post 425631)
The correct usage is:

Code:
new setmoney = cs_get_user_money(id) - 500 cs_set_user_money(id, clamp(setmoney, 800, 16000))


All times are GMT -4. The time now is 22:29.

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