05.10.2013, 00:01
(
Последний раз редактировалось Jerm; 05.10.2013 в 06:03.
)
So the issue I am having is cars that players own seem to get completely ruined on start up.
The script I am using has MySQL databases that stores the account info, also the perm cars placed around that are not owned by players and then finally the cars that players own.
What happens is the server starts up and when it reaches the cars it will load the perm cars from the sql first and loads them correctly (Keep in mind there are around 500 cars using many types, colors, locations). After that it starts to load the players cars and from what I can tell is it's starting to load them but then gets stuck on a certain vehicle and then uses that info over and over again for the rest of the cars.
For example:
3 or 4 people each purchased 3-7 vehicles a piece. All of them were different cars maybe a couple were the same between them all. They all had different vehicle ids and different paint jobs and /park locations. When the server is shutdown the sql database seems to be unchanged. Once I start the server it will begin loading and when reaching vehicles it will say the following:
- Loaded perm cars...
- loading player vehicle 1
- loading player vehicle 2
- loading player vehicle 3
- loading player vehicle 3
- loading player vehicle 3
- loading player vehicle 3
- loading player vehicle 3
- loading player vehicle 3
Once logging into the server I see that all the cars that were once different have all been given the stats of 1 or 2 of the bunch, in a way duplicating the car while over writing the real ones.
Also once this has happened I can go into the sql and see that the data has in fact been changed by this bug and the cars are permanently ruined and everyone must be refunded.
I would really appreciate any help I can get, I have been trying to just disable the game mode ownership system and use separate filterscripts but in the end it just creates more smaller bugs and doesn't seem like the right solution.
I am not a master at PAWN but learn fast and understand things easily. I have been working on this server and debugging it myself as well as adding things as I learn. This issue seems to be beyond me though, below I will post some of the MySQL coding and if anything else is needed to assist please let me know so I can post it as well.
Thanks for your time in advance.
Code:
On console during load:
[08:00:18] [OnGameModeInit] NPC loading... (if enabled).
[08:00:20] [OnGameModeInit] Permanent vehicles loading...
[08:00:20] Loading vehicle 867...
[08:00:20] Loading vehicle 867...
[08:00:20] Loading vehicle 867...
[08:00:20] Loading vehicle 867...
[08:00:20] Loading vehicle 867...
[08:00:20] Loading vehicle 867...
[08:00:20] Loading vehicle 867...
[08:00:20] Loading vehicle 867...
[08:00:20] Loading vehicle 867...
[08:00:20] Loading vehicle 868...
[08:00:20] Loading vehicle 869...
[08:00:20] Loading vehicle 870...
[08:00:20] Loading vehicle 879...
[08:00:20] Loading vehicle 880...
[08:00:20] Loading vehicle 881...
[08:00:20] Loading vehicle 882...
[08:00:20] [OnGameModeInit] Dealership vehicles loading...
[16:40:16] Authenticated successfully.
(Note that when Permanent vehicles load it does not show any info on console it only does that for the dealership vehicles above the 'Dealership vehicles loading...' prompt.)
Here is the loading codes for Perm and Player vehicles:
Stock for perm vehicles:
Stock for player vehicles:
IF ANYTHING ELSE IS NEEDED PLEASE LET ME KNOW! THANKS AGAIN!
The script I am using has MySQL databases that stores the account info, also the perm cars placed around that are not owned by players and then finally the cars that players own.
What happens is the server starts up and when it reaches the cars it will load the perm cars from the sql first and loads them correctly (Keep in mind there are around 500 cars using many types, colors, locations). After that it starts to load the players cars and from what I can tell is it's starting to load them but then gets stuck on a certain vehicle and then uses that info over and over again for the rest of the cars.
For example:
3 or 4 people each purchased 3-7 vehicles a piece. All of them were different cars maybe a couple were the same between them all. They all had different vehicle ids and different paint jobs and /park locations. When the server is shutdown the sql database seems to be unchanged. Once I start the server it will begin loading and when reaching vehicles it will say the following:
- Loaded perm cars...
- loading player vehicle 1
- loading player vehicle 2
- loading player vehicle 3
- loading player vehicle 3
- loading player vehicle 3
- loading player vehicle 3
- loading player vehicle 3
- loading player vehicle 3
Once logging into the server I see that all the cars that were once different have all been given the stats of 1 or 2 of the bunch, in a way duplicating the car while over writing the real ones.
Also once this has happened I can go into the sql and see that the data has in fact been changed by this bug and the cars are permanently ruined and everyone must be refunded.
I would really appreciate any help I can get, I have been trying to just disable the game mode ownership system and use separate filterscripts but in the end it just creates more smaller bugs and doesn't seem like the right solution.
I am not a master at PAWN but learn fast and understand things easily. I have been working on this server and debugging it myself as well as adding things as I learn. This issue seems to be beyond me though, below I will post some of the MySQL coding and if anything else is needed to assist please let me know so I can post it as well.
Thanks for your time in advance.
Code:
On console during load:
[08:00:18] [OnGameModeInit] NPC loading... (if enabled).
[08:00:20] [OnGameModeInit] Permanent vehicles loading...
[08:00:20] Loading vehicle 867...
[08:00:20] Loading vehicle 867...
[08:00:20] Loading vehicle 867...
[08:00:20] Loading vehicle 867...
[08:00:20] Loading vehicle 867...
[08:00:20] Loading vehicle 867...
[08:00:20] Loading vehicle 867...
[08:00:20] Loading vehicle 867...
[08:00:20] Loading vehicle 867...
[08:00:20] Loading vehicle 868...
[08:00:20] Loading vehicle 869...
[08:00:20] Loading vehicle 870...
[08:00:20] Loading vehicle 879...
[08:00:20] Loading vehicle 880...
[08:00:20] Loading vehicle 881...
[08:00:20] Loading vehicle 882...
[08:00:20] [OnGameModeInit] Dealership vehicles loading...
[16:40:16] Authenticated successfully.
(Note that when Permanent vehicles load it does not show any info on console it only does that for the dealership vehicles above the 'Dealership vehicles loading...' prompt.)
Here is the loading codes for Perm and Player vehicles:
Код:
LoadPermanentVehicles(); print("[OnGameModeInit] Permanent vehicles loading..."); LoadVehicles(); print("[OnGameModeInit] Dealership vehicles loading...");
Код:
stock LoadPermanentVehicles() { new data[64], query[128], vehicleid; for (new i = 1; i < MAX_VEHICLES; i++) { format(query, sizeof(query), "SELECT * FROM `permcars` WHERE `permcarid` = '%d'", i); mysql_query(query); mysql_store_result(); if (mysql_num_rows()) { while (mysql_retrieve_row()) { mysql_fetch_field_row(data, "permcarid"); PermanentVehicleStatistics[i][PermCarSQLID] = strval(data); mysql_fetch_field_row(data, "IsPermCar"); PermanentVehicleStatistics[i][IsPermCar] = strval(data); mysql_fetch_field_row(data, "PermCarModel"); PermanentVehicleStatistics[i][PermCarModel] = strval(data); mysql_fetch_field_row(data, "PermCarFaction"); PermanentVehicleStatistics[i][PermCarFaction] = strval(data); mysql_fetch_field_row(data, "PermCarX"); PermanentVehicleStatistics[i][PermCarX] = floatstr(data); mysql_fetch_field_row(data, "PermCarY"); PermanentVehicleStatistics[i][PermCarY] = floatstr(data); mysql_fetch_field_row(data, "PermCarZ"); PermanentVehicleStatistics[i][PermCarZ] = floatstr(data); mysql_fetch_field_row(data, "PermCarRot"); PermanentVehicleStatistics[i][PermCarRot] = floatstr(data); mysql_fetch_field_row(data, "PermCarColor1"); PermanentVehicleStatistics[i][PermCarColors][1] = strval(data); mysql_fetch_field_row(data, "PermCarColor2"); PermanentVehicleStatistics[i][PermCarColors][2] = strval(data); mysql_fetch_field_row(data, "PermCarFamily"); PermanentVehicleStatistics[i][PermCarFamily] = strval(data); mysql_fetch_field_row(data, "PermCarVIP"); PermanentVehicleStatistics[i][PermCarVIP] = strval(data); } vehicleid = AddStaticVehicleEx(PermanentVehicleStatistics[i][PermCarModel], PermanentVehicleStatistics[i][PermCarX], PermanentVehicleStatistics[i][PermCarY], PermanentVehicleStatistics[i][PermCarZ], PermanentVehicleStatistics[i][PermCarRot], PermanentVehicleStatistics[i][PermCarColors][1], PermanentVehicleStatistics[i][PermCarColors][2], 1800); permcars++; if (IsABicycle(vehicleid) || IsATrain(vehicleid) || IsVehicleRCVehicle(vehicleid)) SetVehicleEngine(vehicleid, 1); else SetVehicleEngine(vehicleid, 0); SavePermanentVehicle(i); //vehicleid = 0; } mysql_free_result(); } return 1; }
Код:
stock LoadVehicles() { new query[128], data[128], vehicleid; for (new i = 1; i < MAX_VEHICLES; i++) { format(query, sizeof(query), "SELECT * FROM `vehicles` WHERE `veh_id` = '%d'", i); mysql_query(query); mysql_store_result(); if (mysql_num_rows()) { new model, Float:position[4]; while (mysql_retrieve_row()) { mysql_fetch_field_row(data, "veh_id"); printf("Loading vehicle %d...", strval(data)); VehicleEnum[vehicleid][veh_id] = strval(data); mysql_fetch_field_row(data, "veh_model"); model = strval(data); mysql_fetch_field_row(data, "veh_x"); position[0] = floatstr(data); mysql_fetch_field_row(data, "veh_y"); position[1] = floatstr(data); mysql_fetch_field_row(data, "veh_z"); position[2] = floatstr(data); mysql_fetch_field_row(data, "veh_rot"); position[3] = floatstr(data); vehicleid = AddStaticVehicleEx(model, position[0], position[1], position[2], position[3], 1, 1, -1); mysql_fetch_field_row(data, "veh_plate"); format(VehicleEnum[vehicleid][veh_plate], MAX_PLATE_LENGTH + 1, data); mysql_fetch_field_row(data, "veh_owner"); format(VehicleEnum[vehicleid][veh_owner], MAX_PLAYER_NAME, data); mysql_fetch_field_row(data, "veh_price"); VehicleEnum[vehicleid][veh_model] = model; VehicleEnum[vehicleid][veh_owned] = 1; VehicleEnum[vehicleid][veh_price] = strval(data); VehicleEnum[vehicleid][veh_x] = position[0]; VehicleEnum[vehicleid][veh_y] = position[1]; VehicleEnum[vehicleid][veh_z] = position[2]; VehicleEnum[vehicleid][veh_rot] = position[3]; for(new c = 1, var[32]; c < 18; c++) { format(var, sizeof(var), "veh_component%d", c); mysql_fetch_field_row(data, var); VehicleEnum[vehicleid][veh_comp][c] = strval(data); } mysql_fetch_field_row(data, "veh_color1"); VehicleEnum[vehicleid][veh_colors][1] = strval(data); mysql_fetch_field_row(data, "veh_color2"); VehicleEnum[vehicleid][veh_colors][2] = strval(data); mysql_fetch_field_row(data, "veh_paintjob"); VehicleEnum[vehicleid][veh_paintjob] = strval(data); mysql_fetch_field_row(data, "veh_locked"); VehicleEnum[vehicleid][veh_locked] = strval(data); mysql_fetch_field_row(data, "veh_slot"); VehicleEnum[vehicleid][veh_slot] = strval(data); mysql_fetch_field_row(data, "veh_int"); VehicleEnum[vehicleid][veh_int] = strval(data); mysql_fetch_field_row(data, "veh_world"); VehicleEnum[vehicleid][veh_world] = strval(data); mysql_fetch_field_row(data, "veh_neon"); VehicleEnum[vehicleid][veh_neon] = strval(data); mysql_fetch_field_row(data, "veh_impounded"); VehicleEnum[vehicleid][veh_impounded] = strval(data); mysql_fetch_field_row(data, "veh_impoundprice"); VehicleEnum[vehicleid][veh_impoundprice] = strval(data); mysql_fetch_field_row(data, "veh_haslock"); VehicleEnum[vehicleid][veh_haslock] = strval(data); mysql_fetch_field_row(data, "veh_registerdate1"); VehicleEnum[vehicleid][veh_registerdate][1] = strval(data); mysql_fetch_field_row(data, "veh_registerdate2"); VehicleEnum[vehicleid][veh_registerdate][2] = strval(data); mysql_fetch_field_row(data, "veh_registerdate3"); VehicleEnum[vehicleid][veh_registerdate][3] = strval(data); mysql_fetch_field_row(data, "veh_registerdate4"); VehicleEnum[vehicleid][veh_registerdate][4] = strval(data); mysql_fetch_field_row(data, "veh_registerdate5"); VehicleEnum[vehicleid][veh_registerdate][5] = strval(data); mysql_fetch_field_row(data, "veh_registerdate6"); VehicleEnum[vehicleid][veh_registerdate][6] = strval(data); mysql_fetch_field_row(data, "NeonActivated"); NeonActivated[vehicleid] = strval(data); mysql_fetch_field_row(data, "veh_trunkgun1"); VehicleEnum[vehicleid][veh_trunkgun1] = strval(data); mysql_fetch_field_row(data, "veh_trunkgun2"); VehicleEnum[vehicleid][veh_trunkgun2] = strval(data); mysql_fetch_field_row(data, "veh_trunkgun3"); VehicleEnum[vehicleid][veh_trunkgun3] = strval(data); mysql_fetch_field_row(data, "veh_trunkgun4"); VehicleEnum[vehicleid][veh_trunkgun4] = strval(data); mysql_fetch_field_row(data, "veh_trunkarmor"); VehicleEnum[vehicleid][veh_trunkarmor] = floatstr(data); mysql_fetch_field_row(data, "veh_trunkcocaine"); VehicleEnum[vehicleid][veh_trunkcocaine] = strval(data); mysql_fetch_field_row(data, "veh_trunkweed"); VehicleEnum[vehicleid][veh_trunkweed] = strval(data); mysql_fetch_field_row(data, "veh_trunkmeth"); VehicleEnum[vehicleid][veh_trunkmeth] = strval(data); mysql_fetch_field_row(data, "veh_trunkheroin"); VehicleEnum[vehicleid][veh_trunkheroin] = strval(data); mysql_fetch_field_row(data, "veh_trunkmats"); VehicleEnum[vehicleid][veh_trunkmats] = strval(data); mysql_fetch_field_row(data, "veh_trunkcash"); VehicleEnum[vehicleid][veh_trunkcash] = strval(data); } ModifyVehicle(vehicleid); LinkVehicleToInterior(vehicleid, VehicleEnum[vehicleid][veh_int]); SetVehicleVirtualWorld(vehicleid, VehicleEnum[vehicleid][veh_world]); if(VehicleEnum[vehicleid][veh_locked]) LockVehicle(vehicleid); if (NeonActivated[vehicleid]) { AddNeonToVehicle(-1, vehicleid, VehicleEnum[vehicleid][veh_neon]); } if(vehicleid != INVALID_VEHICLE_ID) ownedcars++; if (IsABicycle(vehicleid) || IsATrain(vehicleid) || IsVehicleRCVehicle(vehicleid)) SetVehicleEngine(vehicleid, 1); else SetVehicleEngine(vehicleid, 0); } mysql_free_result(); } return 1; }