This command, edit
#1

Edit the command:

Код:
forward VehicleToPlayer(playerid,vehicleid);
public VehicleToPlayer(playerid,vehicleid)
{
        new Float:pX,Float:pY,Float:pZ,Float:cX,Float:cY,Float:cZ,Float:distance;
        GetPlayerPos(playerid,pX,pY,pZ);
        GetVehiclePos(vehicleid,cX,cY,cZ);
        distance = floatsqroot(floatpower(floatabs(floatsub(cX,pX)),2) + floatpower(floatabs(floatsub(cY,pY)),2) + floatpower(floatabs(floatsub(cZ,pZ)),2));
        return floatround(distance);
}
 
forward GetClosestVehicle(playerid);
public GetClosestVehicle(playerid)
{
        new Float:distance = 99999.000+1,Float:distance2,result = -1;
        for(new i = 0; i < MAX_VEHICLES; i++)
        {
            distance2 = VehicleToPlayer(playerid,i);
            if(distance2 < distance)
            {
                distance = distance2;
                result = i;
                }
        }
        return result;
}

if(strcmp(cmdtext, "/towcar", true) == 0)
	{
		new closest = GetClosestVehicle(playerid);
		if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 525)
		{
			if(VehicleToPlayer(playerid, closest) < 10)
	        {
				AttachTrailerToVehicle(closest, GetPlayerVehicleID(playerid));
				return 1;
			}
			return 1;
		}
		return SendClientMessage(playerid, 0xFF0000FF, "You are not in a TOW TRUCK!");
	}
Not lift a car with TOW TRUCK in my RP
Reply


Messages In This Thread
This command, edit - by Join7 - 07.10.2011, 20:31
Re: This command, edit - by Join7 - 08.10.2011, 10:56
Re: This command, edit - by Join7 - 09.10.2011, 11:36
Re: This command, edit - by Wesley221 - 09.10.2011, 11:39
Re: This command, edit - by aRoach - 09.10.2011, 12:27

Forum Jump:


Users browsing this thread: 1 Guest(s)