about IsPlayerConnect VS PlayerArray. - 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: about IsPlayerConnect VS PlayerArray. (
/showthread.php?tid=260940)
about IsPlayerConnect VS PlayerArray. -
VivianKris - 11.06.2011
if i write a array about logined.
like this
Код:
if(IsPlayerConnect(playerid))
{
pInfo[playerid][pLogined] = 1;
}
and can i remove all the IsPlayerConnect and put pInfo[playerid][pLogined]
Sorry my bad english , and thanks all people who answer.
Re: about IsPlayerConnect VS PlayerArray. -
shitbird - 11.06.2011
You mean replacing the IsPlayerConnected(playerid) check with pInfo[playerid][pLoggedIn] check, yeah you could do that. But it's nowhere near efficient. There's no point in doing it. Just keep using IsPlayerConnected.
AW: about IsPlayerConnect VS PlayerArray. -
Nero_3D - 11.06.2011
array calls are faster than a native function call
But this can only be used if every needs to log in
And than use bool for a flag (false / true)
At least dont forget to set it to false again in OnPlayerDisconnect
Re: about IsPlayerConnect VS PlayerArray. -
VivianKris - 11.06.2011
I'm still not satisfied with the two answers.
Can someone give me a detailed answer?
Re: about IsPlayerConnect VS PlayerArray. -
iggy1 - 11.06.2011
Like nero said getting a value from a variable will always be faster than calling functions. Functions (most of em) do checks then (in this case) return a value. Using a var would cut the checks out, and get the value straight away. Though i dont know how OnPlayerConnect works internally.
Just use what you preffer it wont realy make a difference (just a small one) anyway.
Re: about IsPlayerConnect VS PlayerArray. -
VivianKris - 12.06.2011
I really want to know did the IsPlayerConnected run