14.12.2014, 17:58
Код:
if(newkeys & KEY_SUBMISSION) { if(jobs[playerid] == 11) { new car = GetPlayerVehicleID(playerid); new car2 = GetClosestVehicle(playerid, 100); if(Benzin[car] < 1) return SCM(playerid,-1,"Toto auto mб vнc jak 1 litr nemůћeљ ho vzнt!"); if(car2 == -1) return SCM(playerid,-1,"Niesi v blнzkosti inйho auta"); AttachTrailerToVehicle(car2, car); } } return 1; } stock GetClosestVehicle(playerid, Float:range) { new Float:p_X; new Float:p_Y; new Float:p_Z; new Float:Distance; new Float:PretendentDistance = range +1; new Pretendent = -1; GetPlayerPos(playerid, p_X, p_Y, p_Z); for(new vehicleid=1; vehicleid < MAX_VEHICLES; vehicleid++) { Distance = GetVehicleDistanceFromPoint(vehicleid, p_X, p_Y, p_Z); if(Distance <= range && Distance <= PretendentDistance) { Pretendent = vehicleid; PretendentDistance = Distance; } } return Pretendent; }