CMD:makeadmin(playerid, params[])
{
new pID, value;
if(!(PlayerInfo[playerid][pAdmin] >= 1338)) return SendClientMessage(playerid, 0xFF0000AA, " you are not authorized to use this command!");
else if (sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /makeadmin [playerid/partofname] [level 1-1338]");
else if (value < 1 || value > 1338) return SendClientMessage(playerid, 0xFF0000AA, "Unknown level! Only 1 to 1338");
else if(pID == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY,"Invalid player id");
else
{
new pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(pID, tName, MAX_PLAYER_NAME);
format(string, sizeof(string), "You have promoted %s to Admin level %i", tName, value);
SCM(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have been promoted to Admin level %i by %s", value, pName);
SCM(pID, COLOR_LIGHTBLUE, string);
PlayerInfo[pID][pAdmin] = value;
}
return 1;
}
CMD:makeadmin(playerid, params[])
{
new pName[64], file[128], string[128], level, id;
GetPlayerName(id,(pName),sizeof(pName));
format(file,sizeof(file), USER_FILE, pName);
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0x0,"Only admins can use this command");
if(sscanf(params, "i", level)) return SendClientMessage(playerid,0x0,"USAGE: /makeadmin [level]");
if(level < 0 || level > 1338) return SendClientMessage(playerid,0x0,"Max Admin Level is 1338!");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0x0,"Player not found");
else
{
pInfo[id][pAdmin] = level;
dini_IntSet(file,"pAdmin",level);
format(string,sizeof(string),"You have just set %s Admin Level to %i", pName, level);
SendClientMessage(playerid,0x0,string);
}
return true;
}
pawn Code:
![]() |
pawn Code:
![]() |
Why did you Strip it ?, Funny, People stripping codes from GF Edits, and paste it to help others.
|
strip?
I use that command for my script, which i made from scratch, and not the server in my sig. ![]() Think before you speak. |
CMD:makeadmin(playerid, params[])
{
new pID, value;
if(PlayerInfo[playerid][pAdmin] < 1338) return SendClientMessage(playerid, 0xFF0000AA, " you are not authorized to use this command!");
if(sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /makeadmin [playerid/partofname] [level 1-1338]");
if(value < 1 || value > 1338) return SendClientMessage(playerid, 0xFF0000AA, "Unknown level! Only 1 to 1338");
if(pID == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY,"Invalid player id");
new pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(pID, tName, MAX_PLAYER_NAME);
format(string, sizeof(string), "You have promoted %s to Admin level %i", tName, value);
SCM(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have been promoted to Admin level %i by %s", value, pName);
SCM(pID, COLOR_LIGHTBLUE, string);
PlayerInfo[pID][pAdmin] = value;
return 1;
}
CMD:makeadmin(playerid, params[])
{
new pID, value;
if(!(PlayerInfo[playerid][pAdmin] >= 1338)) return SendClientMessage(playerid, 0xFF0000AA, " you are not authorized to use this command!");
else if (sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /makeadmin [playerid/partofname] [level 1-1338]");
else if (value < 1 || value > 1338) return SendClientMessage(playerid, 0xFF0000AA, "Unknown level! Only 1 to 1338");
else if(IsPlayerConnected(pID)) {
if(pID == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY,"Invalid player id");
}
else
{
new pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(pID, tName, MAX_PLAYER_NAME);
format(string, sizeof(string), "You have promoted %s to Admin level %i", tName, value);
SCM(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have been promoted to Admin level %i by %s", value, pName);
SCM(pID, COLOR_LIGHTBLUE, string);
PlayerInfo[pID][pAdmin] = value;
}
return 1;
}
You have promoted to Admin level 2 SERVER: Unknown Command
sscanf(params,"ii", pID, value)
if(sscanf(params, "ui", pID, Value))
Ye mate, but it's not working getting Player Not Connected
|
CMD:makeadmin(playerid, params[])
{
new pID, value;
if(!(PlayerInfo[playerid][pAdmin] >= 1338)) return SendClientMessage(playerid, 0xFF0000AA, " you are not authorized to use this command!");
else if (sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /makeadmin [playerid/partofname] [level 1-1338]");
else if (value < 1 || value > 1338) return SendClientMessage(playerid, 0xFF0000AA, "Unknown level! Only 1 to 1338");
else if(pID == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY,"Invalid player id");
else
{
new pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(pID, tName, MAX_PLAYER_NAME);
format(string, sizeof(string), "You have promoted %s to Admin level %i", tName, value);
SCM(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have been promoted to Admin level %i by %s", value, pName);
SCM(pID, COLOR_LIGHTBLUE, string);
PlayerInfo[pID][pAdmin] = value;
}
return 1;
}
sscanf(params,"ui", example1, example2)
new
value,
pID;
if(sscanf(params, "ui", pID, value)) {
CMD:makeadmin(playerid, params[])
{
new
pID,
value;
if(!(PlayerInfo[playerid][pAdmin] >= 1338)) return SendClientMessage(playerid, 0xFF0000AA, " you are not authorized to use this command!");
else if (sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /makeadmin [playerid/partofname] [level 1-1338]");
else if (value < 1 || value > 1338) return SendClientMessage(playerid, 0xFF0000AA, "Unknown level! Only 1 to 1338");
if(IsPlayerConnected(pID)) {
if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY,"Invalid player id");
{
new pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(pID, tName, MAX_PLAYER_NAME);
format(string, sizeof(string), "You have promoted %s to Admin level %i", tName, value);
SCM(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have been promoted to Admin level %i by %s", value, pName);
SCM(pID, COLOR_LIGHTBLUE, string);
PlayerInfo[pID][pAdmin] = value;
}
return 1;
}