Checking is player online.
#1

Im having a problem with checking is player online. So, I have an optional parameter (R). If player didnt used the param, the value will be -1. So, I want to do this: if player is offline, it would return that player is offline. BUT, if player didnt used the param (R) it would continue the command. Now it always return that player is offline, even I didnt used the param

pawn Код:
new i;
    if (sscanf(params, "R(-1)", i))
    {
        return SendClientMessage(playerid, 0xFF0000FF, "Komandos naudojimas: {FFFF00}/(lok)uoti [vardas]");
    }
    if (i == playerid || i == INVALID_PLAYER_ID && i != -1)
    {
        return SendClientMessage(playerid, 0xFF0000FF, "Ћaidėjas yra neprisijungęs!");
    }
Reply
#2

new Spawned[MAX_PLAYERS];

set on player spawn
Spawned[playerid] =1;

now in command put

if(Spawned[playerid] != 1)
{
SendClientMessage(playerid,COLOR_RED,"You must be alive and spawned in order to be able to use this command.");
return 1;
}
Reply
#3

Why don't you do it with IsPlayerConnected(playerid)?
Reply
#4

DonWade - you dont understand, what do I need actually.
seven_of_nine - using INVALID_PLAYER_ID is faster AFAIK, because its not a function, its a define.. and IsPlayerConnected is a function.

any ideas to the topic?
Reply
#5

pawn Код:
if (i == playerid && i == INVALID_PLAYER_ID && i != -1) // || to &&
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)