Problem with loading from 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: Problem with loading from mysql (
/showthread.php?tid=327940)
Problem with loading from mysql -
Larry123 - 23.03.2012
Hello, i have this code:
Код:
public LoadCars()
{
new
sql[256],
Data[128]
;
format(sql, sizeof(sql), "SELECT * FROM `cars`");
mysql_query(sql);
new load = 0;
mysql_store_result();
while(mysql_retrieve_row())
{
mysql_fetch_field_row(Data, "Price"); CarInfo[load][Price] = strval(Data);
....
load++;
}
printf("Loaded %d cars", load);
}
In debug file everything is Ok, price is '500000', but when i use ingame command, which includes:
Код:
format( string, sizeof( string ), "Car Price: %d", CarInfo[GetPlayerVehicleID(playerid)][Price]);
SendClientMessage( playerid, -1, string );
Then the price is '0'
So, with one world, stats what i load from mysql is not in enum's.