02.01.2015, 16:28
We have a makeadmin command. Now when we try to update the database to SAY the level we set. It doesnt. We have a printf to print into the console, and it does. So it cannot be liking the mysql_tquery.
Heres the command.
Heres the command.
PHP код:
CMD:makeadmin(playerid, params[])
{
new playerb, string[256], string1[256], level;
if(pInfo[playerid][Admin] < 4 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "SERVER: Unknown command.");
if (sscanf(params, "ui", playerb, level)) return SendClientMessage(playerid, -1, "Usage: /makeadmin [Playerid/part of name] [Level]");
if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COL_ERROR, "ERROR: That player is not connected!");
if(level > 4 && level < 1337) return SendClientMessage(playerid, COL_ERROR, "ERROR: Invalid level(Use level 1-4)");
pInfo[playerb][Admin] = level;
format(string, sizeof(string), "You have made %s a level %i Admin!", GetName(playerb), level);
SendClientMessage(playerid, COL_HELPER, string);
format(string1, sizeof(string1), "%s has made you a level %i Admin!", GetName(playerid), level);
SendClientMessage(playerb, COL_HELPER, string1);
mysql_format(mysql, query, sizeof(query), "UPDATE `users` SET `Admin`=%i WHERE `Username`=%s", pInfo[playerb][Admin], GetName(playerb));
printf("%s", query);
mysql_tquery(mysql, query);
return 1;
}