14.12.2010, 23:55
Hello, i have attempted to make a /makeadmin command, however when i try to use it, no matter what id i use, it always gives me a message saying i have promoted myself to level 0 and takes my admin privelages away. I am not sure what is causing the problem.
Here is the command script.
dcmd_makeadmin(playerid, params[])
{
if(Player[playerid][level] == 4 || IsPlayerAdmin(playerid)) {}
new pID,alevel;
if(Player[playerid][level] < 4){
return SendClientMessage(playerid, COLOR_RED, "You must be admin level 4 to do this!");
}
else if(!strlen(params)){
return SendClientMessage (playerid,COLOR_RED,"USAGE: /makeadmin [playerid] [adminlevel]");
}
else if(!IsPlayerConnected(pID)){
return SendClientMessage (playerid,COLOR_RED,"Nobody is connected with this ID!");
}
else
{
new string[128],string2[128],aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
Player[pID][level] = alevel;
GetPlayerName(playerid,aname,sizeof(aname));
GetPlayerName(pID,name,sizeof(name));
format(string,sizeof(string),"You have set the admin level of %s to %d",name,alevel);
format(string2,sizeof(string2),"ServerOwner %s has set your admin level to %d",aname,alevel);
SendClientMessage(playerid,COLOR_GREEN,string);
SendClientMessage(pID,COLOR_GREEN,string2);
return 1;
}
}
Here is the command script.
dcmd_makeadmin(playerid, params[])
{
if(Player[playerid][level] == 4 || IsPlayerAdmin(playerid)) {}
new pID,alevel;
if(Player[playerid][level] < 4){
return SendClientMessage(playerid, COLOR_RED, "You must be admin level 4 to do this!");
}
else if(!strlen(params)){
return SendClientMessage (playerid,COLOR_RED,"USAGE: /makeadmin [playerid] [adminlevel]");
}
else if(!IsPlayerConnected(pID)){
return SendClientMessage (playerid,COLOR_RED,"Nobody is connected with this ID!");
}
else
{
new string[128],string2[128],aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
Player[pID][level] = alevel;
GetPlayerName(playerid,aname,sizeof(aname));
GetPlayerName(pID,name,sizeof(name));
format(string,sizeof(string),"You have set the admin level of %s to %d",name,alevel);
format(string2,sizeof(string2),"ServerOwner %s has set your admin level to %d",aname,alevel);
SendClientMessage(playerid,COLOR_GREEN,string);
SendClientMessage(pID,COLOR_GREEN,string2);
return 1;
}
}