10 seconds to get back into vehicle
#1

how can i script like if player is in job and if player get out of car while is misison so it gives 10 seconds to players to get back into car otherwise mission failed?
Reply
#2

Use OnPlayerStateChange - also get the state of the player if he actually doing that job - oldstate PLAYER driver and newstate isn't (!=) player driver state; set a timer for 10 seconds using (SetTimerEx) for the player and add statements under it (if he got back to vehicle specified).

I hope I helped any feedback is appreciated!



- you can use OnPlayerExitVehicle also!
Reply
#3

Naja...so:

PHP код:
public OnPlayerExitVehicle(playeridvehicleid)
{
    if(
PlayerInfo[playerid][Job] == && vehicleid == truck//truck = the vehicleid of the mission car
    
{
        
SetTimerEx(!"@back",999,0,!"ii",playerid,10); //10 = the time to get back 10sec
        
GameTextForPlayer(playerid,!"~r~Get back in the car!",10*1000,5);
    }
    return 
1;
}
@
back(i,x);@back(i,x) {
    if(
IsPlayerInVehicle(i,truck)) return 1//Here he went in 10sec in the truck
    
if(--== 0)
    {
        
//Mission failed!
        
return 0;
    }
    return 
SetTimerEx(!"@back",999,0,!"ii",i,x);

Reply
#4

PHP код:
if(newstate== PLAYER_STATE_DRIVER)
    {
     if(
pData[playerid][pMission] == MISSION_TYPE_TRUCK_2)
        {
               new 
vehicleid;
               
vehicleid GetPlayerVehicleID(playerid);
               if(!
IsTrailerAttachedToVehicle(vehicleid))
               {
                   
SendClientMessage(playeridRED"You have 50 seconds to re-attach the trailer.");
               }
        }
    } 
I'm doing this on onplayerstate. Can u add timer here? ^^
Also, I want it counts 30 seconds on player screen.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)