SA-MP Forums Archive
Need help Rep+1 - 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)
+--- Thread: Need help Rep+1 (/showthread.php?tid=561534)



Need help Rep+1 - MBilal - 03.02.2015

How I can make if some one not close to the vehicles so he cant enter the vehicle
As Passenger and Even As Driver if he is not close to the vehicle Door..?


Re: Need help Rep+1 - Youssef221 - 03.02.2015

I don't understand what do you mean...


Re: Need help Rep+1 - MBilal - 03.02.2015

Like You see People Teleport Vehicles which are near to them and they are getting inside that vehicle as Drive..
So I want if some budy try to teleport vehicle he unable to teleport it.
I want he is far from the vehicle he cant teleport that that. any budy who are close to vehicle
only he can sit inside it as driver or as passenger.


Re: Need help Rep+1 - CalvinC - 03.02.2015

Get the coordinates of the vehicle, and check if the player is in a certain range with IsPlayerInRangeOfPoint, if he's too far away, then use GetPlayerPos, and use SetPlayerPos to his own position, which will make him stop.

EDIT: Just saw your new post, there's an include or something against that, i can't find it again though.


Re: Need help Rep+1 - Youssef221 - 03.02.2015

You mean when players try to enter the vehicle while the vehicle moving far away, they enter the vehicle, is this what do you mean?


Re: Need help Rep+1 - MBilal - 03.02.2015

Код:
	
        new Float:vehx, Float:vehy, Float:vehz;
 	GetVehiclePos(GetPlayerVehicleID(playerid), vehx, vehy, vehz);
	new Float: Distance = GetPlayerDistanceFromPoint(playerid, vehx, vehy, vehz);//if player is not close to vehicle x , y ,z..
	if(Distance>15.0)//it will check the distance here.. if distance is larger then he removed from vehicle !
	{
      RemovePlayerFromVehicle(playerid);
      new Float:slx, Float:sly, Float:slz;
      GetPlayerPos(playerid, slx, sly, slz);
      SetPlayerPos(playerid, slx, sly, slz);
	}
	

What should i do now
You mean when players try to enter the vehicle while the vehicle moving far away, they enter the vehicle, is this what do you mean?

Listen my mean is simple if player is not close to any vehicle he cant enter them..


Re: Need help Rep+1 - CalvinC - 03.02.2015

So what's the problem in that script?


Re: Need help Rep+1 - MBilal - 03.02.2015

where should I use these codes Under OnPlayerEnterVehicle?


Re: Need help Rep+1 - CalvinC - 03.02.2015

Yes, use it under OnPlayerEnterVehicle.


Re: Need help Rep+1 - MBilal - 04.02.2015

Is This Code Stop The Car Teleporting thing? which I maked?