MYSQL Problem
#1

pawn Код:
case GROUPVEH_QUERY_LOAD: {
            while(g < MAX_GROUPS) {
                while(v < MAX_GROUP_VEHICLES) {
                    cache_get_field_content(iIndex, "GroupID", szResult, iConnectionHandle);
                    GroupVehicles[g][v][gGroupID] = strval(szResult);

                    cache_get_field_content(iIndex, "ModelID", szResult, iConnectionHandle);
                    GroupVehicles[g][v][gModelID] = strval(szResult);

                    cache_get_field_content(iIndex, "Colour1", szResult, iConnectionHandle);
                    GroupVehicles[g][v][gColour1] = strval(szResult);

                    cache_get_field_content(iIndex, "Colour2", szResult, iConnectionHandle);
                    GroupVehicles[g][v][gColour2] = strval(szResult);

                    cache_get_field_content(iIndex, "RankRequired", szResult, iConnectionHandle);
                    GroupVehicles[g][v][gVehRankReq] = strval(szResult);

                    cache_get_field_content(iIndex, "SpawnX", szResult, iConnectionHandle);
                    GroupVehicles[g][v][gVehSpawn][0] = floatstr(szResult);

                    cache_get_field_content(iIndex, "SpawnY", szResult, iConnectionHandle);
                    GroupVehicles[g][v][gVehSpawn][1] = floatstr(szResult);

                    cache_get_field_content(iIndex, "SpawnZ", szResult, iConnectionHandle);
                    GroupVehicles[g][v][gVehSpawn][2] = floatstr(szResult);

                    cache_get_field_content(iIndex, "SpawnA", szResult, iConnectionHandle);
                    GroupVehicles[g][v][gVehSpawn][3] = floatstr(szResult);

                    if(GroupVehicles[g][v][gModelID] != 0) {
                        GroupVehicles[g][v][gVehID] = CreateVehicle(GroupVehicles[g][v][gModelID], GroupVehicles[g][v][gVehSpawn][0], GroupVehicles[g][v][gVehSpawn][1], GroupVehicles[g][v][gVehSpawn][2], GroupVehicles[g][v][gVehSpawn][3], GroupVehicles[g][v][gColour1], GroupVehicles[g][v][gColour2], 3600);
                    }

                    g++;
                    v++;

                }
            }
        }
Is my code to load vehicles, it loads them but it loads the MAX_GROUPS which is 12.

So, basically - It find's the ONE car in the database, and loads it TWELVE times - The MAX_GROUPS is defined as 12, so must be that - But I don't know why it loads/spawns it 12 times?

pawn Код:
mysql_function_query(iConnectionHandle, "SELECT * FROM `groupvehicles`", true, "returnGroup_QueryFinish", "i", GROUPVEH_QUERY_LOAD);
load code ^^
Reply
#2

pawn Код:
while(g < MAX_GROUPS) { // MAX_GROUPS = 12
On line 2 there, it loops the vehicles 12 times.
Reply
#3

It fixed it.. sorta.. It now only loads the vehicle that is in ID 0(the first car) and it now loads the car 40 times because MAX_GROUP_VEHICLES is 40
Reply
#4

anyone
Reply
#5

I've tried everything here, it wont work ;/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)