Posts: 117
Threads: 30
Joined: Jul 2012
13.03.2013, 18:44
(
Последний раз редактировалось Manowar; 13.03.2013 в 20:59.
)
As the difference between INVALID_PLAYER_ID and function IsPlayerConnected(playerid) ?
How best to record
PHP код:
If(!IsPlayerConnected(killerid))
or
PHP код:
If(killerid != INVALID_PLAYER_ID)
Posts: 460
Threads: 42
Joined: Nov 2009
Reputation:
0
Doesn't really matter which one you use.
Posts: 6,236
Threads: 310
Joined: Jan 2011
Reputation:
0
INVALID_KILLER_ID is better. IsPlayerConnected has to call the function, but the variable is already there for you to check.
Posts: 117
Threads: 30
Joined: Jul 2012
Quote:
Originally Posted by rangerxxll
I usually do something like this.
pawn Код:
if(!IsPlayerConnected(killerid))
! = Not.
|
I knew casually written, now corrected
Posts: 2,593
Threads: 34
Joined: Dec 2007
For some reasons better is IsPlayerConnected (troll program for samp ;d) but you can use this
pawn Код:
if(0 <= killerid < MAX_PLAYERS)
Posts: 6,236
Threads: 310
Joined: Jan 2011
Reputation:
0
thats the stopidest think ive ever herd
Posts: 1,794
Threads: 104
Joined: Feb 2012
Reputation:
0
Theres pretty much no difference between these two functions both means the same.
Posts: 734
Threads: 8
Joined: Jun 2009
Some people here really have no idea what they're saying...
As already mentioned, one is a function and the other is a constant expression.
Calling functions takes time to retrieve the result, but checking variables
is much much faster because you know in front exactly what to check for.