+REP, pQuery! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: +REP, pQuery! (
/showthread.php?tid=591055)
+REP, pQuery! -
norton2 - 07.10.2015
I want to use pquery and can not!
Function Work (To OnPlayerConnect) with "mysql_query":
Код:
mysql_format(MySQLCon, query, sizeof(query), "SELECT * FROM bans WHERE Player = '%s'", GetName(playerid));
mysql_query(MySQLCon, query);
if(cache_num_rows())
{
SetTimerEx("KickPublic", 10, false, "i", playerid);
new playerIP[32];
GetPlayerIp(playerid, playerIP, sizeof(playerIP));
format(AdminWText, sizeof(AdminWText), "AdminWarning: %s(%s) tried to login while banned.", GetName(playerid), playerIP);
SendAdminMessage(COLOR_ADMWARNING, AdminWText);
}
Function Not Work (To OnPlayerConnect) with "mysql_pquery":
Код HTML:
mysql_format(MySQLCon, query, sizeof(query), "SELECT * FROM bans WHERE Player = '%s'", GetName(playerid));
mysql_pquery(MySQLCon, query);
if(cache_num_rows())
{
SetTimerEx("KickPublic", 10, false, "i", playerid);
new playerIP[32];
GetPlayerIp(playerid, playerIP, sizeof(playerIP));
format(AdminWText, sizeof(AdminWText), "AdminWarning: %s(%s) tried to login while banned.", GetName(playerid), playerIP);
SendAdminMessage(COLOR_ADMWARNING, AdminWText);
}
Re: +REP, pQuery! -
Dusan01 - 07.10.2015
hmm, try it like this:
Код:
forward CheckBanQuery(playerid);
public OnPlayerConnect(playerid)
{
mysql_format(MySQL, query, sizeof(query), "SELECT * FROM `bans` WHERE `Player` = '%s' LIMIT 1", GetName(playerid));
mysql_pquery(MySQL, query, "CheckBanQuery", "d", playerid);
return 1;
}
public CheckBanQuery(playerid)
{
if (cache_num_rows())
{
SetTimerEx("KickPublic", 10, false, "i", playerid);
new playerIP[32];
GetPlayerIp(playerid, playerIP, sizeof(playerIP));
format(AdminWText, sizeof(AdminWText), "AdminWarning: %s(%s) tried to login while banned.", GetName(playerid), playerIP);
SendAdminMessage(COLOR_ADMWARNING, AdminWText);
}
return 1;
}
Re: +REP, pQuery! -
norton2 - 07.10.2015
Thank you, +1.