24.07.2014, 19:55
I made a /makeadmin command:
Now once I refresh PHP myadmin the admin level goes back to the last level. For example if I type /makeadmin 0 0, it will go 0 a second and return to level 5 in the table.
Anybody knows what could be the issue?
pawn Код:
CMD:makeadmin(playerid, params[])
{
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You cannot access this command.");
new id, level, pName[MAX_PLAYER_NAME], query[230], string[126], pName2[MAX_PLAYER_NAME];
if(sscanf(params, "ui", id, level))
return SendClientMessage(playerid, -1, "SYNTAX: /makeadmin [playerid] [level]");
GetPlayerName(id, pName, sizeof(pName));
if(id == INVALID_PLAYER_ID)
return SendClientMessage(playerid, COLOR_RED, "[ERROR]: This player is not connected.");
format(query, sizeof(query), "UPDATE accounts SET Admin = %d WHERE `Name` = '%s'", level, pName);
mysql_query(query);
printf("%s", query); // this line was made in order to make sure the command works properly, testing purposes.
GetPlayerName(playerid, pName2, sizeof(pName2));
format(string, sizeof(string), "[ADM-MSG] You have been promoted to administrator level %d by %s.", level, pName2);
SendClientMessage(id, COLOR_LIGHTGREEN, string);
return 1;
}
Now once I refresh PHP myadmin the admin level goes back to the last level. For example if I type /makeadmin 0 0, it will go 0 a second and return to level 5 in the table.
Anybody knows what could be the issue?