INVALID_PLAYER_ID and function IsPlayerConnected(playerid)
#1

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
Reply
#2

I usually do something like this.
pawn Код:
if(!IsPlayerConnected(killerid))
! = Not.
Reply
#3

Doesn't really matter which one you use.
Reply
#4

INVALID_KILLER_ID is better. IsPlayerConnected has to call the function, but the variable is already there for you to check.
Reply
#5

Quote:
Originally Posted by rangerxxll
Посмотреть сообщение
I usually do something like this.
pawn Код:
if(!IsPlayerConnected(killerid))
! = Not.
I knew casually written, now corrected
Reply
#6

For some reasons better is IsPlayerConnected (troll program for samp ;d) but you can use this

pawn Код:
if(0 <= killerid < MAX_PLAYERS)
Reply
#7

thats the stopidest think ive ever herd
Reply
#8

OH YEAhh
Reply
#9

Theres pretty much no difference between these two functions both means the same.
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: