I have this command:
pawn Код:
CMD:makeadmin(playerid, params[])
{
new string[256], playerb, level, query[300], playab[24];
GetPlayerName(playerb, playab, 24);
if(!IsPlayerLoggedIn(playerid))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Error{FFFFFF}: You are not logged in.");
return 1;
}
if(PlayerInfo[playerid][pAdminLevel] < 4)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Error{FFFFFF}: You do not have the privileges to use this command.");
return 1;
}
if(sscanf(params, "ui", playerb, level))
{
SendClientMessage(playerid, COLOR_YELLOW, "Usage{FFFFFF}: /makeadmin [playerid] [level]");
return 1;
}
PlayerInfo[playerb][pAdminLevel] = level;
format(query, sizeof(query), "UPDATE playerdata SET AdminLevel=%d WHERE Username='%s'", PlayerInfo[playerb][pAdminLevel], playab);
mysql_query(query);
format(string, sizeof(string), "Admin Notice{FFFFFF}: %s %s has made %s a Level %d Administrator.", AdminRank(playerid), Name(playerid), Name(playerb), level);
SendAdminMessage(COLOR_LIGHTRED, 1, string);
return 1;
}
The problem is, when I actually type /makeadmin 0 7
it says "Senior Admin Diego_Javier has made a Level 7 Administrator."
I look in the mysql database, admin level is still 5.
I can usually do this stuff but I need a bit of a boost with this one command and I'm set, cheers.
Stock for the Name(playerid) and Name(playerb) I have in the script is:
pawn Код:
stock Name(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if(name[i] == '_') name[i] = ' ';
}
return name;
}