OnPlayerStateChange won't trigger.
#1

So i have this code:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
        if( newstate != PLAYER_STATE_PASSENGER && newstate != PLAYER_STATE_DRIVER )
        {
            StopAudioStreamForPlayer(playerid);
        }
        if( newstate == PLAYER_STATE_PASSENGER || newstate == PLAYER_STATE_DRIVER )
        {
                        PlayAudioStreamForPlayer( playerid, "radiolink" );
    }
     return 1;
}
When i enter a vehicle (passenger or driver) the callback is called and the music starts. But when i teleport out of the vehicle the music won't stop.

I tried to check the states with
pawn Код:
if( newstate == PLAYER_STATE_ONFOOT )
{
    StopAudioStreamForPlayer(playerid);
}
if( oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER )
{
    StopAudioStreamForPlayer(playerid);
}
but still nothing. The State is changing, i verified, but the callback isn't triggering when i change from driver or passenger to onfoot.
pawn Код:
CMD:getstate(playerid, params[])
{
        new string[10];
        format(string, sizeof(string), "%d", GetPlayerState(playerid));
        SendClientMessage(playerid, COLOR_WHITE, string);
        return 1;
}
Any ideas?
Reply


Messages In This Thread
OnPlayerStateChange won't trigger. - by Koala818 - 01.06.2014, 20:05
Re: OnPlayerStateChange won't trigger. - by Eth - 01.06.2014, 20:25
Re: OnPlayerStateChange won't trigger. - by Koala818 - 01.06.2014, 20:29
Re: OnPlayerStateChange won't trigger. - by Koala818 - 08.06.2014, 18:39
Re: OnPlayerStateChange won't trigger. - by Threshold - 09.06.2014, 02:02
Re: OnPlayerStateChange won't trigger. - by Koala818 - 10.06.2014, 21:18
Re: OnPlayerStateChange won't trigger. - by Lynn - 10.06.2014, 21:23
Re: OnPlayerStateChange won't trigger. - by Koala818 - 10.06.2014, 21:36

Forum Jump:


Users browsing this thread: 1 Guest(s)