Problem after mysql_fetch_row_format
#8

Why are you making it yourself so hard, if SQL includes all functions that you need,
I show you how I make temporary bans,
First you create a column in your ban table with is type; timestamp
Then you insert a ban like:

Код:
 INSERT INTO `bans`(`username`, `start_date`, `expire_date`) VALUES ('%s', NOW(), NOW()+INTERVAL 10 DAY)
Now you banned this person for 3 days.

Then when the players connect and you check if he is banned, and when it expires you simply use thigs:

Код:
SELECT *,UNIX_TIMESTAMP(expire_date) AS timestamp FROM `bans` WHERE `username` = '%s' AND `IP` = '%s' AND `banned` = 1
Then you put this timestamp in a variable (int)
Then you use
pawn Код:
new timestamp;
// put your 'timestamp' from the sql results inside the timestamp variable.
if(timestamp < gettime())
{
// the player should get unbanned because it's expired
}
else
{
// players should get kicked because he is still banned.
}
Reply


Messages In This Thread
Problem after mysql_fetch_row_format (i thing) - by doreto - 30.12.2012, 11:16
Re: Problem after mysql_fetch_row_format - by [HiC]TheKiller - 30.12.2012, 12:54
Re: Problem after mysql_fetch_row_format - by doreto - 30.12.2012, 13:31
Re: Problem after mysql_fetch_row_format - by doreto - 31.12.2012, 08:56
Re: Problem after mysql_fetch_row_format - by doreto - 01.01.2013, 11:17
Re: Problem after mysql_fetch_row_format - by AndreT - 02.01.2013, 10:56
Re: Problem after mysql_fetch_row_format - by doreto - 04.01.2013, 11:02
Re: Problem after mysql_fetch_row_format - by Roel - 04.01.2013, 11:21
Re: Problem after mysql_fetch_row_format - by Djole1337 - 04.01.2013, 12:03

Forum Jump:


Users browsing this thread: 1 Guest(s)