IsPlayerConnected - 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 (
/showthread.php?tid=81434)
IsPlayerConnected -
Span1ard - 10.06.2009
How works IsPlayerConnected(playerid)?
I will use if(IPC[playerid]) instead of if(IsPlayerConnected(playerid)) it will be more optimum or is equivalent?
Quote:
new bool:IPC[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
IPC[playerid] = true;
}
public OnPlayerDisconnect(playerid)
{
IPC[playerid] = false;
}
|
Re: IsPlayerConnected -
MrPanz - 10.06.2009
Well, it would be kind of stupid to check if there connected when there connected, even fo' disconnect.. it's betta teh way yo have it no'ws.
Re: IsPlayerConnected -
Span1ard - 10.06.2009
This question concerns code optimisation.
Algorithm IsPlayerConnected(playerid) is unknown to me.
In many timers IsPlayerConnected is used. Can replacement by IPC raise productivity?
Re: IsPlayerConnected -
MrPanz - 10.06.2009
Dont really know what you mean, but IsPlayerConnected is usally used to see if there actually logged in.
Re: IsPlayerConnected -
MenaceX^ - 11.06.2009
Use IsPlayerConnected, it works like it should work.
Re: IsPlayerConnected -
Joe Staff - 11.06.2009
He's asking which is faster, I remember Y_Less saying the definitions came before functions, so perhaps that is quicker, but it's not a huge upgrade. Infact it's near useless
Re: IsPlayerConnected -
Donny_k - 11.06.2009
The IPC array is faster, a variable will always be faster than a function call and you can do it for things like states, name, connection etc getting rid of the need to use the SAMP functions more than once in your script (some never like GetPlayerState).