[15:17:55] OnQueryError: errorid: 1060, error: Duplicate column name 'SpawnPos', callback: , query: ALTER TABLE `players` ADD `SpawnPos` INT NOT NULL DEFAULT '0';, connectionHandle: 1 [15:17:55] OnQueryError: errorid: 1060, error: Duplicate column name 'LogUnix', callback: , query: ALTER TABLE `players` ADD `LogUnix` INT NOT NULL DEFAULT '0';, connectionHandle: 1 [15:17:55] OnQueryError: errorid: 1060, error: Duplicate column name 'HelperReports', callback: , query: ALTER TABLE `players` ADD `HelperReports` INT NOT NULL DEFAULT '0';, connectionHandle: 1 [15:17:55] OnQueryError: errorid: 1060, error: Duplicate column name 'family', callback: , query: ALTER TABLE `vehicles` ADD `family` INT(2) NOT NULL DEFAULT 0;, connectionHandle: 1 [15:17:55] OnQueryError: errorid: 1060, error: Duplicate column name 'lockfeature', callback: , query: ALTER TABLE `vehicles` ADD `lockfeature` INT(2) NOT NULL DEFAULT 0;, connectionHandle: 1
[11:33:50] SavePlayerCars(1) > Car 0 couldn't open file (ID: 1)
stock SavePlayerCars(playerid, bool:destroy) { for(new slot = 0; slot < 2; slot++) { if(PlayerInfo[playerid][pCarID][slot] > 0) { if(IsValidVehicle(PlayerCars[playerid][slot][c_ID])) { GetVehiclePos(PlayerCars[playerid][slot][c_ID], PlayerCars[playerid][slot][c_LastPos][0], PlayerCars[playerid][slot][c_LastPos][1], PlayerCars[playerid][slot][c_LastPos][2]); GetVehicleZAngle(PlayerCars[playerid][slot][c_ID], PlayerCars[playerid][slot][c_LastPos][3]); for(new comp = 0; comp < 14; comp++) PlayerCars[playerid][slot][c_Component][comp] = GetVehicleComponentInSlot(PlayerCars[playerid][slot][c_ID], comp); PlayerCars[playerid][slot][c_VW] = GetVehicleVirtualWorld(PlayerCars[playerid][slot][c_ID]); PlayerCars[playerid][slot][c_Trunk] = TrunkInfo[PlayerCars[playerid][slot][c_ID]][cTrunkOpened]; PlayerCars[playerid][slot][c_Gun][0] = TrunkInfo[PlayerCars[playerid][slot][c_ID]][cGun1]; PlayerCars[playerid][slot][c_Gun][1] = TrunkInfo[PlayerCars[playerid][slot][c_ID]][cGun2]; PlayerCars[playerid][slot][c_Pot] = TrunkInfo[PlayerCars[playerid][slot][c_ID]][cPot]; PlayerCars[playerid][slot][c_Crack] = TrunkInfo[PlayerCars[playerid][slot][c_ID]][cCrack]; PlayerCars[playerid][slot][c_Armor] = TrunkInfo[PlayerCars[playerid][slot][c_ID]][cArmor]; } new strFile[48]; format(strFile, sizeof(strFile), "cars/%d.ini", PlayerInfo[playerid][pCarID][slot]); new File:fCar = fopen(strFile, io_write); if(!fCar) return printf("SavePlayerCars(%d) > Car %d couldn't open file (ID: %d)", playerid, slot, PlayerInfo[playerid][pCarID][slot]); new strData[64]; format(strData, sizeof(strData), "Model=%d\n", PlayerCars[playerid][slot][c_Model]); fwrite(fCar, strData); format(strData, sizeof(strData), "X=%f\n", PlayerCars[playerid][slot][c_ParkPos][0]); fwrite(fCar, strData); format(strData, sizeof(strData), "Y=%f\n", PlayerCars[playerid][slot][c_ParkPos][1]); fwrite(fCar, strData); format(strData, sizeof(strData), "Z=%f\n", PlayerCars[playerid][slot][c_ParkPos][2]); fwrite(fCar, strData); format(strData, sizeof(strData), "A=%f\n", PlayerCars[playerid][slot][c_ParkPos][3]); fwrite(fCar, strData); format(strData, sizeof(strData), "LX=%f\n", PlayerCars[playerid][slot][c_LastPos][0]); fwrite(fCar, strData); format(strData, sizeof(strData), "LY=%f\n", PlayerCars[playerid][slot][c_LastPos][1]); fwrite(fCar, strData); format(strData, sizeof(strData), "LZ=%f\n", PlayerCars[playerid][slot][c_LastPos][2]); fwrite(fCar, strData); format(strData, sizeof(strData), "LA=%f\n", PlayerCars[playerid][slot][c_LastPos][3]); fwrite(fCar, strData); format(strData, sizeof(strData), "C1=%d\n", PlayerCars[playerid][slot][c_Color][0]); fwrite(fCar, strData); format(strData, sizeof(strData), "C2=%d\n", PlayerCars[playerid][slot][c_Color][1]); fwrite(fCar, strData); format(strData, sizeof(strData), "PJ=%d\n", PlayerCars[playerid][slot][c_PaintJob]); fwrite(fCar, strData); format(strData, sizeof(strData), "comp0=%d\n", PlayerCars[playerid][slot][c_Component][0]); fwrite(fCar, strData); format(strData, sizeof(strData), "comp1=%d\n", PlayerCars[playerid][slot][c_Component][1]); fwrite(fCar, strData); format(strData, sizeof(strData), "comp2=%d\n", PlayerCars[playerid][slot][c_Component][2]); fwrite(fCar, strData); format(strData, sizeof(strData), "comp3=%d\n", PlayerCars[playerid][slot][c_Component][3]); fwrite(fCar, strData); format(strData, sizeof(strData), "comp4=%d\n", PlayerCars[playerid][slot][c_Component][4]); fwrite(fCar, strData); format(strData, sizeof(strData), "comp5=%d\n", PlayerCars[playerid][slot][c_Component][5]); fwrite(fCar, strData); format(strData, sizeof(strData), "comp6=%d\n", PlayerCars[playerid][slot][c_Component][6]); fwrite(fCar, strData); format(strData, sizeof(strData), "comp7=%d\n", PlayerCars[playerid][slot][c_Component][7]); fwrite(fCar, strData); format(strData, sizeof(strData), "comp8=%d\n", PlayerCars[playerid][slot][c_Component][8]); fwrite(fCar, strData); format(strData, sizeof(strData), "comp9=%d\n", PlayerCars[playerid][slot][c_Component][9]); fwrite(fCar, strData); format(strData, sizeof(strData), "comp10=%d\n", PlayerCars[playerid][slot][c_Component][10]); fwrite(fCar, strData); format(strData, sizeof(strData), "comp11=%d\n", PlayerCars[playerid][slot][c_Component][11]); fwrite(fCar, strData); format(strData, sizeof(strData), "comp12=%d\n", PlayerCars[playerid][slot][c_Component][12]); fwrite(fCar, strData); format(strData, sizeof(strData), "comp13=%d\n", PlayerCars[playerid][slot][c_Component][13]); fwrite(fCar, strData); format(strData, sizeof(strData), "alarm=%d\n", PlayerCars[playerid][slot][c_Alarm]); fwrite(fCar, strData); format(strData, sizeof(strData), "ins=%d\n", PlayerCars[playerid][slot][c_Insurance]); fwrite(fCar, strData); format(strData, sizeof(strData), "plate=%s\n", PlayerCars[playerid][slot][c_Plate]); fwrite(fCar, strData); format(strData, sizeof(strData), "gps=%d\n", PlayerCars[playerid][slot][c_GPS]); fwrite(fCar, strData); format(strData, sizeof(strData), "tow=%d\n", PlayerCars[playerid][slot][c_Tow]); fwrite(fCar, strData); format(strData, sizeof(strData), "keys=%d\n", PlayerCars[playerid][slot][c_Keys]); fwrite(fCar, strData); format(strData, sizeof(strData), "lock=%d\n", PlayerCars[playerid][slot][c_Lock]); fwrite(fCar, strData); format(strData, sizeof(strData), "price=%d\n", PlayerCars[playerid][slot][c_Price]); fwrite(fCar, strData); format(strData, sizeof(strData), "virtualworld=%d\n", PlayerCars[playerid][slot][c_VW]); fwrite(fCar, strData); format(strData, sizeof(strData), "trunk_opened=%d\n", PlayerCars[playerid][slot][c_Trunk]); fwrite(fCar, strData); format(strData, sizeof(strData), "trunk_gun1=%d\n", PlayerCars[playerid][slot][c_Gun][0]); fwrite(fCar, strData); format(strData, sizeof(strData), "trunk_gun2=%d\n", PlayerCars[playerid][slot][c_Gun][1]); fwrite(fCar, strData); format(strData, sizeof(strData), "trunk_pot=%d\n", PlayerCars[playerid][slot][c_Pot]); fwrite(fCar, strData); format(strData, sizeof(strData), "trunk_crack=%d\n", PlayerCars[playerid][slot][c_Crack]); fwrite(fCar, strData); format(strData, sizeof(strData), "trunk_armor=%f\n", PlayerCars[playerid][slot][c_Armor]); fwrite(fCar, strData); format(strData, sizeof(strData), "impounded=%d\n", PlayerCars[playerid][slot][c_Impounded]); fwrite(fCar, strData); fclose(fCar); if(destroy) { DestroyVehicle(PlayerCars[playerid][slot][c_ID]); PlayerCars[playerid][slot][c_ID] = 0; } } } return 1; }
You're trying to add the columns again while they are already exist
|
The errors you're getting are associated to a MySQL query. The function above writes to a local file, so please show us the query instead.
What you have to do to get rid of the error is to first check if the columns are created. |
Alright, but how? I'm a noob in MySQL. Could you help me out a bit with some steps or so?
|
How exactly are we suppose to help you if you don't show us the query that creates the problem?
Also you could have used all this time doing research and try to figure out where is the problem instead of waiting for answers and doing nothing. |
Do not use MySQL if you are a "noob" on it. Start with learning the basics in side scripts outside your gamemode, then start developing the real gamemode using mysql.
|
Yes jlat told it already that should solve your problem.
Without any code. I can merely guess. Yes, you're creating duplicate columns each time you save a player's vehicle. This is wrong. If the player has already purchased the vehicle and does some modification or changes in it, use UPDATE statement. Or if there's new entry in the table. that is - a player which has no vehicle purchased a vehicle, use INSERT INTO. |
Okay, okay. Calm listen, can you show us the query? In which you save the data for car?
|