How can i do... - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How can i do... (
/showthread.php?tid=159174)
How can i do... -
nuriel8833 - 12.07.2010
that if the player is leaving (or atlealt trying to) a vehicle it is wont allow him?
Thanks for helpers!
Re: How can i do... -
Mauzen - 12.07.2010
I think it is not possible. You could only check if he leaves the vehicle, and if yes, put him back into it. Or you use TogglePlayerControllable, but he also could not do anything else then.
Re: How can i do... -
oliverrud - 12.07.2010
Or kill him.
Re: How can i do... -
Jeffry - 12.07.2010
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
TogglePlayerControllable(playerid, false);
TogglePlayerControllable, true);
SendClientMessage(playerid, 0xFFFF00FF, "You cannot leave vehicles!");
return 1;
}
I didn't try it, but you can test it.
Re: How can i do... -
DeathOnaStick - 12.07.2010
What if you return 0 under OnPlayerExitVehicle? If this doesnt work check the F-key (if its possible) on OnPlayerKeyStateChange and return 0 there. I hope one of this methods works.
Re: How can i do... -
Vince - 12.07.2010
Try with OnPlayerKeyStateChange.
And when he presses enter/f, use PutPlayerInVehicle.
Re: How can i do... -
nuriel8833 - 15.07.2010
Quote:
Originally Posted by DeathOnaStick
What if you return 0 under OnPlayerExitVehicle? If this doesnt work check the F-key (if its possible) on OnPlayerKeyStateChange and return 0 there. I hope one of this methods works.
|
It depence on which vehicle
Re: How can i do... -
Finn - 15.07.2010
Save the vehicle ID & seat when the player exits the vehicle, and put him back in the vehicle when the state changes to
PLAYER_STATE_ONFOOT.
pawn Код:
new veh_id[MAX_PLAYERS],
veh_seat[MAX_PLAYERS];
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_ONFOOT)
{
if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
{
PutPlayerInVehicle(playerid, veh_id[playerid], veh_seat[playerid]);
}
}
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
veh_id[playerid] = vehicleid;
veh_seat[playerid] = GetPlayerVehicleSeat(playerid);
return 1;
}