Strange problem with OnPlayerEnterVehicle
#1

This script works when its under OnPlayerStateChange:
PHP код:
    if(newstate == 2)
    {
        new 
CarCheck GetPlayerVehicleID(playerid);
        if(
CarCheck == Cars[Taxi1] || CarCheck == Cars[Taxi2] || CarCheck == Cars[Taxi3] || CarCheck == Cars[Taxi4] || CarCheck == Cars[Taxi5] || CarCheck == Cars[Taxi6] || CarCheck == Cars[Taxi7] || CarCheck == Cars[Taxi8] || CarCheck == Cars[Taxi8] || CarCheck == Cars[Taxi9] || CarCheck == Cars[Taxi10] || CarCheck == Cars[Taxi11] || CarCheck == Cars[Taxi12] || CarCheck == Cars[Taxi13] || CarCheck == Cars[Taxi14] || CarCheck == Cars[Taxi15] || CarCheck == Cars[Taxi16] || CarCheck == Cars[Taxi17] )
        {
            if(
PlayerInfo[playerid][pJob] != JOB_TAXIDRIVER)
            {
            
RemovePlayerFromVehicle(playerid);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the Taxi Drivers.");
            return 
1;
            }
        }
        new 
CarCheck2 GetPlayerVehicleID(playerid);
        if(
CarCheck2 == Cars2[Mech1] || CarCheck2 == Cars2[Mech2] || CarCheck2 == Cars2[Mech3] || CarCheck2 == Cars2[Mech4] || CarCheck2 == Cars2[Mech5] )
        {
            if(
PlayerInfo[playerid][pJob] != JOB_MECHANIC)
            {
            
RemovePlayerFromVehicle(playerid);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the Mechanics.");
            return 
1;
            }
        }
    } 
But when i put it under OnPlayerEnterVehicle it dont work(I remove the line if(newstate == 2))
Reply
#2

That's because OnPlayerEnter vehicle is called when player starts to enter vehicle, so you can't remove him from vehicle, because he isn't in vehicle.
Reply
#3

But i changed the thing to:
Quote:

new Floatos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SetPlayerPos(playerid, pos[0], pos[1], pos[2]);

and it dont works
Reply
#4

Or you can try ClearAnimations(playerid); under OnPlayerEnterVehicle..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)