Need help.
#1

Hello. I'm trying to do if player exit vehicle he would be put in his last vehicle.. I do almost everything but I don't know how to but player in vehicle.. Here is the script

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(pInfo[playerid][Event][2] == true && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && pInfo[playerid][SfStuntLvl] == 1)
	{
		SetPlayerPos(StuntVeh, -1683.7195,551.2001,38.0144);
		SetPlayerFacingAngle(StuntVeh, 316.9490);
           PutPlayerInVehicle(playerid, veh.., 0);
	}
	return 1;
}
With player pos all good.. Server sets pos in these coords..
Reply
#2

Use this:
pawn Код:
//global
new gPrevVehicle[ MAX_PLAYERS ];
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
  gPrevVehicle[ playerid ] = vehicleid;
  return true;
}
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate) //If this code doesn't work, use the next code
{
  if( oldstate == PLAYER_STATE DRIVER && newstate == PLAYER_STATE_ONFOOT )
    PutPlayerInVehicle( playerid, gPrevVehicle[ playerid ], 0 );
  return true;
}
That should work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)