Jump to content

IIYAMA

Moderators
  • Posts

    6,089
  • Joined

  • Last visited

  • Days Won

    216

Everything posted by IIYAMA

  1. There are two reasons why people (like me) do compile + encrypt script. - Security for hackers and backdoors (which unfortunately do exist) - Performance (compiled scripts are optimised) So pls, do not criticize people for doing the right thing. Just fill in your server version. I guess your server is 1.5.3? (Using the server version gives less problems) <min_mta_version client="1.5.3" server="1.5.3" />
  2. If a cheater is able to set elementdata clientside. A lot of servers will be breached. So the answer to that is yes/no. 90% of the cheating I have seen at scripting level(we are in the scripting section) is done by corrupted staff. The resource runcode and even admin(execute command) itself do have scripting based inputs, which can easy manipulate elementData. So, prevent cheating is a better way of doing instead of writing an complex anti cheat. Use tables instead of elementdata for important data. (like money / stats) Always check if players are logged in as admin, while execute an action that should be available for admins only. Do never give strange players admin / other ranks, if you haven't edited your acl properly. They will be able to do everything they want if they are smart enough. (Even stealing your resources) Do not upload runcode on your public server. (remove it) Other cheats (flying/aimbot/ etc.)? You noticed cheating while your mta server is up-to-date? You might consider an anti cheat, if you are 100% sure it isn't the result of a corrupted staff-member.
  3. local cameraX, cameraY, cameraZ = getCameraMatrix () for i,v in pairs ( messages ) do local x, y, z = unpack ( v ) if getDistanceBetweenPoints3D (cameraX, cameraY, cameraZ, x, y, z ) < 100 then local sx, sy = getScreenFromWorldPosition ( x, y, z ) if sx then dxDrawText ( i, sx+2, sy+2, sw, sh, tocolor ( 0, 0, 0, 255 ), 2.0, "default-bold" ) dxDrawText ( i, sx, sy, sw, sh, tocolor ( 0, 136, 255, 255 ), 2.0, "default-bold" ) end end end If you also want to scale the text according to the REAL distance, see:
  4. local allTeamData = { ["Ghost Mercenaries"] = { spawnpoint = {-176.84535, 996.75055, 23.63281, 180, 287, 0} -- add more data if you want. }, ["Special Military Unit"] = { spawnpoint = {-176.84535, 996.75055, 23.63281, 180, 287, 0} -- add more data if you want. }, ["People's Protection Power"] = { spawnpoint = {-176.84535, 996.75055, 23.63281, 180, 287, 0} -- add more data if you want. } } function onDeath() -- get the player his account local acc = getPlayerAccount(source) -- is played logged in? if not isGuestAccount(acc) then local teamName = getAccountData(acc, "team") local teamData = allTeamData[teamName] -- get the data based on the teamName if teamData then local teamElement = getTeamFromName(teamName) if teamElement then setPlayerTeam(source, teamElement) spawnPlayer (source, unpack(teamData.spawnpoint)) else outputDebugString("<" .. tostring(getPlayerName(source)) .. "> " .. "can't find team") end else outputDebugString("<" .. tostring(getPlayerName(source)) .. "> " .. "team doesn't have teamData!") end else outputDebugString("<" .. tostring(getPlayerName(source)) .. "> " .. "player isn't logged in") end end addEventHandler("onPlayerWasted", root, onDeath)
  5. That depends if the variable `green` is available and if the `team` is the team name. You can't save elements inside accountdata, teams are elements. teamName = "green" -- getTeamName ( team theTeam )// https://wiki.multitheftauto.com/wiki/GetTeamName setAccountData(acc, "team", teamName) if getAccountData(acc, "team") == teamName then
  6. They are the direction vector of how the line hits on the object. If you hit the object it will return a vector that represents how that part of the object is facing a direction. I am using this function to determine how custom bullet holes are placed on to the objects in the world. If the vector returns (0 x,0 y, 1 z) than the bullet holes would be facing up. Which is most likely the case when you hit the flat ground. (not sure if you have to invert the vector, I haven't used this function for a while)
  7. I am not sure if you are asking a simple question or a hard question. It might be handy to add a screenshot. If it is a simple question, than this is one of the answers to it: -- 90 (1/4), 180 (1/2), 270 (3/4), 360 round and round and round... local rotationAdjustments = {xr = 90, yr = -90, zr = 0} function getWallRotation (element) local xr,yr,zr = getElementRotation (element) return rotationAdjustments.xr + xr, rotationAdjustments.yr + yr, rotationAdjustments.zr + zr end Simple add or subtract(minus value) rotations values of the mta rotation. Example: local awesomeRotationX, awesomeRotationY, awesomeRotationZ = getWallRotation(element) As @Jusonex said with processlineOfSign, which will return the exact rotation if used correctly. But you can also play a little bit with it manually. It doesn't have to be pixel perfect!!
  8. Yea indeed, that is how it suppose to be haha . Except when it is a value that is variable, that would be annoying to edit later on.
  9. Why don't you use both sides? Request clientside > trigger > serveride download > trigger > clientside write file. Else you can better use the downloadFile function. downloadFile
  10. What is the errno it returns?
  11. outputDebugString("Debug info start: " .. getTickCount()) for i, v in ipairs(resultdata) do inspect ( i ) inspect ( v ) -- https://wiki.multitheftauto.com/wiki/Inspect end ? outputDebugString("Debug info start: " .. getTickCount()) for i, v in ipairs(resultdata) do outputDebugString("type(resultdata) = " .. type(resultdata)) if type(v) == "table" then for j, data in pairs(v) do -- pairs << very important inspect ( j ) inspect ( data ) -- https://wiki.multitheftauto.com/wiki/Inspect end else outputDebugString("V ~= table, but: " .. type(v)) end end I actually forgot how to do it too, haha. Well I do remember that there has to be also a pairs loop in it, because it uses columns as keys.
  12. Which side do you think is more logic to have access accounts? Serverside(the server) or clientside(all players)?
  13. How does the JSON looks like? How do you split up the JSON? (Note: if you use string keys in JSON, all numeric keys also become strings, which is very annoying) How does the data looks like in the mysql database? Tip: else outputDebugString("Unable to connect to the MySQL server") cancelEvent() -- don't start a resource that doesn't have connection to a mySQL server! Else you get an enormous flow of errors/warnings if the connection fails. end Normally an unique id is the first in the column and the rest of the data comes after that.
  14. Here some more improvements: First of all use: local On: ? playerAccount, dataTable, id Shouldn't be able to access from other places! They should be freed from the memory after the code has been executed! Define the target player, you want the data to be send back to: (else all players get this data!) triggerClientEvent(thePlayer, "getGarageCallback", thePlayer, dataTable)
  15. local texts = { "Text 1", "Text 2", "Text 3", "Text 4", "Text 5" } local textIndex = 1 setTimer(function () textIndex = textIndex+1 end, 8000, #texts) ----- dxDrawText(texts[textIndex], screenW * 0.3555, screenH * 0.7014, screenW * 0.6414, screenH * 0.8403, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
  16. How to set a script serverside? https://wiki.multitheftauto.com/wiki/Meta.xml Meta.xml <script src="server.lua" /> <!-- serverside --> <script src="server.lua" type="server"/> <!-- serverside --> <script src="client.lua" type="client"/> <!-- clientside --> Serverside: Code that only runs at the 'server'. (Which can also be on a player his computer, if he is the host) Clientside: Code that runs on every player his computer.
  17. Does the outputDebugString shows your username and password correctly? If so then this condition should be OK: if username == "user" and password == "apple" then This function logIn is used when you want to login with for example a GUI instead of the command: /login username password https://wiki.multitheftauto.com/wiki/LogIn If you use this function you won't have to do this: >if username == "user" and password == "apple" then< You do it like this: local account = getAccount ( username ) if account then local successfullyLoggedIn = logIn ( player, account, password ) if successfullyLoggedIn then outputDebugString("yes! Works!") else outputDebugString("Wrong password") end else outputDebugString("Account doesn't exist!") end
  18. triggerServerEvent("submitLogin", resourceRoot, player, username, password) You forgot to replace a piece of code. Password is nil because you are only sending 2 arguments instead of 3. triggerServerEvent("submitLogin", resourceRoot, player, username, password)
  19. and did you try this one? (making data visible) Place it between line 1 and 2. In the code you just posted. (this doesn't solve your problem yet, but it will make it partly visible) ? outputDebugString("User: " .. username .. ", password: " .. password)
  20. ? outputDebugString("User: " .. username .. ", password: " .. password) You also need to be a little bit creative. If you are not sure why something(username or password) is NOT equal to .... and ...., then you have to make things visible(outputDebugString). Follow these steps: You start at the beginning of the script. You add debug lines till the end of the script. You run the script. The debugconsole will show you how far the script goes. The part that doesn't get execute is most likely the part that doesn't work. You check that part and fix it. (back to step2) OR post it on the forum and show us: where the code stops / error's / warnings. You get feedback. You edit the code. (back to step2) This way you can get things done! Instead waiting for somebody to SCAN your entire code over and over, which not always gives you result. <<< Not recommended.
  21. ? if username and username ~= "" and password and password ~= "" then -- Is the variable something? + Is it Not an empty string?
×
×
  • Create New...