+REP, pQuery!
#1

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);
    }
Reply
#2

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;
}
Reply
#3

Thank you, +1.
Reply


Forum Jump:


Users browsing this thread: