22.03.2017, 13:04
You have to enclose a string with single or double quote in sql query.
And also, you can just execute update query without need to check if player name is exists in database. You can use cache_affected_rows() in the "OffBan" callback to check if player is already banned or doesn't exists.
Here's an example:
Код:
WHERE `Name` = '%e'
Here's an example:
Код:
// In your oban cmd mysql_format(g_Sql, query, sizeof(query), "UPDATE `accounts` SET `isBanned` = 1 WHERE `Name` = '%e'", PlayerName); mysql_tquery(g_Sql, query, "OffBan", "is", playerid, PlayerName); public OffBan(playerid, Banned[]) { if(cache_affected_rows()) // It returns total of affected rows { new fmt[128]; format(fmt, 128, "[BS] {AFAFAF}You have offline banned %s", Banned); SendClientMessage(playerid, COLOR_DARKCORAL, "[BS] {AFAFAF}Offline ban executed!"); return 1; } else { SendClientMessage(playerid, COLOR_DARKCORAL, "[BS] {AFAFAF}That player doesn't exist or already banned!"); return 1; } return 1; }