20.05.2017, 06:12
thanks for the help. same thing.
but i noticed it doesnt return any vehicle ID now. it was doing yesterday and i changed nothing but add sendclientmessage since then.
ill re-write my code completly
EDIT : it give id 1999 ?? WTF
but i noticed it doesnt return any vehicle ID now. it was doing yesterday and i changed nothing but add sendclientmessage since then.
ill re-write my code completly
EDIT : it give id 1999 ?? WTF
Код:
if((newkeys & KEY_YES) && !(oldkeys & KEY_YES)) { new NearestVehicleID = GetClosestVehicle(playerid, 3.0); new string[128]; format(string, sizeof(string), "ID %i ", NearestVehicleID); SendClientMessage(playerid, -1, string);
Код:
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; 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; }