SA-MP Forums Archive
Help with function - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with function (/showthread.php?tid=235397)



Help with function - Unknown123 - 05.03.2011

It just don't work
pawn Код:
stock IsPlayerBanned(playerid)
{
    new queue[16];
    format(queue, sizeof(queue), "SELECT * FROM `PlayerBans` WHERE IP='%s'", PlayerIP(playerid)); //It should me something like: If the PlayerName/IP is in the "PlayerBans" data base then he is banned...
    return 1;
}
Example Usage:
pawn Код:
dcmd_AmIBanned(playerid, params[])
{
    #pragma unused params
    if(IsPlayerBanned(playerid))
    {
        SendClientMessage(playerid, COLOR_INFO, "You is banned");
        return 1;
    }
    else if(!IsPlayerBanned(playerid))
    {
        SendClientMessage(playerid, COLOR_INFO, "You is NOT banned");
        return 1;
    }
    return 1;
}



Re: Help with function - famas.[FTW] - 05.03.2011

This should work:

pawn Код:
stock IsPlayerBanned(playerid)
{
    new queue[16];
    format(queue, sizeof(queue), "SELECT * FROM `PlayerBans` WHERE IP='%s'", PlayerIP(playerid)); //It should me something like: If the PlayerName/IP is in the "PlayerBans" data base then he is banned...
    mysql_query(queue);
    mysql_store_result();
    if(mysql_num_rows())
    {
        mysql_free_result();
        return 1;
    }
    mysql_free_result();
    return 0;
}



Re: Help with function - Unknown123 - 05.03.2011

Quote:
Originally Posted by famas.[FTW]
Посмотреть сообщение
This should work:

pawn Код:
stock IsPlayerBanned(playerid)
{
    new queue[16];
    format(queue, sizeof(queue), "SELECT * FROM `PlayerBans` WHERE IP='%s'", PlayerIP(playerid)); //It should me something like: If the PlayerName/IP is in the "PlayerBans" data base then he is banned...
    mysql_query(queue);
    mysql_store_result();
    if(mysql_num_rows())
    {
        mysql_free_result();
        return 1;
    }
    mysql_free_result();
    return 0;
}
Thnaks