OnPlayerStateChange :S
#1

Hey all im working with my friend on a stunt script but ive created this
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new playerState = GetPlayerState(playerid);
    
    if (playerState == PLAYER_STATE_PASSENGER)
    {
	if(IsPlayerInVehicle(playerid, 459))
		{
		SetPlayerPos(playerid,1879.9384,-1397.2222,13.5703);
	}
	}
	return 1;
}
thats for when i enter a car (Berkleys RC Van = id 459) with g
then he teleports to a place
but this does nothin and if i remove
Код:
    if (playerState == PLAYER_STATE_PASSENGER)
then i can teleport with all cars on G :S
whats wrong with this?

Ty for helping!

-luckie12
Reply
#2

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if (newstate == PLAYER_STATE_PASSENGER)
    {
        if(IsPlayerInVehicle(playerid, 459)) SetPlayerPos(playerid,1879.9384,-1397.2222,13.5703);
    }
    return 1;
}
Btw that ID is the vehicleid not the vehiclemodel.

Edit: For model you can use something like this:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if (newstate == PLAYER_STATE_PASSENGER)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 459) SetPlayerPos(playerid,1879.9384,-1397.2222,13.5703);
    }
    return 1;
}
Reply
#3

Thankyou! it works fine! ty ty ty
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)