Raised This Month: $ Target: $400
 0% 

I need some clarification..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Visinescu
Senior Member
Join Date: Dec 2015
Location: England now,Home Romania
Old 03-08-2017 , 09:19   I need some clarification..
Reply With Quote #1

Does set_user_frags 100 always set 100 or adds on top of what the frags are at the moment?
Visinescu is offline
killerZM
Senior Member
Join Date: Sep 2016
Old 03-08-2017 , 09:29   Re: I need some clarification..
Reply With Quote #2

sets
killerZM is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 03-08-2017 , 10:48   Re: I need some clarification..
Reply With Quote #3

Quote:
Originally Posted by Visinescu View Post
Does set_user_frags 100 always set 100 or adds on top of what the frags are at the moment?
The name itself tells you what it does.
Simple stock to ADD user frags.

Code:
stock add_user_frags(id, amount) {     if(!is_user_connected(id))     return -1;     set_user_frags(id, get_user_frags(id) + amount) }

Code:
stock add_user_frags(id, amount) @id - Player Index @amount - Amount of frags to add @return - -1 if not player connected.
__________________

Last edited by edon1337; 03-13-2017 at 08:19.
edon1337 is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 03-13-2017 , 06:47   Re: I need some clarification..
Reply With Quote #4

@edon1337 you can't differentiate error from frags in return value if added frags is 0, better to throw an error if player is not connected and not to use return value at all (who will use and check it for an error?).
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 03-13-2017 , 08:19   Re: I need some clarification..
Reply With Quote #5

Quote:
Originally Posted by PRoSToTeM@ View Post
@edon1337 you can't differentiate error from frags in return value if added frags is 0, better to throw an error if player is not connected and not to use return value at all (who will use and check it for an error?).
You're right
__________________
edon1337 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 18:02.


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