IsPlayerConnected usefull? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: IsPlayerConnected usefull? (
/showthread.php?tid=261606)
IsPlayerConnected usefull? -
rt-2 - 14.06.2011
Hi,
I have some difficulty understanding the importance of IsPlayerConnected(playerid) in a code where playerid is the id of a player wich just interacted with something....
Thank you,
Re: IsPlayerConnected usefull? -
Danny - 14.06.2011
Quote:
Originally Posted by blinkpnk
Hi,
I have some difficulty understanding the importance of IsPlayerConnected(playerid) in a code where playerid is the id of a player wich just interacted with something....
Thank you,
|
If you use it on that way, it can be pretty useless yeah. But it's important in loops and multi parameter commands.
Re: IsPlayerConnected usefull? -
rt-2 - 14.06.2011
multiparameters commands?
Re: IsPlayerConnected usefull? -
Cyanide - 14.06.2011
IsPlayerConnected is useful for certain situations. It's not necessary in a script a script however because this:
pawn Код:
if( !IsPlayerConnected( playerid ) )
is basically the same as:
pawn Код:
if( playerid == INVALID_PLAYER_ID )
A example situation involving when checking a player is connected method is the code below (I just wrote it up for this post, this code is not tested)
pawn Код:
CMD:slap( playerid, params[ ] )
{
static
s_int
;
if( sscanf( params, "r", s_int ) )
return false;
if( s_int == INVALID_PLAYER_ID )
return false;
static
Float:s_pos[3]
;
GetPlayerPos( s_int, s_pos[0], s_pos[1], s_pos[2] );
SetPlayerPos( s_int, s_pos[0], s_pos[1], s_pos[2] + 10 );
return true;
}
Re: IsPlayerConnected usefull? -
rt-2 - 14.06.2011
OK,
Thanks for your answer