29.01.2015, 09:52
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.
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);}
}
pawn Код:
|
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;
}
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.
|
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. |
I need to know the situation in which he wants to use this function to post a proper code.
|