these states do not work
#1

ID Macro Description
4 PLAYER_STATE_EXIT_VEHICLE Player exits a vehicle
5 PLAYER_STATE_ENTER_VEHICLE_DRIVER Player enters a vehicle as driver
6 PLAYER_STATE_ENTER_VEHICLE_PASSENGER Player enters a vehicle as passenger



I use this code..

public OnPlayerStateChange(playerid, newstate, oldstate)
{
fVehSpeed[playerid] = 0.0;
if(newstate == 4)
{
SCM(playerid,-1,"sales del vehiculo");
}
if(newstate == 5)
{
SCM(playerid,-1,"entras del vehiculo conductor");
}
if(newstate == 6)
{
SCM(playerid,-1,"entras al vehiculo pasajero");
}
return 1;
}


But i didn't receive this messages, why?
Reply
#2

I think you have to check the oldstate as well.
Reply
#3

Try something like:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    fVehSpeed[playerid] = 0.0;
    if(oldstate != 4 && newstate == 4)
    {
        SCM(playerid,-1,"sales del vehiculo");
    }
    if(oldstate != 5 && newstate == 5)
    {
        SCM(playerid,-1,"entras del vehiculo conductor");
    }
    if(oldstate != 6 && newstate == 6)
    {
        SCM(playerid,-1,"entras al vehiculo pasajero");
    }
    return 1;
}
Reply
#4

Nothing
Reply
#5

Add a print to debug what's happening.

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    printf("%d - %d", newstate, oldstate);
    fVehSpeed[playerid] = 0.0;
    if(oldstate != 4 && newstate == 4)
    {
        SCM(playerid,-1,"sales del vehiculo");
    }
    if(oldstate != 5 && newstate == 5)
    {
        SCM(playerid,-1,"entras del vehiculo conductor");
    }
    if(oldstate != 6 && newstate == 6)
    {
        SCM(playerid,-1,"entras al vehiculo pasajero");
    }
    return 1;
}
Then check and see what it inputs on the server console when you change into the certain states.
Reply
#6

2 -1
1 - 2

PLAYER_STATE_DRIVER and PLAYER_STATE_ONFOOT
Reply
#7

I just did some debugging, and 3 is passenger, and 2 is driver, and 1 is onfoot. So don't use 4, 5 or 6. Hope that helps with what you want to do.
Reply
#8

I needed a function of when exit the vehicle and when enter, but i did make a function for this, well thanks
Reply
#9

If oldstate 2, and newstate 1 then player has exited the vehicle.
If oldstate 1, ad newstate 2, then player has entered vehicle as driver.
If oldstate 1, and newstate 3, then player has entered as passenger.
Reply
#10

They cannot be used in a script and as the description says "Used internally" only.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)