GetAdminRankName(playerid) switch(PlayerInfo[id][pAdmin]) { case 0: { return "Moderator" } case 1: { return "Game Administrator" } case 2: { return "Lead Administrator" } case 3: { return "Server Manager" } return 1; } CMD:makeadmin(playerid, params[]) { new id, AdminLevel; if(PlayerInfo[targetid][pAdmin] >= 3 || IsPlayerAdmin(playerid)) { if(sscanf(params, "ui", id, AdminLevel)) return SendClientMessage(playerid, -1, "USAGE: /makeadmin [ID] [LEVEL 1-4]"); if(AdminLevel < 1 || AdminLevel > 4) return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid Admin level"); if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected!"); SendClientMessageEx(playerid, COLOR_LAWNGREEN, "You've just been made: %s admin level: %i", ReturnName(id), GetAdminRankName); SendClientMessageEx(targetid, COLOR_LAWNGREEN, "You've just been made admin level: %i by %s", GetAdminRankName, ReturnName(id)); PlayerInfo[id][pAdmin] = AdminLevel; } else return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not an Admin!"); return 1; }
GetAdminRankName(playerid)
{
switch(PlayerInfo[id][pAdmin])
{
case 0:
{
return "Moderator"
}
case 1:
{
return "Game Administrator"
}
case 2:
{
return "Lead Administrator"
}
case 3:
{
return "Server Manager"
}
}
return 1;
}
CMD:makeadmin(playerid, params[])
{
new id, AdminLevel;
if(PlayerInfo[targetid][pAdmin] >= 3 || IsPlayerAdmin(playerid))
{
if(sscanf(params, "ui", id, AdminLevel))
return SendClientMessage(playerid, -1, "USAGE: /makeadmin [ID] [LEVEL 1-4]");
if(AdminLevel < 1 || AdminLevel > 4)
return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid Admin level");
if(!IsPlayerConnected(id))
return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected!");
SendClientMessageEx(playerid, COLOR_LAWNGREEN, "You've just been made: %s admin level: %i", ReturnName(id), GetAdminRankName);
SendClientMessageEx(targetid, COLOR_LAWNGREEN, "You've just been made admin level: %i by %s", GetAdminRankName, ReturnName(id));
PlayerInfo[id][pAdmin] = AdminLevel;
}
else return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not an Admin!");
return 1;
}
ReturnAdminLevel(playerid)
{
new
string[64]
;
switch (PlayerInfo[playerid][pAdmin])
{
case 1: string= "Moderator";
case 2: string= "Game Administrator";
case 3: string= "Lead Administrator";
case 4: string= "Server Manager";
default: string= "Undefined";
}
return string;
}
SendClientMessageEx(playerid, COLOR_LAWNGREEN, "%s has just promoted you to %s",ReturnName(playerid), ReturnAdminLevel(id));
PHP код:
PHP код:
|
PlayerInfo[id][pAdmin] = AdminLevel;
GetAdminRankName(playerid)
{
new string[24];
switch(PlayerInfo[playerid][pAdmin])
{
case 0:
{
string = "Moderator"
}
case 1:
{
string = "Game Administrator"
}
case 2:
{
string = "Lead Administrator"
}
case 3:
{
string = "Server Manager"
}
}
return string;
}
CMD:makeadmin(playerid, params[])
{
new id, AdminLevel;
if(PlayerInfo[targetid][pAdmin] >= 3 || IsPlayerAdmin(playerid))
{
if(sscanf(params, "ui", id, AdminLevel))
return SendClientMessage(playerid, -1, "USAGE: /makeadmin [ID] [LEVEL 1-4]");
if(AdminLevel < 1 || AdminLevel > 4)
return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid Admin level");
if(!IsPlayerConnected(id))
return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected!");
PlayerInfo[id][pAdmin] = AdminLevel;
SendClientMessageEx(playerid, COLOR_LAWNGREEN, "You've just been made: %s admin level: %i", ReturnName(id), GetAdminRankName(id));
SendClientMessageEx(targetid, COLOR_LAWNGREEN, "You've just been made admin level: %i by %s", GetAdminRankName(id), ReturnName(id));
}
else return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not an Admin!");
return 1;
}
This will also work
pawn Код:
|
SendClientMessageEx(playerid, COLOR_LAWNGREEN, "You've just made: %s admin level: %s",ReturnName(id), GetAdminRankName(id));
SendClientMessageEx(targetid, COLOR_LAWNGREEN, "You've just been made admin level: %s by %s", GetAdminRankName(id), ReturnName(playerid));
This code will not show the admin level name. You're formatting an integer there...
Then the admin who's going to promote someone is the playerid, why do you returnname of the targetid? Makes no sense. PHP код:
|
CMD:makeadmin(playerid, params[])
{
new id, AdminLevel;
if(PlayerInfo[playerid][pAdmin] >= 3 || IsPlayerAdmin(playerid))
{
if(sscanf(params, "ui", id, AdminLevel))
return SendClientMessage(playerid, -1, "USAGE: /makeadmin [ID] [LEVEL 1-4]");
if(AdminLevel < 1 || AdminLevel > 4)
return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid Admin level");
if(!IsPlayerConnected(id))
return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected!");
PlayerInfo[id][pAdmin] = AdminLevel;
SendClientMessageEx(playerid, COLOR_LAWNGREEN, "You've just been made: %s admin level: %i", ReturnName(id), AdminLevel);
SendClientMessageEx(id, COLOR_LAWNGREEN, "You've just been made admin level: %i(%s) by %s", AdminLevel, GetAdminRankName(id), ReturnName(playerid));
}
else return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not an Admin!");
return 1;
}
LOL are you kidding me?
EDIT: Basically his /makeadmin code is wrong, this is how it should work pawn Код:
|
SendClientMessageEx(playerid, COLOR_LAWNGREEN, "You've just been made: %s admin level: %i", ReturnName(id), GetAdminRankName(id));
SendClientMessageEx(id, COLOR_LAWNGREEN, "You've just been made admin level: %i by %s", GetAdminRankName(id), ReturnName(id));