IsPlayerConnected
#1

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;
}

Reply
#2

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

This question concerns code optimisation.
Algorithm IsPlayerConnected(playerid) is unknown to me.
In many timers IsPlayerConnected is used. Can replacement by IPC raise productivity?
Reply
#4

Dont really know what you mean, but IsPlayerConnected is usally used to see if there actually logged in.
Reply
#5

Use IsPlayerConnected, it works like it should work.
Reply
#6

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

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


Forum Jump:


Users browsing this thread: 7 Guest(s)