SA-MP Forums Archive
Mysql Dont save - 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: Mysql Dont save (/showthread.php?tid=593232)



Mysql Dont save - jose005 - 03.11.2015

My server dont save the doors in mysql this is the code: (Sorry for my bad english)

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;
}

save function:
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);
}

Table Mysql:
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;




Respuesta: Mysql Dont save - jose005 - 03.11.2015

Help D:


Respuesta: Mysql Dont save - jose005 - 04.11.2015

Help D:


Respuesta: Mysql Dont save - jose005 - 05.11.2015

Help D:


Re: Mysql Dont save - iKarim - 05.11.2015

Nice triple bump, Anyways..
May I see your MySQL logs? I wont guess whats wrong.


Respuesta: Re: Mysql Dont save - jose005 - 05.11.2015

Quote:
Originally Posted by PawnHunter
Посмотреть сообщение
Nice triple bump, Anyways..
May I see your MySQL logs? I wont guess whats wrong.
Only This :S
Quote:

[14:59:41] [ERROR] ExecuteT[LoadLockers()] - (error #1146) Table 'samp.viplockers' doesn't exist
[15:00:06] [ERROR] ExecuteT[LoadLockers()] - (error #1146) Table 'samp.viplockers' doesn't exist
[15:00:52] [ERROR] ExecuteT[LoadLockers()] - (error #1146) Table 'samp.viplockers' doesn't exist




Re: Mysql Dont save - PrO.GameR - 05.11.2015

Tip one, learn English enough to at least understand basic errors if you want help in an English forums
samp.viplockers table doesn't exist, either this is not your table's name or you didn't create it


Respuesta: Re: Mysql Dont save - jose005 - 05.11.2015

Quote:
Originally Posted by PrO.GameR
Посмотреть сообщение
Tip one, learn English enough to at least understand basic errors if you want help in an English forums
samp.viplockers table doesn't exist, either this is not your table's name or you didn't create it
the problem dont are the viplocker is the save door, door is one table and viplockers is other and samp_log say this error:

Quote:

Error #1064 - Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE `jobID` = 1' at line 1 | Query: INSERT INTO `jobs` SET `jobType` = 5, `jobPosX` = 1654.010986, `jobPosY` = -1655.713134, `jobPosZ` = 22.515625, `jobPickupX` = 0.000000, `jobPickupY` = 0.000000, `jobPickupZ` = 0.000000, `jobLevelRequirement` = 0 WHERE `jobID` = 1 | Callback: OnQueryFinish




Re: Mysql Dont save - ThePhenix - 05.11.2015

You are using the WHERE clause while using INSERT INTO which makes no sense at all in your query.


Respuesta: Re: Mysql Dont save - jose005 - 06.11.2015

Quote:
Originally Posted by ThePhenix
Посмотреть сообщение
You are using the WHERE clause while using INSERT INTO which makes no sense at all in your query.
TY men

Fixed.