Jump to content

IIYAMA

Moderators
  • Posts

    6,060
  • Joined

  • Last visited

  • Days Won

    208

Everything posted by IIYAMA

  1. local mapX = clickX / map["size"] * 6000 - 3000 local mapY = clickY / map["size"] * -6000 + 3000 Try this. Afaik the left + bottom is -3000, -3000. The right + top is 3000, 3000. And the center is 0, 0.
  2. if aX > (x / 2 - map["size"] / 2) and aX < (x / 2 + map["size"] / 2) and aY > (y / 2 - map["size"] / 2) and aY < (y / 2 + map["size"] / 2) then end local clickX = aX - (x / 2 - map["size"] / 2) local clickY = aY - (y / 2 - map["size"] / 2) local mapX = clickX / map["size"] * 6000 local mapY = clickY / map["size"] * 6000 Everything is untested.
  3. https://wiki.multitheftauto.com/wiki/OnClientClick string button, string state, int absoluteX, int absoluteY, float worldX, float worldY, float worldZ, element clickedWorld float worldX, float worldY, float worldZ, element clickedWorld https://wiki.multitheftauto.com/wiki/GetScreenFromWorldPosition float float getScreenFromWorldPosition ( float x, float y, float z, [ float edgeTolerance=0, bool relative=true ] )
  4. local serial = getPlayerSerial( source ) local accounts = getAccountsBySerial( serial ) if accounts and #accounts > 1 then outputChatBox("You have an account and your data will now be transferred to the new one.", source, 50, 255, 200) local dataSafe = {} --Empty table to save data for i=1, #accounts do local account = accounts[i] local allAccountData = getAllAccountData( account ) local accountName = getAccountName(account) for key, value in pairs ( allAccountData ) do dataSafe[#dataSafe + 1] = {accountName, key, value} end end for i=1, #dataSafe do --Outside my for to cycle through accounts is where I will merge data, for now it prints the table local name, k, v = dataSafe[i][1],dataSafe[i][2],dataSafe[i][3] --So it does index them, BUT, it indexes as nil... outputChatBox(tostring(name)..""..tostring(k)..""..tostring(v), source) --As you can see when it prints end end There is also this function: (if you are interested in moving/replace data. Never used it, so I do not know how it will merge) https://wiki.multitheftauto.com/wiki/CopyAccountData
  5. Might help, might not. https://wiki.multitheftauto.com/wiki/SetHelicopterRotorSpeed https://wiki.multitheftauto.com/wiki/SetAircraftMaxVelocity https://wiki.multitheftauto.com/wiki/SetElementVelocity
  6. Lol, seems like you had too many rage-quit's. Well, you can use the /disconnect command to access it.
  7. Order matters: (the computer reads from top to bottom) triggerServerEvent("PonerCortina", resourceRoot, paintjobID, color) --This does not work local color = "nada" local color = "nada" triggerServerEvent("PonerCortina", resourceRoot, paintjobID, color) You still didn't fix this: - local vehicle = getPedOccupiedVehicle( source ) local vehicle = getPedOccupiedVehicle( client ) It is client, not source. If it doesn't work, then manually debug it...(tutorial) Because I do not know where I have to look for issues.
  8. local color = "red" triggerServerEvent("PonerCortina", resourceRoot, paintjobID, color) function Cortina1(paintjobID, color) local player = client -- ... triggerClientEvent (root, "setShader", resourceRoot, paintjobID, color) end addEvent("PonerCortina", true) addEventHandler("PonerCortina", resourceRoot, Cortina1) ? function addPaintjob2(paintjobID, color) outputChatBox("the color is:" .. color) if color == "red" then -- set the red shader elseif color == "blue" then -- set the blue shader ETC. end end addEvent( "setShader", true ) addEventHandler( "setShader", resourceRoot, addPaintjob2 ) I just send the string "red" from clientside to serverside. And from serverside back to clientside for all players. If the string is "red" then set your red shader. Same goes for the color blue. (But you can't pass textures)
  9. If you do not know lua, then this is not what you should be learning. Start with lua. And just to be clear, we are not here to donating code to charity Alonemta... so stop begging, it is really a shameful and abusive matter.
  10. @HairyMeets function keyDetection (key, keyState) iprint("key:", key, ", keystate:", keyState) end bindKey ( "arrow_u", "down", keyDetection ) bindKey ( "arrow_d", "down", keyDetection ) Untested, but should activate a single function with the keys arrow UP and DOWN. (clientside)
  11. See example of this page: https://wiki.multitheftauto.com/wiki/SetPedCanBeKnockedOffBike
  12. That is because you are not doing anything related to passing colours. Neither it is clear to me where those colours are.
  13. Try to use an online tool to reconvert the font to True Type. It is probably containing some extra font information which MTA doesn't like.
  14. local vehicle = getPedOccupiedVehicle( source ) local vehicle = getPedOccupiedVehicle( client )
  15. Use client instead of source. (Line 5) Source is in this case the resourceRoot and not a player. And NO screaming TO ME! Or you get it 10x back.
  16. Element data - Uses less data - Slow - Target players can't be specified. - Latent variant not available. Trigger event. - Uses much more data - Much faster - Target players can be specified.(data reduction) - Latent variant available. (Not blocking the network) To be honest, I prefer to use the latent trigger, even though it might be very annoying for players with slow internet. But it works for me best, because the players will not teleport so much.
  17. IIYAMA

    Round Robin

    Please give me some context about how it overlaps, it makes it easier for me to find the problem. self.endPos = self.startPos+self.maxItems Also this should be limited to the total items in the gridlist for performance reasons. (Unless you do add a grid) Debug the yOff variable for every item, just to be sure that the problem is here.(and show result)
  18. triggerServerEvent("PonerCortina", resourceRoot, paintjobID) function Cortina1(paintjobID) local player = client -- ... triggerClientEvent (root, "setShader", resourceRoot, paintjobID) end addEvent("PonerCortina", true) addEventHandler("PonerCortina", resourceRoot, Cortina1) function addPaintjob2(paintjobID) end addEvent( "setShader", true ) addEventHandler( "setShader", resourceRoot, addPaintjob2 )
  19. You can reduce data with sending only updates from the table instead of a copy of the table. As triggerEvents always reach their targets in order. So when they join, you send them the whole table and after that you send them only updates. <Tested> Using a single timer on serverside, will also help you to send multiple updates at once. If you use multiple timers then the amount of triggers will increase. A check rate of 150 ms would be fine. (but of course there will be only be triggers when there are updates) It might use more memory/cpu at the end, but it gives you the ability to reduce data and having your workflow starting from one function.
  20. Reloading health happens when you are setting the health below 0. But the main issue is with the reduction of loss. Because with this code the health should never reach 0 in the first place. The loss can never be higher then the remaining health. Which means that if you have 1 health, the damage is 1000 but the loss will remain 1. If you reduce the loss with 50%. 1 health / 2 = 0.5 / 2 = 0.25 / 2 = 0.125 etc. Until mta thinks you are dead... And yes it can be a little bit buggy sometimes for an unknown reason, which doesn't happen really often if you write the code correct.
  21. It clearly says that the truck isn't an element. Use the isElement function to check if the value of the elementdata is still an element. Because there are not elements saved in to the LUA memory. But reference to the elements are. Which means that if an element is the destroyed, the reference is not. So it keeps it's positive value. An if statement that only checks if the value is not or false will not work. This is the only way of validating elements that exist longer in-game. if isElement(variable) then
  22. You will not find support for shampoo here. Since it is clearly something not related to MTA.
×
×
  • Create New...