SA-MP Forums Archive
Whats wrong with this code - 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: Whats wrong with this code (/showthread.php?tid=178263)



Whats wrong with this code - FrankC - 21.09.2010

if you types /time i want it to say example:

The current server time is 21:02:15
65 seconds (1 minutes) <--- I only want it to say that if your in prison


Код:
command(time, playerid, params[])
{
	#pragma unused params
	
	if( Player[playerid][Cuffed] >= 1 || Player[playerid][Tazed] >= 1 || Player[playerid][IsAtEvent] >= 1 )
	{
	    SendClientMessage( playerid, WHITE, "You're unable to execute this right now." );
	}
	else
	{
		new string[ 128 ], hour, minute, second;
		gettime( hour, minute, second );

		format( string, sizeof( string ), "The current server time is %d:%d:%d ", hour, minute, second );
		SendClientMessage( playerid, WHITE, string );

		    	if( Player[i][PrisonDuration] >= 1)
		    	{
		    	    new string[ 128 ];
		        	Player[i][PrisonDuration]--;
					format( string, sizeof( string ), "~n~~n~~n~~n~~n~~n~~n~ ~R~%d seconds (%d minutes)", Player[i][PrisonDuration], SecondsToMinutes( Player[i][PrisonDuration]) );
	   				SendClientMessage( playerid, GREY, string );
		    	}



Re: Whats wrong with this code - Mauzen - 21.09.2010

Looks ok so far. What is the problem with it? Worng output, errors?


Re: Whats wrong with this code - FrankC - 21.09.2010

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
Looks ok so far. What is the problem with it? Worng output, errors?
Im getting these errors:

Код:
: error 017: undefined symbol "i"
: error 017: undefined symbol "i"
: error 017: undefined symbol "i"

3 Errors.



Re: Whats wrong with this code - Mauzen - 21.09.2010

Ah, didnt see that.
Do you use a timer to decrease the prison time? (Id guess so)
If yes, you can just replace the 'i's with playerid and remove that line
Player[i][PrisonDuration]--;

It would decrease the time each time it is checked.

btw: ~n~ and ~r~ do not work in ClientMessages, only in TextDraws or gametexts


Re: Whats wrong with this code - FrankC - 21.09.2010

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
Ah, didnt see that.
Do you use a timer to decrease the prison time? (Id guess so)
If yes, you can just replace the 'i's with playerid and remove that line
Player[i][PrisonDuration]--;

It would decrease the time each time it is checked.

btw: ~n~ and ~r~ do not work in ClientMessages, only in TextDraws or gametexts
Thanks works now