how people do not enter in this car ID
#5

Quote:
Originally Posted by w1z4rd
Посмотреть сообщение
As Jelly23 said it would be better to use callback, in your stock you dont have playerid so you would have to loop through every player on server so it would take a while.
Insted you could use something like this in OnPlayerEnterVehicle callback
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if(vehicleid==420 || vehicleid == 438)
	{
		RemovePlayerFromVehicle(playerid);
		// Or if he didn't enter already and is about to enter then it's an animation
		// then use ClearAnimations(playerid);
		return SendClientMessage(playerid, 0xFF0000FF, "You cant enter this vehicle");
	}   
}
Uh, why would you use RemovePlayerFromVehicle And the player isn't in a vehicle? Even the wiki provides a good example.

PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger) {
    if(
vehicleid==420 || vehicleid == 438)     {
        new 
Float:Pos[3];//Not Fast.
                
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]);
                
SetPlayerPos(playeridPos[0], Pos[1], Pos[2]);
                
SendClientMessage(playerid0xFF0000FF"You cant enter this vehicle");
        return 
true;
    } 
That's Preventing them from entering the vehicle. ( https://sampwiki.blast.hk/wiki/OnPlayerEnterVehicle ).

If you want the player to enter the vehicle then remove them, then you use, ( https://sampwiki.blast.hk/wiki/OnPlayerEnterVehicle ).
Reply


Messages In This Thread
how people do not enter in this car ID - by Jihanz - 24.03.2017, 10:18
Re: how people do not enter in this car ID - by Jelly23 - 24.03.2017, 11:02
Re: how people do not enter in this car ID - by w1z4rd - 24.03.2017, 11:24
Re: how people do not enter in this car ID - by Jihanz - 24.03.2017, 12:14
Re: how people do not enter in this car ID - by ISmokezU - 24.03.2017, 12:45
Re: how people do not enter in this car ID - by Mencent - 24.03.2017, 13:21
Re: how people do not enter in this car ID - by jasperschellekens - 24.03.2017, 14:03
Re: how people do not enter in this car ID - by Jihanz - 24.03.2017, 14:38

Forum Jump:


Users browsing this thread: 1 Guest(s)