MySQL problem
#1

Hello, i have like 60 cars in my MySQL when i try add more they wont load it

here is the load code

pawn Код:
forward LoadCityCars();
public LoadCityCars()
{
    mysql_query("SELECT * FROM Vehicles ORDER BY carid");
    mysql_store_result();
    new data[11][512];
    new string[1024];
    while(mysql_fetch_row(string,"|"))
    {
        //if(mysql_num_rows() == 0) continue;
        split(string, data, '|');
        //printf(string);
        new Carid = CreateVehicle(strval(data[1]), floatstr(data[2]), floatstr(data[3]), floatstr(data[4]), floatstr(data[5]), strval(data[6]), strval(data[7]), 60000);
        DynamicCars[Carid][FactionCar] = strval(data[8]);
        DynamicCars[Carid][CarType] = strval(data[9]);
        strmid(DynamicCars[Carid][cDescription], data[10], 0, strlen(data[10]), 255);
        SetVehicleNumberPlate(Carid, "XMT 3432");
        SetVehicleToRespawn(Carid);
        if(Carid == IBPCARS)
        {
            mysql_free_result();
            return 0;
        }
    }
    return 1;
}
Reply
#2

Well this statement here:

pawn Код:
if(Carid == IBPCARS)
{
    mysql_free_result();
    return 0;
}
Will cause the loop to end prematurely if the condition is met, so what is the value of IBPCARS and do you think that this statement can be true before the end of the loop?

In fact, why do you have it in the first place?
Reply
#3

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
Well this statement here:

pawn Код:
if(Carid == IBPCARS)
{
    mysql_free_result();
    return 0;
}
Will cause the loop to end prematurely if the condition is met, so what is the value of IBPCARS and do you think that this statement can be true before the end of the loop?

In fact, why do you have it in the first place?
My friend helped me with script the loadcar in my MySQL.
Reply
#4

Okay, but that doesn't answer my question.

Is there a reason it's there? It's possibly (and probably) what's causing the interference, so if there is no reason that it's there, simply remove it!
Reply
#5

No, there is no reason why it's there, i will try.

Yes, have i reason cus when i remove it, then the script goes crazy.
Reply
#6

Quote:
Originally Posted by N0FeaR
Посмотреть сообщение
No, there is no reason why it's there, i will try.

Yes, have i reason cus when i remove it, then the script goes crazy.
What do you mean it goes crazy? That doesn't help anyone solve anything.
Reply
#7

I can complie without erros but all objects in game just disappear

when i add this again the objects come back

pawn Код:
if(Carid == IBPCARS)
{
    mysql_free_result();
    return 0;
}
Reply
#8

Quote:
Originally Posted by N0FeaR
Посмотреть сообщение
I can complie without erros but all objects in game just disappear

when i add this again the objects come back

pawn Код:
if(Carid == IBPCARS)
{
    mysql_free_result();
    return 0;
}
Well what is IBPCARS? What value does it hold?
Reply
#9

Nvm is fixed now, thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)