Non driveable vehicle
#1

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.
Reply
#2

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.
Reply
#3

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);}
}
Reply
#4

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.
Reply
#5

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.
Reply
#6

PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    new 
enginelightsalarmdoorsbonnetbootobjective;
    
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
    
SetVehicleParamsEx(vehicleid0lightsfalsedoorsbonnetbootobjective);
    return 
1;

Reply
#7

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.
Reply
#8

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.
Reply
#9

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.
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)