OnPlayerEnterVehicle
#1

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    GameTextForPlayer(playerid,"~w~Text",4000,3);
    return 1;
}
Why it shows the text directly when i press enter or F ? how to make it show when the player finish to get into the car ??
Reply
#2

Put it under OnPlayerStateChange, by using

pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
Edit: Look at the post below for a better example, I'm on my phone at the moment so can't give a full example.
Reply
#3

Try this:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) // Player entered a vehicle as a driver
    {
        GameTextForPlayer(playerid,"~w~Text",4000,3);
    }
    return 1;
}
Reply
#4

thanks both, but if this is the solution, so what's the usage of OnPlayerEnterVehicle callback?
Reply
#5

It's called when a player tries to enter a vehicle that way you can send the message if say it's a faction police car.
Reply
#6

OnPlayerEnterVehicle is called directly when someone pressed F at a car, it's an old callback, before OnPlayerStateChange. But onentervehicle can be used for some things, not sure for what, maybe anti car jack, if someone is in the car, it would slap the guy trying to rob it.
Reply
#7

thanks all
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)