#Kz Posted April 10, 2017 Share Posted April 10, 2017 Hello dears! Currently I'm using MySQL, but .. I don't know that, 'setElementData' is required? or MySQL is singly enough?! [Thanks for watching this Topic] Link to comment
Administrators Lpsd Posted April 11, 2017 Administrators Share Posted April 11, 2017 (edited) I think MySQL is the best option, especially if you are working with large amounts of data. You might want to use setElementData for things which you only need to keep during a single session (data which doesn't have any need to be stored/recorded), and for data which you'd like to be synced across the server and all clients. Personally though I'd stick with MySQL and use events (triggerServerEvent/triggerClientEvent) to sync data between clients/server Edited April 11, 2017 by LopSided_ 1 Link to comment
NeXuS™ Posted April 11, 2017 Share Posted April 11, 2017 It's useful to sync data with the server by setElementData for easier and faster access while the player is online. To actually answer your question perfectly, you'll have to give us more information about the environment in which your are trying to use setElementData/dbQuery. 1 Link to comment
#Kz Posted April 11, 2017 Author Share Posted April 11, 2017 3 hours ago, LopSided_ said: I think MySQL is the best option, especially if you are working with large amounts of data. You might want to use setElementData for things which you only need to keep during a single session (data which doesn't have any need to be stored/recorded), and for data which you'd like to be synced across the server and all clients. Personally though I'd stick with MySQL and use events (triggerServerEvent/triggerClientEvent) to sync data between clients/server Thank you! 3 hours ago, NeXuS™ said: It's useful to sync data with the server by setElementData for easier and faster access while the player is online. To actually answer your question perfectly, you'll have to give us more information about the environment in which your are trying to use setElementData/dbQuery. Helpful! Thanks for it. Link to comment
Bonsai Posted April 11, 2017 Share Posted April 11, 2017 What does element data have to do with mysql? If you are talking about caching the information, then you should use a server-side table instead of element data. You load things like player stats etc. when they login, you save it when they quit. 2 Link to comment
NeXuS™ Posted April 11, 2017 Share Posted April 11, 2017 (edited) Much easier to use element data instead of tables, because of easier access to those datas. Edited April 11, 2017 by NeXuS™ Link to comment
Bonsai Posted April 11, 2017 Share Posted April 11, 2017 3 minutes ago, NeXuS™ said: Much easier to use element data instead of tables, because of easier access to those datas. https://wiki.multitheftauto.com/wiki/Script_security Link to comment
NeXuS™ Posted April 11, 2017 Share Posted April 11, 2017 (edited) Buddy, can you tell me how do you want to transfer your table from that script to an another without exporting a function (makes more junk), or calling an event? NO WAY. So if you need ANYTHING from that table, you'll have to call an exported function (which has to be on the same side), or call an event, which then recalls an another even with that table inside. And btw, you need to secure only the client sided setElementData, you can't call that function, if it's only written in a server-sided script. Edited April 11, 2017 by NeXuS™ Link to comment
Bonsai Posted April 11, 2017 Share Posted April 11, 2017 3 minutes ago, NeXuS™ said: Buddy, can you tell me how do you want to transfer your table from that script to an another without exporting a function (makes more junk), or calling an event? NO WAY. So if you need ANYTHING from that table, you'll have to call an exported function (which has to be on the same side), or call an event, which then recalls an another even with that table inside. And btw, you need to secure only the client sided setElementData, you can't call that function, if it's only written in a server-sided script. You said it. Events. When you need the data, you request it. No reason to sync all possible data with all players on the server whenever it changes. Most data won't be needed clientside anyway. If you want to output it to the chat, you can do it serverside. 3 Link to comment
NeXuS™ Posted April 11, 2017 Share Posted April 11, 2017 Can you tell me then, why no one uses your method, and everyone uses setElementData instead of it? Because much easier to use, and it's not an issue in "security" at all, as you tried to mention. That link is about not trusting any data coming from a client (ex. a trigger from a client, because it can be RIGGED), and not even close to server sided setElementDatas. Link to comment
Bonsai Posted April 11, 2017 Share Posted April 11, 2017 3 minutes ago, NeXuS™ said: Can you tell me then, why no one uses your method, and everyone uses setElementData instead of it? Because much easier to use, and it's not an issue in "security" at all, as you tried to mention. That link is about not trusting any data coming from a client (ex. a trigger from a client, because it can be RIGGED), and not even close to server sided setElementDatas. Maybe you should read again what element data is and how it works. https://wiki.multitheftauto.com/wiki/SetElementData 1 Link to comment
NeXuS™ Posted April 11, 2017 Share Posted April 11, 2017 Yeah, I'm sure, I have to take a look at it, after thousand of hours working with it. HF buddy. Link to comment
Syntrax# Posted April 11, 2017 Share Posted April 11, 2017 45 minutes ago, Bonsai said: Maybe you should read again what element data is and how it works. https://wiki.multitheftauto.com/wiki/SetElementData He's true about elementData, it's not safe to use due to security issues. The data of the element is synched between the client side and serverside which makes it even easier to change things in the serverside of the scripts.I wouldn't use this if it's about something that will be saved on quit, more like something with no value to the server. 3 Link to comment
xeon17 Posted April 11, 2017 Share Posted April 11, 2017 I think you misunderstood the purpose of element data @NeXuS™ Element data should be only used to sync data between the server and players. Such as scoreboard columns data (a example) Except the bad security, element data has a bad impact on the server performance, as it is synced to all players. Using tables is a much better and faster way to store data. 2 Link to comment
Popular Post Simple0x47 Posted April 11, 2017 Popular Post Share Posted April 11, 2017 (edited) mySQL/SQLite/XML: "Long Life" Storage Method. elementData, tables: Streaming data method. It's not correct 100%, but it's useful to catch the difference between them. And about the use of elementData I totally discourage it's use with the purpose of syncing big amounts of data with the client or the server. I like to use Tables and Events instead of elementData ( little bit more difficult but it worth's it ). Edited April 11, 2017 by Simple01 Opinion about elementData. 4 Link to comment
koragg Posted April 13, 2017 Share Posted April 13, 2017 (edited) setElementData is used for "storing" little insignificant to the server data temporarily. An example: You want people to be able to buy a map only after they win one first. You set element data when they win and then check if it's true. If so they can buy a map. And when someone else wins you set the element data for theprevious winner to nil. I don't care about security and I'm sure that there are a thousand better ways to do the above but for me if it works it's fine. Just a quick example. And about sql idk anything but it's used for storing data like total wins, map starts, coins etc. Has similar effect to setAccountData and it's better on security but harder to use it. Edited April 13, 2017 by koragg 1 Link to comment
Gordon_G Posted April 13, 2017 Share Posted April 13, 2017 Damn, I've never noticed any lag with elementData's. Is there a proof of any lag or any security bypass ? Maybe it's because I'm alone on my script server but I've never noticed any lag. It's stange because I use a lot the elementData, for exemple for things like this : objects_ = {"bottle", "burger", -- etc } -- When the player connect for example : for k,v in pairs(objects_) do setElementData(player,v,0) end Could it lag if there are many player ? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now