SA-MP Forums Archive
MySQL - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL (/showthread.php?tid=332687)



MySQL - N0FeaR - 09.04.2012

When i add cars into my MySQL they not come in game why?


Re: MySQL - Abreezy - 09.04.2012

Show us the loading codes?


Re: MySQL - N0FeaR - 09.04.2012

http://pastebin.com/5b6S33Yy


Re: MySQL - [HiC]TheKiller - 09.04.2012

I don't see any MySQL code in that snippet of code at all. It's all just dini, are you sure that's the right code?


Re: MySQL - N0FeaR - 09.04.2012

I dont find it, i will look again tomrrow.


Re: MySQL - Ezay - 09.04.2012

Lmao, I'm Tottally Lost with your Post?

A: You Need Help With Vehicles, But.. You Can't Find your Coding?

Sorry, But Somthing Seems Fishy


Re: MySQL - N0FeaR - 16.04.2012

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, "P:RP");
        SetVehicleToRespawn(Carid);
        if(Carid == PRCARS)
        {
            mysql_free_result();
            return 0;
        }
    }
    return 1;
}



Re: MySQL - N0FeaR - 17.04.2012

Anyone know the problem?


Re: MySQL - N0FeaR - 19.04.2012

BUMP this.


Re: MySQL - Thomas. - 19.04.2012

First of all, remove this line:

pawn Код:
if(mysql_num_rows() == 0) continue;
The while loop will not be executed if there are no rows to fetch (mysql_fetch_row will simply return false), so counting the rows while inside the loop is pointless. Not to mention the continue statement.


About the vehicles not loading, check what the result is of the CreateVehicle function, does it return a valid vehicle id?
Print the fetched data to see what's going on.