30.07.2013, 11:56
Hello,
The below function uses BlueG's MySQL, and i want to convert it to StrickenKid's MySQL.
How to convert mysql_query_callback to Strickenkids?
I want to use this function with Strickenkid's MySQL plugin.
Thank you.
The below function uses BlueG's MySQL, and i want to convert it to StrickenKid's MySQL.
How to convert mysql_query_callback to Strickenkids?
I want to use this function with Strickenkid's MySQL plugin.
pawn Код:
stock jBanCheck(playerid)
{
format(jQuery, MAX_QUERY_LENGTH, "SELECT user_banner, ban_reason, TIMESTAMPDIFF(MINUTE, NOW(), DATE_ADD(ban_timestamp, INTERVAL ban_time MINUTE)) FROM `"#J_TABLE"` WHERE user_banned_ip = '%s' AND (NOW() <= DATE_ADD(ban_timestamp, INTERVAL ban_time MINUTE) OR ban_time = 0)", jIP[playerid]);
mysql_query_callback(QUERY_CHECKNAME, jQuery, "jban_OnQueryFinish", playerid, jban_connection);
return 1;
}
pawn Код:
public jban_OnQueryFinish(query[], index, extraid, connectionHandle)
{
if(index == QUERY_CHECKNAME)
{
mysql_store_result();
if(mysql_num_rows() > 0)
{
mysql_fetch_row(jResult);
j_sscanf(jResult, "p|ssi", jBan_Name, jBan_Reason, jBan_Time);
format(jBan_Message, MAX_MESSAGE_LENGTH, "[jBan]: You have an existing ban from \"%s\" for \"%s\", it will expire in %d minutes!", jBan_Name, jBan_Reason, jBan_Time);
SendClientMessage(extraid, COLOR_RED, jBan_Message);
Kick(extraid);
}
mysql_free_result();
}
return 1;
}