27.12.2016, 14:12
There are few reasons why your command could fail :
- 'name' array is left to be empty or null.
- You're not supposed to use "u" specifier to set offline names because the player is supposed to be offline and "u" specifier will return the ID as an invalid one.
- Not really the reason why your command isn't working but it's safe to escape your input string.
- 'name' array is left to be empty or null.
- You're not supposed to use "u" specifier to set offline names because the player is supposed to be offline and "u" specifier will return the ID as an invalid one.
- Not really the reason why your command isn't working but it's safe to escape your input string.
pawn Код:
CMD:setolevel(playerid, params[]) {
if(pData[playerid][Admin] < 9)
return SendClientMessage(//only 9+ can stuff...
new
accName[MAX_PLAYER_NAME],
level,
string[100]
;
if(sscanf(params, "s["#MAX_PLAYER_NAME"]d", accName, level))
return SendClientMessage(playerid, COLOR_YELLOW, "USAGE : /setolevel [account name] [level]");
if(level < 1 || level > 10)
return SendClientMessage(//message);
//You should check if the account exists or not or just see if the query returns any error while update.
mysql_format(mysql, string, sizeof(string), "UPDATE `players` SET `level`=%d WHERE `username`='%e'",
level, accName);
mysql_tquery(mysql, string, "", "");
return 1;
}