Whats wrong with this code
#1

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 );
		    	}
Reply
#2

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

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.
Reply
#4

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
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)