26.03.2013, 17:03
Hey guys,
I made a new ban system, and decided to make a tempban aswell. The ban works, but after the persons ban finishes. He is supposed to be unban (Meaning the Ban Status should set to 0 automatically)
Here is my checkban stock which checks if the players ban time has ran out.
See here, after the ban time runs out, it is supposed to set the Ban Status to 0 meaning the player is unbanned, but it is not doing that..
I don't see anything wrong in the script, but it is not unbanning me. I really hope you can help me through this tough situation.
Thanks
I made a new ban system, and decided to make a tempban aswell. The ban works, but after the persons ban finishes. He is supposed to be unban (Meaning the Ban Status should set to 0 automatically)
Here is my checkban stock which checks if the players ban time has ran out.
pawn Код:
stock CheckBan(playerid)
{
new query[900], bExpiration, bID, IP[16];
GetPlayerIp(playerid, IP, sizeof(IP));
format(query,sizeof(query),"SELECT * FROM bans WHERE (Name = '%s' OR IP = '%s') AND Status = '1'", GetName(playerid), IP );
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() >= 1)
{
new bReason[128], bannedBy[MAX_PLAYER_NAME], Name[MAX_PLAYER_NAME], Dialog[900], IP1[16];
while(mysql_fetch_row_format(query,"|"))
{
mysql_fetch_field_row(Name, "Name");
mysql_fetch_field_row(bReason, "Reason");
mysql_fetch_field_row(bannedBy, "BannedBy");
mysql_fetch_field_row(IP1, "IP");
mysql_fetch_field_row(query, "bID"); bID = strval(query);
mysql_fetch_field_row(query, "Expiration"); bExpiration = strval(query);
if(bExpiration > 0)
{
if(gettime() >= bExpiration)
{
format(query, sizeof(query), "UPDATE bans SET Status = 0 WHERE bID = %d", bID);
mysql_query(query);
}
else
{
format(Dialog, sizeof(Dialog), "{FF0000}You are banned from this server! Ban details:\n\n{FF0000}Name:{FFFFFF} %s \n{FF0000}IP:{FFFFFF} %s\n{FF0000}Reason:{FFFFFF} %s \n{FF0000}Banned By:{FFFFFF} %s\n\n{FF0000}You will be unbanned in %d hours!\n\n{FF0000}If you think this ban is unfair, you can apply for an unban appeal at our forums\n{FF0000}Note - We do not unban hackers, or people who lie in their appeal", Name, IP1, bReason, bannedBy, (bExpiration-gettime())/3600);
ShowPlayerDialog(playerid, DIALOG_BAN, DIALOG_STYLE_MSGBOX, "{FF0000}Banned!", Dialog, "Close", "");
}
}
else
{
format(Dialog, sizeof(Dialog), "{FF0000}You are banned from this server! Ban details:\n\n{FF0000}Name:{FFFFFF} %s \n{FF0000}IP:{FFFFFF} %s\n{FF0000}Reason:{FFFFFF} %s \n{FF0000}Banned By:{FFFFFF} %s\n\n{FF0000}If you think this ban is unfair, you can apply for an unban appeal at our forums\n{FF0000}Note - We do not unban hackers, or people who lie in their appeal", Name, IP1, bReason, bannedBy);
ShowPlayerDialog(playerid, DIALOG_BAN, DIALOG_STYLE_MSGBOX, "{FF0000}Banned!", Dialog, "Close", "");
}
}
return 1;
}
mysql_free_result();
return 0;
}
pawn Код:
if(bExpiration > 0)
{
if(gettime() >= bExpiration)
{
format(query, sizeof(query), "UPDATE bans SET Status = 0 WHERE bID = %d", bID);
mysql_query(query);
}
else
{
format(Dialog, sizeof(Dialog), "{FF0000}You are banned from this server! Ban details:\n\n{FF0000}Name:{FFFFFF} %s \n{FF0000}IP:{FFFFFF} %s\n{FF0000}Reason:{FFFFFF} %s \n{FF0000}Banned By:{FFFFFF} %s\n\n{FF0000}You will be unbanned in %d hours!\n\n{FF0000}If you think this ban is unfair, you can apply for an unban appeal at our forums\n{FF0000}Note - We do not unban hackers, or people who lie in their appeal", Name, IP1, bReason, bannedBy, (bExpiration-gettime())/3600);
ShowPlayerDialog(playerid, DIALOG_BAN, DIALOG_STYLE_MSGBOX, "{FF0000}Banned!", Dialog, "Close", "");
}
}
else
{
format(Dialog, sizeof(Dialog), "{FF0000}You are banned from this server! Ban details:\n\n{FF0000}Name:{FFFFFF} %s \n{FF0000}IP:{FFFFFF} %s\n{FF0000}Reason:{FFFFFF} %s \n{FF0000}Banned By:{FFFFFF} %s\n\n{FF0000}If you think this ban is unfair, you can apply for an unban appeal at our forums\n{FF0000}Note - We do not unban hackers, or people who lie in their appeal", Name, IP1, bReason, bannedBy);
ShowPlayerDialog(playerid, DIALOG_BAN, DIALOG_STYLE_MSGBOX, "{FF0000}Banned!", Dialog, "Close", "");
}
Thanks