Enter Vehicle Problem
#1

Hi there ! I want to know how can I make a restriction for players to enter into a faction/job vehicle.
For the moment, i am using ONPLAYERSTATECHANGE and REMOVEPLAYERFROMVEHICLE to check if he is in that factions or job and then he is ejected from that vehicle. But, I want to make something, when he press F or ENTER to send directly that message and deny to enter in that vehicle. I hope that you understood. Sorry for my english.
Reply
#2

Use OnPlayerEnterVehicle
PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    if(
IsAFactionVehicle && PlayerFaction != CarFaction && !ispassenger// Example. Put your code here to check the vehicle and player.
    
{
         
ClearAnimations(playerid);
         
SendClientMessage(playerid, -1"This vehicle is restricted.");
     }
     return 
true;

Reply
#3

Thanks a lot !
Reply
#4

No, it doesn't work. Same problem. The player can entry in a vehicle and after he is eject+interdiction. I want to make something to show directly the interdiction message.

PS: I used ClearAnimations(playerid); after check if the player is in that faction/job or not.
Reply
#5

-REMOVED-
Reply
#6

Can you show your actually code?
Reply
#7

Код HTML:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	new newcar = GetPlayerVehicleID(playerid);
    if(PlayerData[playerid][pGroup] != vehicleVariables[newcar][vVehicleGroup])
	{
				format(szMessage, sizeof(szMessage), "You can't drive this vehicle.");
				SendClientMessage(playerid, COLOR_GREY,szMessage);
			    ClearAnimations(playerid);
	}
	return 1;
}
Reply
#8

Instead of "ClearAnimations", you should use "RemovePlayerFromVehicle"
Reply
#9

You didn't even give the order to remove the player out of the vehicle, you cleared the animations, Which totally won't reject the player from the car, Use "RemovePlayerFromVehicle" as Dayrion said..
Reply
#10

You misunderstand. I don't wanna remove a player from vehicle after he entry in it. I want to make a system to restrict the entry if it's a job/groupid car. What you said above doesn't help me. That thing will remove the player from vehicle after he is in it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)