28.11.2013, 05:01
Ok, so I made a command /setlevel and it's posted below.
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!
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;
}
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!