AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   I need some clarification.. (https://forums.alliedmods.net/showthread.php?t=294809)

Visinescu 03-08-2017 09:19

I need some clarification..
 
Does set_user_frags 100 always set 100 or adds on top of what the frags are at the moment?

killerZM 03-08-2017 09:29

Re: I need some clarification..
 
sets

edon1337 03-08-2017 10:48

Re: I need some clarification..
 
Quote:

Originally Posted by Visinescu (Post 2501796)
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.

PRoSToTeM@ 03-13-2017 06:47

Re: I need some clarification..
 
@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?).

edon1337 03-13-2017 08:19

Re: I need some clarification..
 
Quote:

Originally Posted by PRoSToTeM@ (Post 2503299)
@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 :)


All times are GMT -4. The time now is 18:02.

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