IsPlayerConnected Issue
#1

Ok, so I made a command /setlevel and it's posted below.

pawn Код:
CMD:setlevel(playerid,params[])
{
    new pID,level,rank[128];
    if(!IsPlayerAdmin(playerid)) return 0;
    if(sscanf(params,"ud",pID,level)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /setlevel [playerid] [level]");
    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,COLOR_GREY,"Player is not connected.");
    if(pInfo[pID][AdminLevel] > pInfo[playerid][AdminLevel]) return SendClientMessage(playerid,COLOR_WHITE,"You can't use this command on your colleauge");
    if(pInfo[pID][AdminLevel] > level)
    {
        if(level == 1) return format(rank,sizeof(rank),"{FF8800}Server Moderator {FFFFFF}");
        if(level == 2) return format(rank,sizeof(rank),"{0000FF}Global Moderator {FFFFFF}");
        if(level == 3) return format(rank,sizeof(rank),"{FF0000}Admin {40FF00}");
        if(level == 4) return format(rank,sizeof(rank),"{40FF00}Super Admin {FFFFFF}");
        if(level == 5) return format(rank,sizeof(rank),"{40FF00}Head Admin {FFFFFF}");
        format(string,sizeof(string),"%s has been demoted to %s by "SERVER_NAME" management.",pID,rank);
        SendClientMessageToAll(COLOR_WHITE,string);
        pInfo[pID][AdminLevel] = level;
    }
    else if(pInfo[playerid][AdminLevel] < level)
    {
        if(level == 1) return format(rank,sizeof(rank),"{FF8800}Server Moderator {FFFFFF}");
        if(level == 2) return format(rank,sizeof(rank),"{0000FF}Global Moderator {FFFFFF}");
        if(level == 3) return format(rank,sizeof(rank),"{FF0000}Admin {40FF00}");
        if(level == 4) return format(rank,sizeof(rank),"{40FF00}Super Admin {FFFFFF}");
        if(level == 5) return format(rank,sizeof(rank),"{40FF00}Head Admin {FFFFFF}");
        format(string,sizeof(string),"%s has been promoted to %s by "SERVER_NAME" management.",pID,rank);
        SendClientMessageToAll(COLOR_WHITE,string);
        pInfo[pID][AdminLevel] = level;
    }
    return 1;
}
Which takes two parameters, playerid and the level.

Whenever I type playerid 0 which is me in the localhost server it always returns "Player is not connected." even thought I am connected. Whenever I try without the IsPlayerConnected check, it returns SERVER: Unknown command. It's so unusual.

Please help me!
Reply


Messages In This Thread
IsPlayerConnected Issue - by Tayab - 28.11.2013, 05:01
Re: IsPlayerConnected Issue - by Lozzy - 28.11.2013, 07:08
Re: IsPlayerConnected Issue - by Konstantinos - 28.11.2013, 10:34
Re: IsPlayerConnected Issue - by Tayab - 28.11.2013, 22:10
Re: IsPlayerConnected Issue - by Jefff - 28.11.2013, 22:32
Re: IsPlayerConnected Issue - by Tayab - 29.11.2013, 06:17

Forum Jump:


Users browsing this thread: 5 Guest(s)