Non driveable vehicle -
Arxalan - 29.01.2015
Hello , i want to know how to make a vehicle non driveable . i mean player can sit and exit from it but can't drive it.
Re: Non driveable vehicle -
Sew_Sumi - 29.01.2015
https://sampwiki.blast.hk/wiki/SetVehicleParamsEx
Toggle the engine and they won't go far but could roll the car around. Be sure though to reset that though too, leaving it off, will make it not drive-able for others.
https://sampwiki.blast.hk/wiki/Function:...erControllable
Freezing the player though will make the camera freeze as well.
Re: Non driveable vehicle -
Ironboy - 29.01.2015
pawn Код:
if((newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER))
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 447) { //Cannot drive a specific vehicle,
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(playerid,x,y,z+3);}
}
Re: Non driveable vehicle -
Sew_Sumi - 29.01.2015
Quote:
Originally Posted by Ironboy
pawn Код:
if((newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)) { if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 447) { //Cannot drive a specific vehicle, new Float:x, Float:y, Float:z; GetPlayerPos(playerid,x,y,z); SetPlayerPos(playerid,x,y,z+3);} }
|
That's not what he asked for... and that's not what this section is for either.
Re: Non driveable vehicle -
Ironboy - 29.01.2015
Quote:
Originally Posted by Sew_Sumi
That's not what he asked for... and that's not what this section is for either.
|
According to what he asked, the above code would do the same function.
Re: Non driveable vehicle -
ATGOggy - 29.01.2015
PHP код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 0, lights, false, doors, bonnet, boot, objective);
return 1;
}
Re: Non driveable vehicle -
Sew_Sumi - 29.01.2015
Quote:
Originally Posted by Arxalan
Hello , i want to know how to make a vehicle non driveable . i mean player can sit and exit from it but can't drive it.
|
Quote:
Originally Posted by Ironboy
According to what he asked, the above code would do the same function.
|
You were saying? Your code simply throws them out 3 foot up. Disabling the engine itself would stop them driving and allow cameras to still work. Freezing a player in the vehicle would even be another option.
Having the function of SAMP to disable an engine is there, and it should be used more.
And ATGoggy's example, will do it for every player (entering driver, or passenger) and every vehicle. Good example, but should say that.
Re: Non driveable vehicle -
ATGOggy - 29.01.2015
Quote:
Originally Posted by Sew_Sumi
You were saying? Your code simply throws them out 3 foot up. Disabling the engine itself would stop them driving and allow cameras to still work. Freezing a player in the vehicle would even be another option.
Having the function of SAMP to disable an engine is there, and it should be used more.
And ATGoggy's example, will do it for every player (entering driver, or passenger) and every vehicle. Good example, but should say that.
|
I need to know the situation in which he wants to use this function to post a proper code.
Re: Non driveable vehicle -
Sew_Sumi - 30.01.2015
Quote:
Originally Posted by ATGOggy
I need to know the situation in which he wants to use this function to post a proper code.
|
Nope, what you posted was more than enough. It also encourages them to look at how to use that code, rather than just blindly paste "answers" and "fixes".
Doing it via this method will allow the player to look around, wait for things to occur, and decide for themselves to get out.
Re: Non driveable vehicle -
Arxalan - 30.01.2015
Thanks all but there was a bug as i posted it . So i was in need of this function but i solved the bug so now don't need this function anymore.
Once Again Thanks to all.