22.03.2014, 18:49
Hello, so I have been given a script to rid of all bugs and I have come accross one, when ever I need to read a vehicle from a Database and spawn the car once a player has spawned, it does not do this. I know the error is not with the spawning because I made a command to run the function. I have given this 2 days to think and look at and not I have to come and ask all you nice people for help.
Here is the code:
That is all the code where the errors should be happening, here is a screen shot of the DB where is is being loaded:
I hope someone can help!
Here is the code:
Код:
stock LoadPlayerVehicles(playerid) { format(query, sizeof(query), "SELECT * FROM `ownedvehicles` WHERE `owner` = '%s'", GetName(playerid)); mysql_function_query(dbHandle, query, true, "SpawnPlayerVehicles", "i", playerid); return 1; } stock SpawnPlayerVehicles(playerid) { //new createcar = AddStaticVehicleEx(VehicleInfo[vehicleid][carModel], VehicleInfo[vehicleid][carParkX], VehicleInfo[vehicleid][carParkY], VehicleInfo[vehicleid][carParkZ] VehicleInfo[vehicleid][carParkA], 0, 0, -1); new rows, fields, total = 0; cache_get_data(rows, fields); if(rows) { while(total < rows) { new modelid, Float:parkx, Float:parky, Float:parkz, Float:parka, color1, color2; modelid = cache_get_row_int(total, 2); parkx = cache_get_row_int(total, 5); parky = cache_get_row_int(total, 6); parkz = cache_get_row_int(total, 7); parka = cache_get_row_int(total, 8); color1 = cache_get_row_int(total, 3); color2 = cache_get_row_int(total, 4); CreateVehicle(modelid, parkx, parky, parkz, parka, color1, color2, -1); } } return 1; }
I hope someone can help!