SA-MP Forums Archive
Problem with temporary ban (MySQL) - 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)
+--- Thread: Problem with temporary ban (MySQL) (/showthread.php?tid=598073)



Problem with temporary ban (MySQL) - iulicxd - 08.01.2016

Код:
publics CheckBan(playerid)
{
    new ip[24],name[MAX_PLAYER_NAME],year,month,days;
    GetPlayerIp(playerid,ip,24);
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
	for(new i = 0; i <= sbans; ++i)
	{
		if(!strcmp(BanInfo[i][Name],name,true))
		{
		    if(getdate(days,month,year) < BanInfo[i][UDate])
		    {
				new string[512],temp[512];
				format(string,sizeof(string),"{00B7FF}Hello {FF0000}%s!\n",name);
				strcat(temp, string);
				format(string,sizeof(string),"{00B7FF}You account is {FF0000}banned!\n");
				strcat(temp, string);
				format(string,sizeof(string),"{00B7FF}Banned by {FF0000}%s!\n",BanInfo[i][Admin]);
				strcat(temp, string);
				format(string,sizeof(string),"{00B7FF}Reason:{FF0000}%s!\n",BanInfo[i][Reason]);
				strcat(temp, string);
				format(string,sizeof(string),"{00B7FF}Automatically unbaned after {FF0000}%d days!\n",BanInfo[i][Time]);
				strcat(temp, string);
				ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "{00B7FF}Account-Blocked", temp	, "Exit", "");
				DelayedKick(playerid);
				break;
			}
			else
			{
			    orm_delete(BanInfo[i][ORM_ID]);
			    break;
			}
		}
		if(!strcmp(BanInfo[i][IP],ip,true))
		{
		    if(getdate(days,month,year) < BanInfo[i][UDate])
		    {
				new string[512],temp[512];
				format(string,sizeof(string),"{00B7FF}Hello {FF0000}%s!\n",name);
				strcat(temp, string);
				format(string,sizeof(string),"{00B7FF}You account is {FF0000}banned!\n");
				strcat(temp, string);
				format(string,sizeof(string),"{00B7FF}Banned by {FF0000}%s!\n",BanInfo[i][Admin]);
				strcat(temp, string);
				format(string,sizeof(string),"{00B7FF}Reason:{FF0000}%s!\n",BanInfo[i][Reason]);
				strcat(temp, string);
				format(string,sizeof(string),"{00B7FF}Automatically unbaned after {FF0000}%d days!\n",BanInfo[i][Time]);
				strcat(temp, string);
				ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "{00B7FF}Account-Blocked", temp	, "Exit", "");
				DelayedKick(playerid);
				break;
			}
			else
			{
			    orm_delete(BanInfo[i][ORM_ID]);
			    break;
			}
		}
	}
	return 1;
}
The problem is the not checking correctly
But all bans correct loading with system ORM (orm_Addvar_int,addvar_string,etc..) like this system .. )
If i ban player to 10 days (18.01.2016) and enter in the server with this date,server show me that i have account banned
i tested, put the unbandate 07.01.2016 and enter in the server and server show me that i have ban
else i tried to put unbandate 08.01.2016 and 09.01.2016 and it not working ...Help me


Re: Problem with temporary ban (MySQL) - Vince - 08.01.2016

getdate() returns the number of days since the start of the year. Are you looking for gettime()?


Re: Problem with temporary ban (MySQL) - iulicxd - 08.01.2016

Quote:
Originally Posted by Vince
Посмотреть сообщение
getdate() returns the number of days since the start of the year. Are you looking for gettime()?
i tried with gettime but it do not work,system ban working on Years,Months,Days,not hours,minutes,seconds!