14.06.2014, 05:38
Why When I Type /makeadmin It Normally Sets The Player That Has Typed It To Level 0,Without Typing /makeadmin [playerid] [1 - 10] only /makeadmin in these codes:
PHP код:
COMMAND:makeadmin(playerid, params[])
{
new giveplayerid, level, Message4[128], PNAME[MAX_PLAYER_NAME], PNAME2[MAX_PLAYER_NAME];
if(sscanf(params, "ud", giveplayerid, level))
{
SendClientMessage(playerid, -1, "USAGE: /makeadmin <playerid> <Admin level 1 - 10>");
SendClientMessage(playerid, 0x008CFFFF, "NOTE: Admin Level 1 = Trial Moderator, Admin Level 2 = Moderator, Admin Level 3 = Master Moderator");
SendClientMessage(playerid, 0x008CFFFF, "NOTE: Admin Level 4 = Trial Adminstrator, Admin Level 5 = Adminstrator, Admin Level 6 = Master Adminstrator");
SendClientMessage(playerid, 0x008CFFFF, "NOTE: Admin Level 7 = Head Adminstrator, Admin Level 8 = Trusted Adminstrator, Admin Level 9 = Co-Owner, Admin Level 10 = Owner");
}
if(PlayerInfo[playerid][pAdmin] < 10) return SendClientMessage(playerid, 0xFF0000FF, "You Are Not The Owner!");
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, 0xFF0000FF, "Player Is Not Connected!");
if(level > 10 || level < 0) return SendClientMessage(playerid, 0xFF0000FF, "Admin Levels Cannot Be More Than 10 Or Less Than 1!");
GetPlayerName(giveplayerid, PNAME, MAX_PLAYER_NAME);
GetPlayerName(playerid, PNAME2, MAX_PLAYER_NAME);
if(PlayerInfo[giveplayerid][pAdmin] > 0)
{
switch(PlayerInfo[giveplayerid][pAdmin])
{
case 1: AdmRank = "Trial Moderator";
case 2: AdmRank = "Moderator";
case 3: AdmRank = "Master Moderator";
case 4: AdmRank = "Trial Administrator";
case 5: AdmRank = "Administrator";
case 6: AdmRank = "Master Adminstrator";
case 7: AdmRank = "Head Adminstrator";
case 8: AdmRank = "Trusted Adminstrator";
case 9: AdmRank = "Co-Owner";
case 10: AdmRank = "Owner";
}
if(PlayerInfo[giveplayerid][pAdmin] < level)
{
format(Message4, sizeof(Message4), "You Have Been Promoted To Level {00FFFB}%d - %s{FF5900}.", PlayerInfo[playerid][pAdmin], AdmRank), SendClientMessage(giveplayerid, 0xFF5900FF, Message4);
format(Message4, sizeof(Message4), "%s (%d) Has Been Promoted To Level {00FFFB}%d - %s{00FFFF}.", PNAME ,PlayerInfo[playerid][pAdmin], AdmRank), SendClientMessageToAll(0x00FFFFFF, Message4);
PlayerInfo[giveplayerid][pAdmin] = level;
GameTextForPlayer(giveplayerid, "~g~Promoted", 5000, 4);
foreach(Player, i)
{
if(PlayerInfo[i][pAdmin] > 0)
{
format(Message4, sizeof(Message4), "The Owner %s (%d) Has Made %s (%d) An Admin Level {00FFFB}%d - %s{FF5900}.",PNAME2, playerid, PNAME, giveplayerid, PlayerInfo[playerid][pAdmin], AdmRank), SendClientMessage(i, 0xFF5900FF, Message4);
}
}
}
else if(PlayerInfo[giveplayerid][pAdmin] > level)
{
format(Message4, sizeof(Message4), "You Have Been Demoted To Level {00FFFB}%d - %s{FF5900}.", PlayerInfo[playerid][pAdmin], AdmRank), SendClientMessage(giveplayerid, 0xFF5900FF, Message4);
format(Message4, sizeof(Message4), "%s (%d) Has Been Demoted To Level {00FFFB}%d - %s{00FFFF}.", PNAME ,PlayerInfo[playerid][pAdmin], AdmRank), SendClientMessageToAll(0x00FFFFFF, Message4);
PlayerInfo[giveplayerid][pAdmin] = level;
GameTextForPlayer(giveplayerid, "~r~Demoted", 5000, 4);
foreach(Player, i)
{
if(PlayerInfo[i][pAdmin] > 0)
{
format(Message4, sizeof(Message4), "The Owner %s (%d) Has Made %s (%d) An Admin Level {00FFFB}%d - %s{FF5900}.",PNAME2, playerid, PNAME, giveplayerid, PlayerInfo[playerid][pAdmin], AdmRank), SendClientMessage(i, 0xFF5900FF, Message4);
}
}
}
}
return 1;
}