Loop doesn't get run properly
#2

return in a loop breaks it, do it like that
forward RespawnAllCars();
PHP код:
public RespawnAllCars() 

    for(new 
i=0i<cache_get_row_count(); i++) 
        { 
        new 
vid cache_get_field_content_int(i"id"); 
        if(!
IsVehicleOccupied(vid)) && (strcmp(Vehicle[vid][vOwner], "Nobody")) ReloadVehicle(vid); 
         } 
    
SendClientMessageToAll(-1,"{FFC300}Unoccupied vehicles have been respawned."); 
    return 
1

And i don't think you really need a query for it, use GetVehiclePoolSize better
PHP код:
public RespawnAllCars() 

    for(new 
i=0j=GetVehiclePoolSizei<ji++) 
        { 
        if(!
IsVehicleOccupied(i)) && (strcmp(Vehicle[i][vOwner], "Nobody")) ReloadVehicle(i); 
         } 
    
SendClientMessageToAll(-1,"{FFC300}Unoccupied vehicles have been respawned."); 
    return 
1

Reply


Messages In This Thread
Loop doesn't get run properly - by justjamie - 14.08.2016, 10:07
Re: Loop doesn't get run properly - by Shinja - 14.08.2016, 11:49

Forum Jump:


Users browsing this thread: 2 Guest(s)