Jump to content

IIYAMA

Moderators
  • Posts

    6,089
  • Joined

  • Last visited

  • Days Won

    216

Everything posted by IIYAMA

  1. IIYAMA

    topbarchat

    There is no need to do complex stuff. It can be very simple if you spend some time on finding a logic solution. Untested code. local blockSize = (sY / 900) * 10 Define the block size local index = #dxMessages + 1 dxMessages[index] = {message = "hi"} -- set position data dxMessages[index].positionY = blockSize * (index - 1) Define it's position if item is added last local index = 1 -- move all items 1 down for i=1, #dxMessages do dxMessages[i].positionY = dxMessages[i].positionY + blockSize end -- insert at the start of the table and push all other items to the next index. table.insert(dxMessages, index, {message = "hi"}) -- set position data dxMessages[index].positionY = blockSize Define it's position(s) if item is added first. While rendering: for index = 1, #dxMessages do local messageData = dxMessages[index] end --reverse for index = #dxMessages, 1, -1 do local messageData = dxMessages[index] end Just use a normal loop. So you have full control over it. And now you can rock! Box/text from bottom to top. Please edit to your layout. dxDrawRectangle(sX / 4 + 1, sX - blockSize, (sX / 4) * 3 + 1, 0, tocolor(0, 0, 0, 93), false) Loop local startX, startY = sX / 4 + 1, sY - messageData.positionY - blockSize local endX, endY = (sX / 4) * 3 + 1, startY - blockSize * #dxMessages dxDrawText(messageData.message, startX, startY, endX, endY, tocolor(0, 0, 0, 255), (sX / 1440) * 1.1, "default-bold", "center", "center", false, true, false) Something like that...
  2. It is indeed a big problem. Optional. You can tell all players that are closeby that a projectile is created. (Which you can attach to an element serverside to get full control. ) When it blows up at one of the clients, you can tell all other clients to move their projectile to the right position and detonate it. It is not 100/100, but it can be considered as a kind of synchronization/validation.
  3. IIYAMA

    topbarchat

    Where is your rectangle?
  4. @LeroY https://wiki.multitheftauto.com/wiki/GetElementBoundingBox Bounding box. Please read the information carefully.
  5. IIYAMA

    XML Join

    @anufis_ok Check if a player is logged-in with: https://wiki.multitheftauto.com/wiki/IsGuestAccount
  6. The maps that are exported from the map editor do have a script to make this possible. But of course without understanding lua, you will not be able to achieve this if the end format isn't the same.
  7. Maybe it is related to the protocol. (Http/https) Or try to define the head, as they both might try to request different formats. That is all I can think of.
  8. When using the variables like playerName inside of the loop, you will have to redeclare the as a local variable in order to prevent them from being overwritten. (The variable name can be the same) local playerName = "iiyama" do -- in your case your loop local playerName = playerName .. "-alex" -- modifi iprint(playerName) -- iiyama-alex end iprint(playerName) -- iiyama
  9. yea you can do that. Or just using 1 table. And start looping at a different index. for i=math.max(#chatbox - 13, 1), #chatbox do local v = chatbox[i] end (not sure if you have to use: - 12, - 13 or - 14 to accomplish this)
  10. elseif (i > 13) then table.remove(chatbox, 1)-- delete the first item, and move all higher items one down. end I thought you wanted to insert items at the beginning.
  11. You are filling your table with infinity items. elseif (i > 13) then local value = chatbox[i] -- get the value chatbox[i] = nil -- delete the item table.insert(chatbox, 1, value) -- re-insert end
  12. table.insert(chatbox, 1, newItem) This is how you can insert items in to the first index and move the rest of the items up. (Couldn't merge anymore with previous post)
  13. chatbox[#chatbox + 1] = newItem #chatbox returns the table lengte. See table.insert for inserting on to the first item.
  14. IIYAMA

    Anti-Cheat Corner

    @ccw In case of a competitive game mode. Which special detections would you recommend to turn on? And would enable #31 #32 make it impossible for some players to play the game? This looks like it is blocking of people with macro/binding tools. Not sure if it also would block macro's created by hardware. (like the logitech g502)
  15. function replacepaintjob() local paintjob1 = engineLoadTXD ( "elegy1.txd" ) engineImportTXD (paintjob1, 562) local paintjob2 = engineLoadTXD ( "elegy2.txd" ) engineImportTXD (paintjob2, 562) local paintjob3 = engineLoadTXD ( "elegy3.txd" ) engineImportTXD (paintjob3, 562) end I haven't replaced paintjobs myself, but this will solve some syntax errors in your code. And make sure that all 3 files are written down in the meta.xml: https://wiki.multitheftauto.com/wiki/Meta.xml <file src="elegy1.txd" /> <file src="elegy2.txd" /> <file src="elegy3.txd" />
  16. 1. Not error proof: if getElementType ( attacker ) == "ped" then 2. More error proof: if attacker and getElementType ( attacker ) == "ped" then 3. 100/100 error proof if isElement(attacker) and getElementType ( attacker ) == "ped" then But the function isElement isn't always needed, because sometimes MTA functions/events give you either an element back or false/nil back. Which means I would rather pick option 2, for the optimization of my code. In some cases while using variables/elementdata to store data for later, only option 3 will work. Yet sometimes you do not want to check for the element type, if you know what you have stored. So in the end, lets strip it to the basic: 1. Not error proof: --nothing 2. More error proof: if element then 3. 100/100 error proof if isElement(element) then
  17. If that is the case, then start with asking permission first. And if they do not reply, then you do not have permission to: View / edit / etc. their code And yes, it is about respect when you do something without the owner their permission.
  18. Please have some respect for others people their code. They didn't encrypt it for no reason.
  19. fontforge can edit/export fonts like you want. I do not recommend you to do that, unless you know this tool and can work with it. It is very complex and I am only using it to convert old print/printer fonts to convert them to use-able formats for other media. What I do recommend you, is to search for a font-family which looks like the default-bold font. This page says that the default-bold font from gui's is this font: Tahoma bold, 8px As well as this page for dx fonts: "default-bold": Tahoma Bold Finding a similar looking fonts: https://www.myfonts.com/WhatTheFont/ Fonts (a lot of them are free with licence): https://www.dafont.com/ Good luck
  20. Why not use an outline font?
  21. Debug the: response variable. https://wiki.multitheftauto.com/wiki/GetServerIp
  22. IIYAMA

    "got vehicle"

    You can't apply control states directly on to vehicles. You can only apply it on to players. (Or peds with another function) In your case you have to use a ped with this function: https://wiki.multitheftauto.com/wiki/SetPedControlState
  23. IIYAMA

    Problem in code

    You may haven't notice it, but you are making an unwanted request. Please read the scripting section rules, to understand why this request is unwanted. Good luck with learning lua.
  24. v.turfArea Is nil. Normally you would inspect your table structure first: iprint(turfElement) Save everything first. turfElement[idZone] = {turfCol = turfCol, turfArea = turfArea, idZone = idZone, gX = v.gX, gY = v.gY, gtSizeX = v.gtSizeX, gtSizeY = v.gtSizeY } Then this might work. for idZone,v in pairs(turfElement) do outputChatBox("" .. v.gX .. "", player, 255, 255, 255) end
  25. IIYAMA

    Chat Write

    You are making an unwanted request. Please read and mind the forum rules before posting. Feel free to ignore this post, but keep in mind that people might not like you any more. Good luck with learning lua, here is a good start point:
×
×
  • Create New...