07.04.2016, 12:37
So i made a /makeadmin command, whenever i execute the command on a non-admin player it just sends me "USAGE: /makeadmin (playerID) (Level)"
I know that there will be a mistake before i scripted this because i don't know how to make a command that is more advance than i usually do.
Ignore the loose indentation.
I know that there will be a mistake before i scripted this because i don't know how to make a command that is more advance than i usually do.
Ignore the loose indentation.
PHP код:
CMD:makeadmin(playerid, params[])
{
new targetid, AdminLevel, tname[MAX_PLAYER_NAME], pname[MAX_PLAYER_NAME], str[128];
if(pInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, GREY, "You are not authorized to use that command.");
if(sscanf(params,"ui", targetid)) return SendClientMessage(playerid, GREY, "USAGE: /makeadmin (playerID) (Level)");
if(AdminLevel > 10) return SendClientMessage(playerid, GREY, "LEVELS AVAILABLE 1-10!");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, GREY, "ERROR: Player is not connected!");
GetPlayerName(playerid, tname, sizeof(tname));
GetPlayerName(targetid, pname, sizeof(pname));
if(AdminLevel == 0)
{
format(str, sizeof(str),"Administrator %s has set your admin level to %d, Congratulations!!", tname, AdminLevel);
SendClientMessage(targetid, RED, str);
format(str, sizeof(str),"You have set %s's Admin level to %d", pname, AdminLevel);
SendClientMessage(playerid, RED, str);
pInfo[targetid][pAdmin] = AdminLevel;
}
return 1;
}