SA-MP Forums Archive
Vehicle locked after respawn [0.3c] - 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: Vehicle locked after respawn [0.3c] (/showthread.php?tid=211485)



Vehicle locked after respawn [0.3c] - Axuj - 15.01.2011

Hello, i have a little problem with SetvehicleParamsEx.

After respawn vehicle gets locked, i can enter it, but i have a code which remove player from vehicle if vehicle is locked. Can anyone help me?

pawn Код:
public OnVehicleSpawn(vehicleid)
{
    new engine, lights, alarm, doors, boot, boonet, objective;

    GetVehicleParamsEx( vehicleid, engine, lights, alarm, doors, boot, boonet, objective );
    SetVehicleParamsEx( vehicleid, 0, 0, 0, 0, 0, 0, 0 );
   
    vehicleDB[ vehicleid ][ gyv ] = 1000.0;
    vehicleDB[ vehicleid ][ gas ] = 40;
    return 1;
}



Re: Vehicle locked after respawn [0.3c] - Toreno - 15.01.2011

Show me how it removes player out of the vehicle.


Re: Vehicle locked after respawn [0.3c] - Axuj - 15.01.2011

pawn Код:
if ( newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER )
    {
        new vehicleid = GetPlayerVehicleID( playerid );
        new engine, lights, alarm, doors, bonnet, boot, objective;

        GetVehicleParamsEx( vehicleid, engine, lights, alarm, doors, bonnet, boot, objective );
        if ( doors )
        {
            RemovePlayerFromVehicle( playerid );
        }
    }
This code placed in OnPlayerStateChange public function.


Re: Vehicle locked after respawn [0.3c] - Toreno - 15.01.2011

Try this;
pawn Код:
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    new engine,lights,alarm,doors,boot,boonet,objective;
    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,boot,boonet,objective);
    if(doors == 1) RemovePlayerFromVehicle( playerid );
}



Re: Vehicle locked after respawn [0.3c] - Axuj - 15.01.2011

Nothing. I have a code, which checks the locked cars, and after respawn this car is locked, but i can't understand why. BTW now i can't enter vehicle after respawn.


Re: Vehicle locked after respawn [0.3c] - Axuj - 15.01.2011

Ok, i have it just made a timer after respawn to unlock, thanks.