Raised This Month: $ Target: $400
 0% 

Little Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EpicFail.
Senior Member
Join Date: May 2010
Old 08-23-2010 , 17:26   Little Help
Reply With Quote #1

Hm.. How can i do in shop
if player dont have money for buy the item
this write in chat
"You Need More "XXX$" To Buy This." ??

some can give me the code i try do
PHP Code:
ChatColorid"%s You Need More !g%d$ !yTo Buy This."CLAN_TAG,  cs_get_user_moneyid ) ); 
but this show me in "%d" the money i have ... and no the how much more money i need to buy the item

Sorry for bad English ..

Thanks for Helpers ..
EpicFail. is offline
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 08-23-2010 , 19:47   Re: Little Help
Reply With Quote #2

Well yea.. cs_get_user_money gets the current amount of money and the you want the amount of money that you need.So the amount that you dont have and you need is :
the money for the item minus the money that you have.
SpeeDeeR is offline
EpicFail.
Senior Member
Join Date: May 2010
Old 08-23-2010 , 19:50   Re: Little Help
Reply With Quote #3

can you make one code for me

i want to see how do this ...
EpicFail. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-23-2010 , 20:01   Re: Little Help
Reply With Quote #4

Quote:
Originally Posted by EpicFail. View Post
can you make one code for me

i want to see how do this ...
It's a simple subtraction problem. 5 - 2 = 3
__________________
fysiks is offline
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 08-24-2010 , 05:53   Re: Little Help
Reply With Quote #5

Since its in Scripting Help I dont have to show you code and you know how to script.
SpeeDeeR is offline
fireattack
Senior Member
Join Date: Jul 2008
Old 08-24-2010 , 09:16   Re: Little Help
Reply With Quote #6

omg, people, don't be hard..

here you go.

PHP Code:
 
 
if (cs_get_user_money(id) < 10000
I think "Epic Fail" you will understand this, if not, you have a problem with scripting, however if you are a begginer i can do a example plugin for you.

PHP Code:
// LOOK AT THE "<" ">" "="
 
if (cs_get_user_money(id) < 10000){
 
client_print(idprint_center"Sorry but you're poor")
 return 
PLUGIN_HANDLED;
}
 if (
cs_get_user_money(id) >= 10000 ){
client_print(idprint_center"yeayeayea, you bought this")
 if(
is_user_connected(id))
 {
 
// Here you have to do something
 
 
}
 
cs_set_user_money(id cs_get_user_money(id) - 100000)
 } 

Last edited by fireattack; 08-24-2010 at 09:19.
fireattack is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-24-2010 , 09:25   Re: Little Help
Reply With Quote #7

Quote:
Originally Posted by fireattack View Post
omg, people, don't be hard..

here you go.

I think "Epic Fail" you will understand this, if not, you have a problem with scripting, however if you are a begginer i can do a example plugin for you.
PHP Code:
 if (cs_get_user_money(id) < 10000){
 
client_print(idprint_center"Sorry but you're poor")
 return 
PLUGIN_HANDLED;
}
 if (
cs_get_user_money(id) >= 10000 ){
client_print(idprint_center"yeayeayea, you bought this")
 if(
is_user_connected(id))
 {
 
// Here you have to do something
 
 

More efficient to use else rather then call another native. Also, it would be better to store the cs_get_user_money() value in a variable so it can be used again to set the users money at cs_set_user_money(id , cs_get_user_money(id) - 10000, 0).
PHP Code:
    if (cs_get_user_money(id) < 10000)
    {

    }
    else
    {

    { 
__________________
Bugsy is offline
fireattack
Senior Member
Join Date: Jul 2008
Old 08-24-2010 , 09:31   Re: Little Help
Reply With Quote #8

I know, but it's harder to understand for a begginer.
fireattack is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-24-2010 , 09:49   Re: Little Help
Reply With Quote #9

Hardly, plus its better to teach using proper methods.
__________________
Bugsy is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-24-2010 , 17:55   Re: Little Help
Reply With Quote #10

Quote:
Originally Posted by fireattack View Post
omg, people, don't be hard..

here you go.

PHP Code:
 
 
if (cs_get_user_money(id) < 10000
I think "Epic Fail" you will understand this, if not, you have a problem with scripting, however if you are a begginer i can do a example plugin for you.

PHP Code:
// LOOK AT THE "<" ">" "="
 
if (cs_get_user_money(id) < 10000){
 
client_print(idprint_center"Sorry but you're poor")
 return 
PLUGIN_HANDLED;
}
 if (
cs_get_user_money(id) >= 10000 ){
client_print(idprint_center"yeayeayea, you bought this")
 if(
is_user_connected(id))
 {
 
// Here you have to do something
 
 
}
 
cs_set_user_money(id cs_get_user_money(id) - 100000)
 } 
Sadly, that doesn't answer his question.

All he needs is this: CostToBuy - UserMoney (This is how much more money is needed to buy the item, which is what he asked for).
__________________
fysiks 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 21:54.


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