Help with MySQL queries
#3

Quote:
Originally Posted by shady001
View Post
I know that when you use SELECT you must use a forward and public to be able to work with selected content like :

This:
pawn Code:
public OnPlayerConnect(playerid)
{
    TogglePlayerClock(playerid, 1);
    new query[200], Message[256];

    new ip[16];
    GetPlayerIp(playerid, ip, sizeof(ip));

    format(query, sizeof(query), "SELECT * FROM `Banned` WHERE IP = '%s'", ip);
    mysql_query(query);
    mysql_store_result();


    if(mysql_num_rows() >= 1)
    {
        SCM(playerid, COLOR_RED, "You are banned from this server.");
        Kick(playerid);
    }
    mysql_free_result();
will be:
pawn Code:
public OnPlayerConnect(playerid)
{
    TogglePlayerClock(playerid, 1);
    new query[200], Message[256];

    new ip[16];
    GetPlayerIp(playerid, ip, sizeof(ip));

    format(query, sizeof(query), "SELECT * FROM `Banned` WHERE IP = '%s'", ip);
    mysql_function_query(dbHandel,query,true,"BanResult","i",playerid);
pawn Code:
forward BanResult(playerid);
public BanResult(playerid)
{
 new rows, fields;
 cache_get_data(rows, fields, dbHandle);
  if(rows >= 1)
    {
        SCM(playerid, COLOR_RED, "You are banned from this server.");
        Kick(playerid);
    }
return 1;
}

And BTW you should use a timer to kick player , if you don't he will not recieve the message since 0.3x
That makes more sense to me, you see... Thanks for that! And with the message and 0.3x.. I stopped scripting at 0.3d so a lot needs updated, how come they will not receive the message?
Reply


Messages In This Thread
Help with MySQL queries - by LiamM - 20.03.2013, 10:04
Re: Help with MySQL queries - by shady001 - 20.03.2013, 10:23
Re: Help with MySQL queries - by LiamM - 20.03.2013, 10:28
Re: Help with MySQL queries - by Konstantinos - 20.03.2013, 10:29
Re: Help with MySQL queries - by shady001 - 20.03.2013, 10:37

Forum Jump:


Users browsing this thread: 1 Guest(s)