D.M.V - Vehicles Bug
#1

Hello everyone !
I've tried to put some NRG's for DMV system, but something goes wrong.. I've tried to make something to remove player from vehicle if he/she dosen't take the license but doesn't work..
Cars:
pawn Код:
new dmvCar[6];
public OnGameModeInit()
{
    dmvCar[0] = AddStaticVehicle(522,1237.3453,-1811.9757,13.0060,270.1060,0,0); // nrg - st
    dmvCar[1] = AddStaticVehicle(522,1237.3505,-1814.8752,13.0018,270.1060,0,0); //
    dmvCar[2] = AddStaticVehicle(522,1237.3563,-1817.9918,12.9972,270.1059,0,0); //
    dmvCar[3] = AddStaticVehicle(522,1237.3616,-1820.9006,12.9930,270.1058,0,0); //
    dmvCar[4] = AddStaticVehicle(522,1237.3665,-1823.7605,12.9935,270.1081,0,0); // nrg - end
             return 1;
}
And here it's the state change and EnterVeh
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
        if(vehicleid >= dmvCar[0] && vehicleid <= dmvCar[5])
        {
            SendClientMessage(playerid,COLOR_AQUA,"You don't have the keys for this car !");
            RemovePlayerFromVehicle(playerid);
        }
    return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER) // Player entered a vehicle as a driver
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        SendClientMessage(playerid,COLOR_RED,"State changed from ON FOOT to DRIVER !");
    }
    return 1;
}
oh... and when I enter in a vehicle it send me that RED msg, from On foot to Driver.

Sorry for some gramatical mistakes
Reply
#2

OnPlayerEnterVehicle gets called before the player is in the actual vehicle so you cannot remove him from the vehicle at that callback. You have to use the OnPlayerStateChange part.
Reply
#3

ooh... now I got it tnx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)