Jump to content

GTX

Members
  • Posts

    1,273
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by GTX

  1. It's not good to put elements into XML file. handlingtable must be in same script as your 'for' loop. local vehicle = getPedOccupiedVehicle(hitElement) local handlingsTable = {} handlingtable = { "mass", "turnMass", "dragCoeff", "centerOfMass", "percentSubmerged", "tractionMultiplier", "tractionLoss", "tractionBias", "numberOfGears", "maxVelocity", "engineAcceleration", "engineInertia", "driveType", "engineType", "brakeDeceleration", "brakeBias", "ABS", "steeringLock", "suspensionForceLevel", "suspensionDamping", "suspensionHighSpeedDamping", "suspensionUpperLimit", "suspensionLowerLimit", "suspensionFrontRearBias", "suspensionAntiDiveMultiplier", "seatOffsetDistance", "collisionDamageMultiplier", "monetary", "modelFlags", "handlingFlags", "headLight", "tailLight", "animGroup" } for i=1, #handlingtable do local dvalue = getVehicleHandling(vehicle)[handlingtable[i]] table.insert(handlingsTable, dvalue) end xmlNodeSetAttribute(datanode, "handling", toJSON(handlingsTable)) And hitElement should be defined. And datanode also.
  2. Weird. Maybe you're overriding table function? Try using handlingsTable[#handlingsTable+1] = dvalue
  3. Need more information; is it still the same error? Use onClientResourceStart and under that, trigger server event. (So when resource starts -> the server side is loaded)
  4. Shooting in MTA is pretty badly synchronized so it would be awesome to have custom shooting system. Good luck!
  5. I'd use shaders, mostly because of size. I think shader is much more likely to fail, because client needs to have video RAM available. If client doesn't have available video RAM, then shader will fail to load (in that case, you can do something like a check; if shader fails to load you can download using downloadFile and load TXD). TXDs never fail to load actually, might be because of the code or corrupt TXD.
  6. Hmm, it is possible. https://bugs.mtasa.com
  7. Alternate version with no loops. function commaNumber(n) local left, num, right = string.match(n, "^([^%d]*%d)(%d*)(.-)$") return left..(num:reverse():gsub("(%d%d%d)", "%1,"):reverse())..right end
  8. Make your own downloader or use: <download_priority_group/> If not set, the download priority group for a resource defaults to 0. If this is set higher than 0, then the resource will be downloaded and started on the client earlier than other resources. If set to less than 0, the resource will be downloaded and started on the client later than other resources. Source: https://wiki.multitheftauto.com/wiki/Meta.xml
  9. You can't always get an answer within an hour. Use getEasingValue
  10. Collision/command handler will always return element, therefore isElement check isn't needed.
  11. setTimer( function(p) setElementVelocity(p, ...) -- or whatever end, 5000, 1, source )
  12. Connect & fetch MySQL rows from server-side and once they're fetched send them to client-side, loop through them and insert them into grid list.
  13. Most efficient way would be to get some moderators which are online most of the time and ban those who advertise.
  14. They're all used to calculate position (even px and py) to fit all screens based on wiki: https://wiki.multitheftauto.com/wiki/Gu ... esolutions It's just reversed formula, the result is the same.
  15. function getIPType(ip) local R = {ERROR = 0, IPV4 = 1, IPV6 = 2, STRING = 3} if type(ip) ~= "string" then return R.ERROR end -- check for format 1.11.111.111 for ipv4 local chunks = {ip:match("(%d+)%.(%d+)%.(%d+)%.(%d+)")} if #chunks == 4 then for _,v in pairs(chunks) do if tonumber(v) > 255 then return R.STRING end end return R.IPV4 end -- check for ipv6 format, should be 8 'chunks' of numbers/letters -- without trailing chars local chunks = {ip:match(("([a-fA-F0-9]*):"):rep(8):gsub(":$","$"))} if #chunks == 8 then for _,v in pairs(chunks) do if #v > 0 and tonumber(v, 16) > 65535 then return R.STRING end end return R.IPV6 end return R.STRING end What do you mean by detect when a text contains numbers higher than 10? You could loop through text and count numbers (or do you want to know how long the string is?)
  16. Alternate version with no loops: function commaNumber(n) local left, num, right = string.match(n, "^([^%d]*%d)(%d*)(.-)$") return left..(num:reverse():gsub("(%d%d%d)", "%1,"):reverse())..right end
  17. Variables px and py must be your resolution.
  18. GTX

    getLocalization()

    https://msdn.microsoft.com/en-us/librar ... 88(v=cs.20).aspx Here are all the language codes if that's what you wanted.
  19. GTX

    Top bar chat

    There are lines with dxDrawText. Just change tocolor ( v.r, v.g, v.b, v.alpha*1.59375 ) to tocolor ( v.r, v.g, v.b, 255 )
  20. Most servers use setGameType(getMapName()) for showing which map is currently running.
  21. isTransferBoxActive dxDrawText Edit: Custom message or loading bar?
  22. What I don't understand is what is so sacred in full code that you don't show lol?
  23. You can set GUI edit's alpha and dxDrawText over it with guiGetText(edit) as text in DX function.
×
×
  • Create New...