SA-MP Forums Archive
Stock problem - 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: Stock problem (/showthread.php?tid=649888)



Stock problem - C0oL3r - 16.02.2018

Код:
C:\Users\gora_\Desktop\Samp\gamemes\OldStyle.pwn(496) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\gora_\Desktop\Samp\gamemodes\OldStyle.pwn(499) : error 001: expected token: "-string end-", but found "-identifier-"
Код:
stock IsMonth29(year)
{
496:	new y = 2000;
	for(new i = 4; i < 3000; i += 4) 
	{
499:		if((y+i) == year) return 1;
	}
	return 0;
}



Re: Stock problem - Mugala - 16.02.2018

where did u IsMonth29 used?


Re: Stock problem - C0oL3r - 16.02.2018

Код:
			if(IsMonth31(month))
			{
				if(day > 31)
				{
					month++;
					if(month > 12)
					{
						year++;
						while(day > 31) day -= 31;
					}
					else while(day > 31) day -= 31;
				}
			}
			else if(!IsMonth31(month))
			{
				if(day > 30)
				{
					month++;
					if(month > 12)
					{
						year++;
						while(day > 30) day -= 30;
					}
					else while(day > 30) day -= 30;
				}
			}
			else if(!IsMonth31(month) && IsMonth29(year) && month == 2)
			{
				if(day > 29)
				{
					month++;
					if(month > 12)
					{
						year++;
						while(day > 29) day -= 29;
					}
					else while(day < 29) day -= 29;
				}
			}
			else if(!IsMonth31(month) && !IsMonth29(year) && month == 2)
			{
				if(day > 28)
				{
					month++;
					if(month > 12)
					{
						year++;
						while(day > 28) day -= 28;
					}
					else while(day > 28) day -= 28;
				}
			}
i used in a ban command


Re: Stock problem - AdamsLT - 16.02.2018

The code seems fine, albeit unnecessary as there are better ways of turning, what I assume to be, timestamps to actual dates (there are includes written that get the job done).

But back on topic, I thought only strings can receive this error. But you're obviously working with ints, right?
I, personally, don't see what could be causing that problem in the code you provided, as it currently says that you are trying to format a string when you can't actually do that, if I'm not mistaken.

I'd be great to see more code, maybe both the /ban command and this entire conversion part that you showed so far.


Re: Stock problem - Mugala - 16.02.2018

where is your "new year" ?


Re: Stock problem - C0oL3r - 16.02.2018

Ok, so with timestamps is more good, you can give me an example how to do, or a tutorial?