18.03.2018, 15:12
Quote:
Код:
CMD:oban(playerid, params[]) { new name[24], reason[128], Query[155]; if(sscanf(params, "s[24]s[128]", name, reason)) return SCM(playerid, COR_CINZA, "Use: /oban [name] [reason]"); mysql_format(g_SQL, Query, sizeof(Query), "SELECT id FROM players WHERE username = '%s' LIMIT 1", name); mysql_tquery(g_SQL, Query, "OnPlayerOban", "iss", playerid, name, reason); return 1; } forward OnPlayerOBan(playerid, target[], offreason[]); public OnPlayerOBan(playerid, target[], offreason[]) { if(cache_num_rows() > 0) { new obanquery[256], admin[MAX_PLAYER_NAME], banip[16], year, month, day, formatDate[12]; cache_get_value_name(0, "ip", banip, 16); GetPlayerName(playerid, admin, MAX_PLAYER_NAME); getdate(year, month, day); format(formatDate, 12, "%02d/%02d/%d", day, month, year); mysql_format(g_SQL, obanquery, sizeof(obanquery), "INSERT INTO bans VALUES(NULL, '%s', '%s', '%s', '%s', '%s')", target, admin, banip, formatDate, offreason); mysql_tquery(g_SQL, obanquery); SendClientMessageToAllEx(COLOR_LIGHTRED, "AdmCmd: %s banned %s, reason: %s", pNome(playerid), target, offreason); } else { SendClientMessage(playerid, COLOR_LIGHTRED, "[ERROR] That player isn't registered!"); } return 1; } |
This will work but no one see the important thing in codes.
You Callback is "OnPlayerOBan" but you were using "OnPlayerOban" in your command.
Thats why it didn't respond!
it should be
Код:
mysql_format(g_SQL, Query, sizeof(Query), "SELECT id FROM players WHERE username = '%s' LIMIT 1", name); mysql_tquery(g_SQL, Query, "OnPlayerOBan", "iss", playerid, name, reason);
Код:
mysql_format(g_SQL, Query, sizeof(Query), "SELECT id FROM players WHERE username = '%s' LIMIT 1", name); mysql_tquery(g_SQL, Query, "OnPlayerOban", "iss", playerid, name, reason);