What could be wrong? - 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: What could be wrong? (
/showthread.php?tid=173884)
What could be wrong? -
Claude - 03.09.2010
I am trying to make a tempban script, but the check doesn't work, what is the problem?
pawn Код:
stock CheckTempBan(playerid)
{
new ip[15];
new str[128];
new load[3][32];
new ban_second, ban_minute, ban_hour, ban_ip[20];
GetPlayerIp(playerid, ip, sizeof ip);
new hour, minute, second;
gettime(hour, minute);
new File:file = fopen("/userfiles/tempban.ini",io_read);
if (file)
{
while (fread(file, str, sizeof str))
{
split(str, load, '|');
ban_hour = strval(load[0]);
ban_minute = strval(load[1]);
strmid(ban_ip, load[2], 0, strlen(load[2])-1, 15);
if (!(hour >= ban_hour && minute >= ban_minute) && !strcmp(ban_ip, ip, true))
{
format(str, sizeof str, "You are temporarily banned from this server until: %d:%d", ban_hour, ban_minute);
SendClientMessage(playerid, COLOR_CYAN, str);
return Kick(playerid);
}
}
}
return true;
}
Re: What could be wrong? -
Claude - 04.09.2010
Sorry for bumping but I don't know the problem
Re: What could be wrong? -
LarzI - 04.09.2010
Explain what you are trying to do here:
pawn Код:
if (!(hour >= ban_hour && minute >= ban_minute) && !strcmp(ban_ip, ip, true))
If I was going to read it, it'd be: If ("hour" is more than or equal to "ban_hour" and "minute" is more than or equal to "ban_minute") and all that is false, and "ban_ip" compared with "ip" is equal to false (aka, they are the same), continue.
Re: What could be wrong? -
Claude - 04.09.2010
Problem solved, Hiddos helped me :>
Re: What could be wrong? -
LarzI - 04.09.2010
Ah, ok :] Well done