SA-MP Forums Archive
Best way to store objects in mySQL - 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: Best way to store objects in mySQL (/showthread.php?tid=580537)



Best way to store objects in mySQL - Dan. - 06.07.2015

I'm currently making a bases system. The base info is held in a mySQL table (Name, price, coordinates)..

I want the user to be able to unlock different objects for the base. Is there a way the user himself could buy & move the objects? I once saw a system where you could move the object, rotate the object etc. with an on-screen GUI.

Anyways.. if not, I would like to add the objects myself and the user can just 'unlock them' (make them visible). What's the best way to store maybe.. 10-15 objects? Should I make a different database for the objects or somehow put them into the base mySQL table?

Thanks


Re: Best way to store objects in mySQL - Adi007 - 06.07.2015

I think you need this: https://sampwiki.blast.hk/wiki/EditObject


Re: Best way to store objects in mySQL - dusk - 06.07.2015

As for mysql, you should create a separate table for them:

Код:
CREATE TABLE IF NOT EXISTS base_objects (
    id INT AUTO_INCREMENT NOT NULL,
   base_id INT NOT NULL,
   object_id INT NOT NULL,
   x FLOAT NOT NULL,
   y FLOAT NOT NULL,
   z FLOAT NOT NULL,
   rot_x FLOAT NOT NULL,
   rot_y FLOAT NOT NULL,
   rot_z FLOAT NOT NULL,
   unlocked TINYINT UNSIGNED NOT NULL,
   PRIMARY KEY(id)
);