Crash Help! +2REP
#5

pawn Код:
forward VehicleRespawn(playerid, vehicleid, ispassenger);
public VehicleRespawn(playerid, vehicleid, ispassenger)
{
    for(new i = 0; i < MAX_VEHICLES; i ++ )
    {
         for(new o = 0, a = GetMaxPlayers(); o < a; o ++ )
         {
                if(!IsPlayerConnected(o)) continue;
                if(IsAnyBodyInVehicle(i)) continue;
                if(CurrentSpawnedVehicle[i]) continue;
                GameTextForPlayer(playerid,"~r~Vehicles ~g~Respawn",5000,5);
                SendClientMessage(playerid, COLOR_BLUE, "{CFF55F}*INFO: {FFFFFF}Vehicle Respawn.");
                SetVehicleToRespawn(i);
                DestroyVehicle(CurrentSpawnedVehicle[i]);
         }
    }
    return 1;
}

stock IsAnyBodyInVehicle(vid)
{
      for(new i = 0; i < GetMaxPlayers(); i ++ )
      {
           if(IsPlayerInVehicle(i, vid)) return 1;
      }
      return 1;
}
Are you aware of the fact that you have a loop in a loop in a loop?


You do not need any of that shit. Stop thinking your script is "cool" and "unique." What you are going to do now is replace all of that shit with this:

pawn Код:
//.........
for(new i=0; i<=MAX_VEHICLES; i++) SetVehicleToRespawn(i);
//.....
Reply


Messages In This Thread
Crash Help! +2REP - by Aloushi - 26.06.2012, 09:58
Re: Crash Help! +2REP - by Skaizo - 26.06.2012, 10:11
Re: Crash Help! +2REP - by Aloushi - 26.06.2012, 10:16
Re: Crash Help! +2REP - by [MM]RoXoR[FS] - 26.06.2012, 11:49
Re: Crash Help! +2REP - by Grand_Micha - 26.06.2012, 11:52

Forum Jump:


Users browsing this thread: 3 Guest(s)