14.08.2013, 19:48
Hello SAMP
I have a problem with my /makeadmin command...Here is my command:
Example:
If a player is an admin level 3 and if an admin has changed his level to 4, then it will say that he was promoted..
And, If a player is an admin level 3 and if an admin has changed his level to 2, then it will say that he was demoted..
But the message don't work..Help me pls
I have a problem with my /makeadmin command...Here is my command:
pawn Код:
CMD:makeadmin(playerid, params[])
{
new level, targetid, string[200], str[200];
if(pInfo[playerid][Adminlevel] < 5)return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You aren't an Administrator level 5!");
if(!IsPlayerConnected(targetid))return SendClientMessage(playerid, COLOR_RED, "[ERROR]: This player is not Connected!");
if(sscanf(params, "ui", targetid, level))return SendClientMessage(playerid, COLOR_WHITE, "[USAGE]: /makeadmin [Playerid] [Level]");
if(level < 0 || level > 5)return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid Admin Level (0-5)!");
pInfo[targetid][Adminlevel] = level;
if(pInfo[targetid][Adminlevel] < level)
{
format(string, sizeof(string), "[ADMIN]: Administrator %s(ID:%d) has promoted %s(ID:%d) to Admin level %d!", GetName(playerid), playerid, GetName(targetid), targetid, level);
SendClientMessageToAll(COLOR_GREEN, string);
}
if(pInfo[targetid][Adminlevel] > level)
{
format(str, sizeof(str), "[ADMIN]: Administrator %s(ID:%d) has demoted %s(ID:%d) to Admin level %d!", GetName(playerid), playerid, GetName(targetid), targetid, level);
SendClientMessageToAll(COLOR_GREEN, str);
}
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file, "Player's Data");
INI_WriteInt(file, "AdminLevel", pInfo[targetid][Adminlevel]);
return 1;
}
If a player is an admin level 3 and if an admin has changed his level to 4, then it will say that he was promoted..
And, If a player is an admin level 3 and if an admin has changed his level to 2, then it will say that he was demoted..
But the message don't work..Help me pls