[help]Player into vehicle as passenger
#1

how to make a player enter only as a passenger in to a vehicle?
Reply
#2

try that with PLAYER_STATE_PASSENGER

https://sampwiki.blast.hk/wiki/Playerstates
Reply
#3

I don't correctly understand that, but i do get it to a level.
check if my code is correct"
Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
  new string[100];
  format(string, sizeof(string), "You entered the vehicle!",1,6);
  SendClientMessage(playerid,0xFFFFFFFF,string);
  return 1;
}
Reply
#4

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  if(newstate == PLAYER_STATE_DRIVER)
{
	if(( gTeam[playerid] == TEAM_CIVIL) && (GetVehicleModel(GetPlayerVehicleID(playerid)) == 598))
{
  RemovePlayerFromVehicle(playerid);
  SetPlayerWantedLevel( playerid, GetPlayerWantedLevel( playerid )+1 );
  GameTextForPlayer(playerid, "~r~This vehicle belongs to L.V.P.D.", 3500, 3);
}
}
return 1;
}
i hope this code will help you.
Reply
#5

Well let me explain completely what i need.
I want to make a train script. It checks when the player enters a command, /entrain - it should check if the player has got the pickup 'ticket'. If not it must say you are not allowed it enter. If he has it will allow the player to enter the vehicle as a passenger.
Reply
#6

below #include <a_samp>

add that
Код:
new trainticket[MAX_PLAYERS];
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(newstate == PLAYER_STATE_PASSENGER)
	{
		if(GetVehicleModel(GetPlayerVehicleID(playerid) == 570))//Streak Trailer (Train)
		{
			if(trainticket[playerid] == 1)
			{
			trainticket[playerid] = 0;//takes the player ticket
			SendClientMessage(playerid,0xFFFF00AA,"Welcome to the Brownstreak (Train) sir!");
			}
		}
		else
		{
		SendClientMessage(playerid,0xFF0000AA,"You can not enter in train sir, you have not a ticket!");
		RemovePlayerFromVehicle(playerid);
		}
	}
	return 1;
}
i have not tested that but i think works!!

i hope help you
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)