18.03.2018, 00:01
Finally I decided to post here, I have made this cmds:
This is the callback:
Nothing happens when I put the cmd, and this appears on the log:
If I delete
Those numbers, cmd still doesnt work and the log goes empty.
Thanks for your help, Im beginner with mysql, sorry for any noob shit.
PHP код:
CMD:oban(playerid, params[])
{
new name[24], reason[128], Query[128];
if(sscanf(params, "s[24]s[128]", name, reason))
return SCM(playerid, COR_CINZA, "Use: /oban [name] [reason]");
/*mysql_format(sql_handle, Consulta, sizeof(Consulta), "SELECT `id` , `ip` FROM `jugadores` WHERE `nombre`='%s'", nombre);
mysql_tquery(sql_handle, Consulta, "BanearJugadorNombre", "ds[24]s[50]", playerid, nombre, razon);*/
mysql_format(g_SQL, Query, sizeof(Query), "SELECT `id`, `ip` FROM `players` WHERE `username` = '%e' LIMIT 1", name);
mysql_tquery(g_SQL, Query, "OnPlayerOban", "ds[24]s[128]", playerid, name, reason);
return 1;
}
PHP код:
forward OnPlayerOBan(playerid, target[], offreason[]);
public OnPlayerOBan(playerid, target[], offreason[])
{
if(cache_num_rows() > 0)
{
new obanquery[256], admin[MAX_PLAYER_NAME], banid, banip[16], year, month, day, formatDate[10];
cache_get_value_name_int(0, "id", banid);
cache_get_value_name(0, "ip", banip, 16);
GetPlayerName(playerid, admin, MAX_PLAYER_NAME);
getdate(year, month, day);
format(formatDate, 10, "%d/%d/%d", day, month, year);
mysql_format(g_SQL, obanquery, sizeof(obanquery), "INSERT INTO `bans` (`id`, `username`, `admin`, `ip`, `date`, `reason`) VALUES ('%d', '%s', '%s', '%s', '%s', '%s')", banid, 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;
}
Код:
[ERROR] mysql_tquery: callback error: parameter count does not match format specifier length
Код:
mysql_tquery(g_SQL, Query, "OnPlayerOban", "ds[24]s[128]", playerid, name, reason);
Thanks for your help, Im beginner with mysql, sorry for any noob shit.