09.06.2015, 21:37
How can I make the order/repair work just in front of a vehicle
Код:
if(strcmp(cmd, "/repair", true) == 0) { if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14) { ApplyAnimation(playerid,"CAR", "Fixn_Car_Loop",4.1,1,1,1,1,10000); new vehicleid = GetRepairCar(playerid); SetVehicleHealth(vehicleid, 1000.0); RepairVehicle(vehicleid); } return 1; }
Код:
stock GetRepairCar(playerid) { new Float:x, Float:y, Float:z; new Float:dist, Float:closedist=9999, closeveh; for(new i=1; i < MAX_VEHICLES; i++) { if(GetVehiclePos(i, x, y, z)) { dist = GetPlayerDistanceFromPoint(playerid, x, y, z); if(dist < closedist) { closedist = dist; closeveh = i; } } } return closeveh; }