#1

Ok i got prolems with timers again -.- i have half fixed it but the problem is my timer isnt reseting when it is killer so if someone has 20 seconds left when they finish a race and start the race again they are only given 20 seconds instead of 80 seconds any help would be great and reped for.

The two timers that are bugged like this.

Код:
forward TimedCountdown(playerid);
public TimedCountdown(playerid) {
    if(iTimedCountdown == -1) {
        iTimedCountdown = 81;
    }

    new
        szMessage[10];

    iTimedCountdown--;
    format(szMessage, sizeof(szMessage), "~r~%d",iTimedCountdown); // Add more in if you wish.

    GameTextForPlayer(playerid, szMessage, 950, 6);

    if(iTimedCountdown == 0) {
        KillTimer(Sfracetimer);
        DisablePlayerRaceCheckpoint(playerid);
        P_DATA[ playerid ][ P_OnStyle ] = false;
    }
    return 1;
}
forward TimedCountdown1(playerid); // Also make a new SetTimerEx function in which you just add the number 1 in the funciton name.
public TimedCountdown1(playerid) {
    if(iTimedCountdown == -1) {
        iTimedCountdown = 81;
    }

    new
        szMessage[10];

    iTimedCountdown--; //  v down there, I have put ~n~ because that makes a new row, you don't want the timers to be in the same row and get one over an other.
    format(szMessage, sizeof(szMessage), "~n~~r~%d",iTimedCountdown); // Add more in if you wish.

    GameTextForPlayer(playerid, szMessage, 950, 6);

    if(iTimedCountdown == 0) {
        KillTimer(Eastracetimer);
        DisablePlayerRaceCheckpoint(playerid);
        P_DATA[ playerid ][ P_OnStyle ] = false;
    }
    return 1;
}
And this is how i end them (just a example of one as they are both the same only difference is sfrace/eastrace)
Код:
case 12:
           {
            DisablePlayerRaceCheckpoint(playerid);
            {
            Eastrace[playerid] = 0; //Resets the checkpoint variable
        new Moneys  = 1000 + random( 7000 ),
	        Score   = 30   + random( 10   ),
	        Cookies = 10   + random( 20   ),
	        String[ 256 ];

	        foreach(Player, i)
	        {
	         if ( i != playerid )
            {
	      	FormMessage( i, -1, ""COL_OGREEN"%s{FFFFFF} Has Finished The San Ferrio Street Race, And Won A Prize!", PlayerName2( playerid ) );
            }
		}
		format( String, sizeof String, " ~g~ FINISHED~n~~n~~w~You Finished The San Ferrio Street Race!~n~~n~~g~ REWARD!~n~~W~Cash:~g~~h~$%d~n~~w~Score: ~g~~h~%d~n~~w~Cookies: ~g~~h~%d",Moneys, Score, Cookies );
		Info( playerid, String,12000);
		P_DATA[ playerid ][ P_Cookies ] += Cookies;
		SetPlayerScore( playerid, GetPlayerScore( playerid ) + Score );
		GivePlayerMoney( playerid, Moneys );
		KillTimer(Eastracetimer);
		P_DATA[ playerid ][ P_OnStyle ] = false;
  	    }
      }
    }
	return 1;
}
Reply
#2

FIxed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)