Repair vehicle from behind.
#1

Hi, I'm trying to make a /repair command that you need to be behind the car to repair it. Sort of like CrazyBob's /vehrepair command. Thx!
Reply
#2

So? this is scripting help section, not a request forum..
Reply
#3

Quote:
Originally Posted by PMH
Посмотреть сообщение
So? this is scripting help section, not a request forum..
No need to be a dick, nowhere did he say he was asking for a command, he was asking how to do it.

My guess would be to use GetVehiclePos, which will get the center of the vehicle. Then you'll need to create an object and attach it to near the back with AttachObjectToVehicle. Take the Y parameter (say it's 1) then use if(IsPlayerInRangeOfPoint(playerid, X, Y-1, Z)
{

etc.
Reply
#4

Quote:
Originally Posted by TakeiT
Посмотреть сообщение
No need to be a dick, nowhere did he say he was asking for a command, he was asking how to do it..
Agreed, took it wrong way..
Reply
#5

Is there a function I could use to make it more simple? I saw it on a thread, but I cannot find it now
Reply
#6

for what TakeIT has stated i made this stock function using his idea.. it may work or may not..

pawn Код:
stock IsPlayerNearVehicle(playerid, vehid)
{
    new Float:X, Float:Y, Float:Z;
    GetVehiclePos(vehid, X, Y, Z);
    IsPlayerInRangeOfPoint(playerid, 2, X, Y-2, Z) return 1;
    return 0;
}
Reply
#7

The IsPlayerInRangeOfPoint should be 2 instead of 10, maybe even 1
Reply
#8

Quote:
Originally Posted by Joe Staff
Посмотреть сообщение
You can try this
pawn Код:
stock IsPlayerInFrontVehicle(playerid,vehicleid,Float:radius,Float:vehiclelength)
{
  new Float:x,Float:y,Float:z,Float:a;
  GetVehiclePos(vehicleid, x, y, z);
  GetPlayerFacingAngle(vehicleid, a);
  x += (vehiclelength* floatsin(-a, degrees));
  y += (vehiclelength* floatcos(-a, degrees));
  return IsPlayerInRangeOfPoint(playerid,radius,x,y,z);
}
'vehiclelength' would be the distance between the middle of the car to the front/back of it. (In your case you would set this to a negative number, i.e. -4.0)
'radius' would be the area of the spot inwhich the player must be. (i.e. 3.0)
That could help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)