Respawn vehicles
#5

pawn Code:
RespawnNearbyVehicles(playerid, Float:radi) {
  new Float:x, Float:y, Float:z;
  GetPlayerPos(playerid, x, y, z);
  for(new i = 1; i < MAX_VEHICLES; i++) {
    if(GetVehicleModel(i)) {
      new Float:posx, Float:posy, Float:posz;
      new Float:tempposx, Float:tempposy, Float:tempposz;
      GetVehiclePos(i, posx, posy, posz);
      tempposx = (posx - x);
      tempposy = (posy - y);
      tempposz = (posz - z);
      if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) {
        SetVehicleToRespawn(i);
      }
    }
  }
}
pawn Code:
// Implement the rest of the code. For now everyone can use the command.
CMD:respawnnearbyvehicles(playerid, params[]) {
  for(new i = 0; i < MAX_VEHICLES; i++) {
    RespawnNearbyVehicles(playerid, 10); // Edit the radius if its not appropriate.
  }
  return 1;
}
Credits to MadeMan for the RespawnNearbyVehicles.
Reply


Messages In This Thread
Respawn vehicles - by Koreadars - 15.04.2019, 09:49
Re: Respawn vehicles - by Koreadars - 15.04.2019, 13:03
Re: Respawn vehicles - by AmirSavand - 15.04.2019, 15:10
Re: Respawn vehicles - by Koreadars - 15.04.2019, 15:12
Re: Respawn vehicles - by polygxn - 15.04.2019, 15:22
Re: Respawn vehicles - by Koreadars - 15.04.2019, 16:31

Forum Jump:


Users browsing this thread: 1 Guest(s)