Prevent player from exiting 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: Prevent player from exiting vehicle (
/showthread.php?tid=550796)
[SOLVED] Prevent player from exiting vehicle -
pcp - 14.12.2014
How can I do that? I made a research around the wiki and only found toggleplayercontrollable but that avoids player from driving. I want him to stay inside the vehicle, could you fellows enligthen me how to?
Re: Prevent player from exiting vehicle -
Write - 14.12.2014
pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInAnyVehicle(playerid))
{
if (newkeys & KEY_SECONDARY_ATTACK)
{
TogglePlayerControllable(playerid, 0);
SetTimerEx("Putbackin", 500, 0, "d", playerid);
}
}
return 1;
}
forward Putbackin(playerid);
public Putbackin(playerid)
{
TogglePlayerControllable(playerid, 1);
SetTimerEx("Putbackin2", 400, 0, "d", playerid);
return 1;
}
forward Putbackin2(playerid);
public Putbackin2(playerid)
{
TogglePlayerControllable(playerid, 0);
SetTimerEx("Putbackin3", 500, 0, "d", playerid);
return 1;
}
forward Putbackin3(playerid);
public Putbackin3(playerid)
{
TogglePlayerControllable(playerid, 0);
SetTimerEx("Putbackin4", 500, 0, "d", playerid);
return 1;
}
forward Putbackin4(playerid);
public Putbackin4(playerid)
{
TogglePlayerControllable(playerid, 1);
return 1;
}
Re: Prevent player from exiting vehicle -
pcp - 15.12.2014
Hmm, thank you both, figured out how to do that.