SA-MP Forums Archive
[help]Player into vehicle as passenger - 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: [help]Player into vehicle as passenger (/showthread.php?tid=120411)



[help]Player into vehicle as passenger - deather - 11.01.2010

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


Re: [help]Player into vehicle as passenger - Deat_Itself - 11.01.2010

try that with PLAYER_STATE_PASSENGER

https://sampwiki.blast.hk/wiki/Playerstates


Re: [help]Player into vehicle as passenger - deather - 11.01.2010

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



Re: [help]Player into vehicle as passenger - akis_tze - 11.01.2010

Код:
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.


Re: [help]Player into vehicle as passenger - deather - 12.01.2010

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.


Re: [help]Player into vehicle as passenger - akis_tze - 17.01.2010

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