22.02.2018, 19:07
hey, i got a GetClosestCar stock and when i try to respawn the car it's say that is respawning car 1999 every time.
GetClosestCar:
Command:
GetClosestCar:
Код:
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; }
Код:
CMD:closestcar(playerid, params[]) { if(pInfo[playerid][pLogged] == 0) return SCM(playerid, COLOR_GREY, ConnectFirst); if(pInfo[playerid][pAdmin] > 0) { new vehid, str[255]; vehid = GetClosestVehicle(playerid, 5); SetVehicleToRespawn(vehid); format(str, sizeof(str), ""w"( "dr"Admin Info "w") Admin %s has respawned vehicle %d.", pInfo[playerid][pName], vehid); ABroadCast(COLOR_WHITE, str, 1); format(str, sizeof(str), "Vehicle %d has been respawned.", vehid); SCM(playerid, COLOR_WHITE, str); } return 1; }