Jump to content

DutchCaffeine

Members
  • Posts

    208
  • Joined

  • Last visited

Everything posted by DutchCaffeine

  1. This topic need to be sticky! build_query(queryType, sql_array) Note: This can only be at the server side system, against security reason's Code: function build_query(queryType, sql_array) if type(sql_array) ~= "table" then return false end local queryString = "" if queryType == "INSERT" or queryType == "INSERT_SELECT" then local keyTable = {} local valTable = {} for k, v in pairs(sql_array) do if k == "password" then v = string.format("SHA1('%s')", v) elseif k == "username_clean" then v = string.format("LOWER('%s')", v) else v = string.format("'%s'", v) end table.insert(keyTable, k) table.insert(valTable, v) end if queryType == "INSERT" then queryString = " (" .. table.concat(keyTable, ", ") .. ") VALUES (" .. table.concat(valTable, ", ") .. ") " elseif queryType == "INSERT_SELECT" then queryString = " (" .. table.concat(keyTable, ", ") .. ") SELECT " .. table.concat(valTable, ", ") .. " " end elseif queryType == "UPDATE" or queryType == "SELECT" then local valueTable = {} for k, v in pairs(sql_array) do if k == "password" then v = string.format("SHA1('%s')", v) elseif k == "username_clean" then v = string.format("LOWER('%s')", v) else v = string.format("'%s'", v) end table.insert(valueTable, k .. " = " .. v) end if queryType == "UPDATE" then queryString = table.concat(valueTable, ", ") elseif queryType == "SELECT" then queryString = table.concat(valueTable, " AND ") end end return queryString end Example data = { username = "Alexander", username_clean = "Alexander", password = "alexATmta" } query = mysql_query("INSERT_INTO users " .. build_query("INSERT", data) queryTypes: INSERT INSERT_SELECT UPDATE SELECT username_clean will be automatically has a LOWER function of mysql. password will be hashed to SHA1 automatically. You need the mysql module. You can find it here Good luck with it.
  2. Oke, i will do. i though it was simpler to use it. But maybe over some time i will make a like system but then with XML!
  3. Hello all, I will use the gui system of freeroams gui, but i don't know how to use the tab system. Can somebody explain it to me?
  4. I try to release it soon as i can but for now i have to much bugs and the project system need to be rewritten and also i need to build in an test server. All with all i thing it going to be released when DP 3 is released.
  5. Nope, i'ts going to be released when it is done. And what do you mean with MTA commands?
  6. I be busy with my own editor. It is going to be the best editor for mta. So keep your eyes open.
  7. Really $ 10 bugs! No way. First: set up the map. Second: Update the script. Let me see, that is about 60 to 80 bugs! You can better give: Set up: $ 10 Update: $ 5 (per line)
  8. in my way i prefer tables, i had created first this system with xml but it wasn't working. And now, i've got the best system of the whole mta community
  9. F5 was bound in the client script. But deleted it! I just found the best solution for this problem: Client side code: function clientResStart() triggerServerEvent("clientResourceStart", getRootElement(), getLocalPlayer()) end addEventHandler("onClientResourceStart", getRootElement(), clientResStart) Simple and small and works like how it need to work Server side code: function clientResStart(player) if checkAccount(player) then -- Show login window triggerClientEvent("onLoginAccount", getRootElement()) else -- outputChatBox("#FF0000It look's like you are not registered, please register your self!", source, 255, 255, 255, true) triggerClientEvent("onRegisterStart", getRootElement()) end end addEvent("clientResourceStart", true) addEventHandler("clientResourceStart", getRootElement(), clientResStart) That is perfect solution for what i want, and now I HAVE IT!!! Thanks to you all for the help, reply's to you.
  10. It's very simple: (get this as an tutorial, and type it over NOT copy, you can learn of it.) local noDeathTimer = nil local noDeathActive = false local maxHealth = 100 local useArmor = false -- The next variable will only be use able if you set useArmour to true local maxArmor = 100 -- Make a function, like this: function toggleNoDeath(toggle) if toggle == true then -- Set a timer: setTimer(string function, time, timeToExecute, [arguments]) noDeathTimer = setTimer("updateHealth", 1000, 0) -- 1000 is one seccond. 0 is unlimeted execute. noDeathActive = true -- This is ready here end if toggle == false then -- Just kill the timer noDeathActive = false killTimer(noDeathTimer) end end function updateHealth() setElementHealth(source, maxHealth) if useArmor == true then setPlayerArmor(source, maxArmor) end end -- Create the command function setNoDeath(source) if source then -- Check for admin, i don't know how. if hasObjectPermissionTo ( playerSource, "function.kickPlayer", false ) then if noDeathActive == true then toggleNoDeath(false) else toggleNoDeath(true) end end end end addCommandHandler("nodeath", getRootElement(), setNoDeath) hope it is helping you!
  11. Hello everybody, Here i'm again! In my client side scripts i made 2 event: addEvent("onStartSelection", true) addEventHandler("onStartSelection", getRootElement(), class_start) addEvent("onRegisterStart", true) addEventHandler("onRegisterStart", getRootElement(), toggleRegister) The event "onRegisterStart" will be called up when a player joins the server, it need to popup the registration window. But if i join at the first time, and i be not registered, it will give an error "Event onRegisterStart is not created." I also added a bind key (F5) when i press it it will popup the register window, if i fill everything in, and register my self (everything ok) it should call onStartSelection event but it gives the same error If i rejoin it works fine that, but i want that it works when i first join the server.
  12. Thanks, i't is working now, and how!
  13. Hello, I be busy with my class selection system. And i use tables/arrays for it, but it gives me every time an error: local classes = { 'police' = { There is everywhere i get the error of, it says that he misses a closing '}' char The script: http://paste.ubuntu.com/22093/ Alexander.
  14. Yeah you can do it. Just check with a simple if statement if the player is a cop or not
  15. Login script NO WAY, you can create it on your own with this gui editor and the developers wiki!
  16. Yes, i know! But the user can turn on or off javascript that is the whole problem. And for security reasons you can better turn it off.
  17. Nice _50p But you need to know not everybody has javascript on in their browser. Try to do it with php.
  18. But with to much vehicles and the Z is +1 above the ground the vehicles will float in the air. No it will not. The gravity will take care of that! Only what happened is that the cars can blow or have damage.
  19. First why it bothers you. Second the gpl license is not only for .exe files, but for every file extensions. Even .lua. Third you can edit the script, but not release it without my (written) permission. (thats gpl) Fourth i really don't bother either you like the license or not. ==== 1.0.1 bug fix released. This is the last release of the 1.0.* versions. The new version what is coming is 1.1.0
  20. It is an resource, misc. But i don't know if it is a misc that i can use it in an other resource. So that's why i explained how to install it. If you can use it in other resources, what i'm going to test for 1.1.0! But first release a bug fix, very soon (maybe tonight) 1.0.1
  21. Release This is my first release! This box system can be very handy if you need/want a box system, it has 4 important boxes: Error box Warning box Info box Confirm box The current version is: 1.0.1 Bug fixes Client confirm action check. Fixed. Important update: This the last release of the 1.0.* versions. All the other bug fixes will be fixed in the new sub version release! Version 1.1.0 Futures Futures for the version 1.1.0 Adding an load box. Adding an good box. Changing the images. Testing to use it as a misc resource, while testing in an other resource Install In your gamemode/script dir in the resource folder create: DIR: client DIR: client - images DIR: server put the next files in: error.png, warning.png, info.png, question.png in: client/images client_core.lua, client_funtions.lua, client_example.lua in: client server_functions.lua, server_example.lua in: server Add in your meta.xml file: <file src="client/images/error.png" type="client" /> <file src="client/images/warning.png" type="client" /> <file src="client/images/info.png" type="client" /> <file src="client/images/question.png" type="client" /> <script src="server/server_functions.lua" type="server" /> <script src="server/server_example.lua" type="server" /> <script src="client/client_core.lua" type="client" /> <script src="client/client_functions.lua" type="client" /> <script src="client/client_example.lua" type="client" /> Then test it with the next commands: Client: /cerror - Show error box /cwarning - Show warning box /cinfo - Show info box /cconfirm - get you million. server: /serror - Show error box /swarning - Show warning box /sinfo - Show info box /sconfirm - get you million. Legal This system is licensed with the gpl public license. GPL public license Final notes For the usage take a look in server_example.lua or client_example.lua. To report bugs just type: Bug name: Your bug name Bug explain: You bug explain Download from community: https://community.multitheftauto.com/index.php?p= ... ils&id=173 I hope you are happy with this system!
  22. My crash is: mta dmp crash file Date: 30-05-'08 Time: 22:30
  23. This way you can check of the file exists or not. local file_handler = fileOpen("path/to/file.txt") if not file_handler then file_handler = fileCreate("path/to/file.txt") end
  24. i going to test it. BIG edit It's working fine. Up to the new!
×
×
  • Create New...