about IsPlayerConnect VS PlayerArray.
#1

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

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

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

I'm still not satisfied with the two answers.
Can someone give me a detailed answer?
Reply
#5

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

I really want to know did the IsPlayerConnected run
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)