View Single Post
Old 31/01/2020, 09:15 PM   #5
OsmanMalagic
Little Clucker
 
Join Date: Jul 2016
Location: EX-YU
Posts: 40
Reputation: 51
Default Re: MySQL load vehicles issue

Quote:
Originally Posted by Vizi10 View Post
So,
pawn Code:
for(new j = 1; j < sizeof(CarInfo); j++)
i think this must be
pawn Code:
foreach(new j : Vehicle)
//or
for(new j = 1; j < GetVehiclePoolSize(); j++)

CarInfo new like this?:
pawn Code:
new CarInfo[MAX_VEHICLES][CarEnum];
Right?

Your second mistake is use break;
This break the loop and not continue and car id in database right but in server diffrent ids...
If i delete break; Server spawn me 1000 same vehicles in my area, which cause massive lag.
Of course i use
PHP Code:
new CarInfo[600][cInfo]; 
My old loading sistem on y_ini going like this

PHP Code:
for(new 1sizeof(CarInfo); h++)
    {
        new 
vstr[40];
           
format(vstrsizeof(vstr), "NBCRP/Vehicles/%d.ini"h);
        if(
fexist(vstr))
        {
            
INI_ParseFile(vstr"LoadVehicles", .bExtra true, .extra h);
            if(
CarInfo[h][cOwned] == || CarInfo[h][cModel] == 0)
            {
                
CarInfo[h][cID] = NBC_CreateVehicle(510, -804.53843791.850639.4313+hCarInfo[h][cAngle], CarInfo[h][cColorOne], CarInfo[h][cColorTwo], 60000);
            }
            else
            {
                
CarInfo[h][cID] = NBC_CreateVehicle(CarInfo[h][cModel], CarInfo[h][cLocationx], CarInfo[h][cLocationy], CarInfo[h][cLocationz]+1.0CarInfo[h][cAngle], CarInfo[h][cColorOne], CarInfo[h][cColorTwo], 60000);
            }
        }
    } 
OsmanMalagic is offline   Reply With Quote