SA-MP Forums Archive
OnPlayerStateChange :S - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerStateChange :S (/showthread.php?tid=207526)



OnPlayerStateChange :S - luckie12 - 06.01.2011

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


Re: OnPlayerStateChange :S - _rAped - 06.01.2011

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;
}



Re: OnPlayerStateChange :S - luckie12 - 06.01.2011

Thankyou! it works fine! ty ty ty