18.07.2014, 16:48
So once again, scripting noob here needing help..
So i made a /makeadmin , /a and now here's the issue:
/makeadmin sets their adminlevel to a random number, not the one typed up (i.e, 0 makes the number 48 )
/a Is just a random . now even though it's all normal.. (i.e, [timestamp].: )
Make Admin:
Admin Chat:
Also the "GetAdminName" stock:
So i made a /makeadmin , /a and now here's the issue:
/makeadmin sets their adminlevel to a random number, not the one typed up (i.e, 0 makes the number 48 )
/a Is just a random . now even though it's all normal.. (i.e, [timestamp].: )
Make Admin:
Код:
CMD:makeadmin(playerid, params[])
{
new PID, str[128], param, PName[MAX_PLAYER_NAME], AName[MAX_PLAYER_NAME];
if(PlayerInfo[playerid][pAdminLevel] < 5) return SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use that command");
if(sscanf(params, "us[64]", PID, param)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /makeadmin [playerid] [Admin Level]");
GetPlayerName(playerid, AName, sizeof(AName));
GetPlayerName(PID, PName, sizeof(PName));
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected!");
format(str, sizeof(str), "%s Has set %s admin level to %s ", AName, PName, param);
PlayerInfo[PID][pAdminLevel] = param;
foreach(Player, i)
{
if(PlayerInfo[i][pAdminLevel] > 0) return SendClientMessage(i,COLOR_YELLOW,str);
}
return 1;
}
Код:
CMD:a(playerid, params[])
{
if(PlayerInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use this command");
new
str[144], text[128];
if(sscanf(params, "s[128]",text)) return SendClientMessage(playerid, -1, "USAGE: /a [Text]");
if(PlayerInfo[playerid][pAdminLevel] > 0) format(str, sizeof(str), "[OOC] %s %s: %s", GetAdminName(playerid), GetName(playerid), text);
foreach(Player, i) {
if(PlayerInfo[i][pAdminLevel] > 0){
SendClientMessage(i,COLOR_YELLOW,text);}}
return 1;
}
Код:
stock GetAdminName(playerid)
{
new name[25];
if(PlayerInfo[playerid][pAdminLevel] == 1) format(name, sizeof(name), "Trial Admin");
if(PlayerInfo[playerid][pAdminLevel] == 2) format(name, sizeof(name), "Junior Admin");
if(PlayerInfo[playerid][pAdminLevel] == 3) format(name, sizeof(name), "General Admin");
if(PlayerInfo[playerid][pAdminLevel] == 4) format(name, sizeof(name), "Senior Admin");
if(PlayerInfo[playerid][pAdminLevel] == 5) format(name, sizeof(name), "Head Admin");
if(PlayerInfo[playerid][pAdminLevel] == 100) format(name, sizeof(name), "Co-Community Director");
if(PlayerInfo[playerid][pAdminLevel] == 102) format(name, sizeof(name), "Community Director");
return name;
}


