03.11.2015, 03:35
My server dont save the doors in mysql this is the code: (Sorry for my bad english)
Command:
save function:
Table Mysql:
Command:
Quote:
CMD:doorexterior(playerid, params[]) { if(PlayerData[playerid][pAdmin] >= 3) { new iDoorID, szStream[5], szMessage[128]; if(sscanf(params, "is[5]", iDoorID, szStream)) return SendClientMessage(playerid, COLOR_GRAD1, SYNTAX_MESSAGE"/doorexterior [doorid] [streamed('Yes'/'No')]"); if(iDoorID < 0 || iDoorID > MAX_DDOORS) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid door specified."); if(strcmp(szStream, "Yes", true) == 0) DoorData[iDoorID][ddCustomExterior] = 1; else if(strcmp(szStream, "No", true) == 0) DoorData[iDoorID][ddCustomExterior] = 0; else return SendClientMessage(playerid, COLOR_GRAD1, "Invalid stream specified, enter either; 'yes' or 'no'."); GetPlayerPos(playerid, DoorData[iDoorID][ddExteriorX], DoorData[iDoorID][ddExteriorY], DoorData[iDoorID][ddExteriorZ]); GetPlayerFacingAngle(playerid, DoorData[iDoorID][ddExteriorA]); DoorData[iDoorID][ddExteriorVW] = GetPlayerVirtualWorld(playerid); DoorData[iDoorID][ddExteriorInt] = GetPlayerInterior(playerid); CreateDynamicDoor(iDoorID); SaveDynamicDoor(iDoorID); format(szMessage, sizeof szMessage, "You have editied door ID %i exterior position, with VW %i and interior %i.", iDoorID, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)); SendClientMessage(playerid, COLOR_GRAD1, szMessage); format(szMessage, sizeof szMessage, "%s has editied door ID %i exterior.", getPlayerName(playerid), iDoorID); Log("logs/dooredit.log", szMessage); } else Invalid_Admin(playerid); return 1; } |
Quote:
stock SaveDynamicDoor(doorid) { new string[1024]; format(string, sizeof(string), "UPDATE `doors` SET \ `Description`='%s', \ `CustomInterior`=%d, \ `ExteriorVW`=%d, \ `ExteriorInt`=%d, \ `InteriorVW`=%d, \ `InteriorInt`=%d, \ `ExteriorX`=%f, \ `ExteriorY`=%f, \ `ExteriorZ`=%f, \ `ExteriorA`=%f, \ `InteriorX`=%f, \ `InteriorY`=%f, \ `InteriorZ`=%f, \ `InteriorA`=%f,", DoorData[doorid][ddDescription], DoorData[doorid][ddCustomInterior], DoorData[doorid][ddExteriorVW], DoorData[doorid][ddExteriorInt], DoorData[doorid][ddInteriorVW], DoorData[doorid][ddInteriorInt], DoorData[doorid][ddExteriorX], DoorData[doorid][ddExteriorY], DoorData[doorid][ddExteriorZ], DoorData[doorid][ddExteriorA], DoorData[doorid][ddInteriorX], DoorData[doorid][ddInteriorY], DoorData[doorid][ddInteriorZ], DoorData[doorid][ddInteriorA] ); format(string, sizeof(string), "%s \ `CustomExterior`=%d, \ `VIP`=%d, \ `Family`=%d, \ `Faction`=%d, \ `Admin`=%d, \ `Wanted`=%d, \ `VehicleAble`=%d, \ `Color`=%d, \ `PickupModel`=%d, \ `Pass`='%s', \ `Locked`=%d WHERE `id`=%d", string, DoorData[doorid][ddCustomExterior], DoorData[doorid][ddVIP], DoorData[doorid][ddFamily], DoorData[doorid][ddFaction], DoorData[doorid][ddAdmin], DoorData[doorid][ddWanted], DoorData[doorid][ddVehicleAble], DoorData[doorid][ddColor], DoorData[doorid][ddPickupModel], DoorData[doorid][dPass], DoorData[doorid][dLocked], doorid+1 ); // Array starts from zero, MySQL starts at 1 (this is why we are adding one). mysql_function_query(g_iConnectionHandle[0], string, false, "OnQueryFinish", "i", THREAD_NO_RESULT); } |
Quote:
- ---------------------------- -- Table structure for doors -- ---------------------------- DROP TABLE IF EXISTS `doors`; CREATE TABLE `doors` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Description` varchar(12 NOT NULL DEFAULT 'None', `CustomInterior` int(11) NOT NULL DEFAULT '0', `ExteriorVW` int(11) NOT NULL DEFAULT '0', `ExteriorInt` int(11) NOT NULL DEFAULT '0', `InteriorVW` int(11) NOT NULL DEFAULT '0', `InteriorInt` int(11) NOT NULL DEFAULT '0', `ExteriorX` float(10,5) NOT NULL DEFAULT '0.00000', `ExteriorY` float(10,5) NOT NULL DEFAULT '0.00000', `ExteriorZ` float(10,5) NOT NULL DEFAULT '0.00000', `ExteriorA` float(10,5) NOT NULL DEFAULT '0.00000', `InteriorX` float(10,5) NOT NULL DEFAULT '0.00000', `InteriorY` float(10,5) NOT NULL DEFAULT '0.00000', `InteriorZ` float(10,5) NOT NULL DEFAULT '0.00000', `InteriorA` float(10,5) NOT NULL DEFAULT '0.00000', `CustomExterior` int(11) NOT NULL DEFAULT '0', `VIP` int(11) NOT NULL DEFAULT '0', `Family` int(11) NOT NULL DEFAULT '0', `Faction` int(11) NOT NULL DEFAULT '0', `Admin` int(11) NOT NULL DEFAULT '0', `Wanted` int(11) NOT NULL DEFAULT '0', `VehicleAble` int(11) NOT NULL DEFAULT '0', `Color` int(11) NOT NULL DEFAULT '0', `PickupModel` int(11) NOT NULL DEFAULT '0', `Pass` varchar(24) NOT NULL DEFAULT 'pass', `Locked` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=500 DEFAULT CHARSET=latin1; |