Posts: 10
Threads: 2
Joined: Dec 2014
Reputation:
0
14.12.2014, 21:57
(
Last edited by pcp; 15/12/2014 at 12:53 PM.
)
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?
Posts: 263
Threads: 11
Joined: Nov 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;
}
Posts: 10
Threads: 2
Joined: Dec 2014
Reputation:
0
Hmm, thank you both, figured out how to do that.