13.01.2015, 16:24
Here you go:
https://sampwiki.blast.hk/wiki/MySQL/R33#mysql_tquery
Basically you're sending the query and you're calling a function when the query executes (successfully or not).
Looks like there are 2 ways of getting the number of rows. Maybe there are more, but I only found these two:
[1] https://sampwiki.blast.hk/wiki/MySQL/R33..._get_row_count
[2] https://sampwiki.blast.hk/wiki/MySQL/R33#cache_get_data
https://sampwiki.blast.hk/wiki/MySQL/R33#mysql_tquery
Basically you're sending the query and you're calling a function when the query executes (successfully or not).
pawn Код:
mysql_tquery(connectionHandle, "SELECT Banned FROM players WHERE user = Bondage", "QueryResultCallback", "i", playerid); //passing the playerid as parameter to be able to send him a message if he's banned
public QueryResultCallback(playerid) //the only param of this function is playerid, which has been passed from the query
{
//get the number of rows
if(rows) // he's banned
{
//something - here you can use playerid to send the player a message and maybe kick him
}
else
{
//he's not banned - send a welcome message, call a login system if required etc
}
}
[1] https://sampwiki.blast.hk/wiki/MySQL/R33..._get_row_count
[2] https://sampwiki.blast.hk/wiki/MySQL/R33#cache_get_data