04.10.2013, 23:45
Everything works great besides one thing..
When you register a new account you automatically become an admin..
I think it's something with the "type". When I register a new character I became LVL 5 admin but when a friend of mine register he became a LVL 4 admin, weird.
When you register a new account you automatically become an admin..
I think it's something with the "type". When I register a new character I became LVL 5 admin but when a friend of mine register he became a LVL 4 admin, weird.
pawn Код:
COMMAND:makeadmin(playerid, params[])
{
new targetid, type, string[128], sendername[MAX_PLAYER_NAME], staffname[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME];
if(sscanf(params, "ui", targetid, type)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /makeadmin [PlayerID] [level 0-5]");
else
{
if(type < 0 || type > 5) return SendClientMessage(playerid, COLOR_GREY, "SERVER: Cannot go under 0 or above 5.");
if(PlayerInfo[playerid][pStaff] >= 5)
{
format(sendername, sizeof(sendername), "%s", PlayerName(playerid));
format(staffname, sizeof(staffname), "%s", GetStaffLvlName(playerid));
format(targetname, sizeof(targetname), "%s", PlayerName(targetid));
GiveNameSpace(sendername);
GiveNameSpace(targetname);
PlayerInfo[targetid][pStaff] = type;
new INI:File = INI_Open(UserPath(targetid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Staff", type);
INI_Close(File);
SetPlayerHealth(targetid, 0);
format(string, sizeof(string), "[Staff-Command]: %s %s has promoted %s to Staff-Level %d.", staffname, sendername, targetname, type);
SendStaffMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "%s %s has promoted you to Staff-Level %d.", staffname, sendername, type);
SendClientMessage(targetid, COLOR_GREEN, string);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
}
}
return 1;
}