10 seconds to get back into vehicle - 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: 10 seconds to get back into vehicle (
/showthread.php?tid=584429)
10 seconds to get back into vehicle -
STONEGOLD - 04.08.2015
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?
Re: 10 seconds to get back into vehicle -
Stanford - 04.08.2015
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!
AW: 10 seconds to get back into vehicle -
Kaliber - 04.08.2015
Naja...so:
PHP код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(PlayerInfo[playerid][Job] == 1 && 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(--x == 0)
{
//Mission failed!
return 0;
}
return SetTimerEx(!"@back",999,0,!"ii",i,x);
}
Re: 10 seconds to get back into vehicle -
STONEGOLD - 04.08.2015
PHP код:
if(newstate== PLAYER_STATE_DRIVER)
{
if(pData[playerid][pMission] == MISSION_TYPE_TRUCK_2)
{
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
if(!IsTrailerAttachedToVehicle(vehicleid))
{
SendClientMessage(playerid, RED, "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.