Jump to content

IIYAMA

Moderators
  • Posts

    6,086
  • Joined

  • Last visited

  • Days Won

    215

Everything posted by IIYAMA

  1. 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)
  2. 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
  3. 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)
  4. 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!!
  5. 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.
  6. 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
  7. What is the errno it returns?
  8. 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.
  9. Which side do you think is more logic to have access accounts? Serverside(the server) or clientside(all players)?
  10. 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.
  11. 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)
  12. 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)
  13. 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.
  14. 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
  15. 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)
  16. 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)
  17. ? 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.
  18. ? if username and username ~= "" and password and password ~= "" then -- Is the variable something? + Is it Not an empty string?
  19. IIYAMA

    Clean screen

    Wut? How many addEventHandler's, functions, logo's do you want? 1000000? This is why it doesn't work: https://wiki.multitheftauto.com/wiki/Game_Processing_Order You can't decide when you render a GUI, that does MTA for you because they(GUI's) are elements. While with dx you can change the render order in your code. Render your logo with this, to solve the problem: dxDrawImage
  20. That event triggers probably too late. Use: https://wiki.multitheftauto.com/wiki/OnClientVehicleDamage cancelEvent() You should check if theAttacker can also be a vehicle. If there is no attacker > cancelEvent(). If there is an attacker > do nothing.
  21. I recommend to create mission markers and blips clientside. Less bandwidth for players that do not do the mission, less element managing required serverside and less problems with: setElementVisibleTo Which has to be called again for new joining players. But do what suits you best!
×
×
  • Create New...