Jump to content

Forums

  1. Multi Theft Auto: San Andreas 1.x

    1. Support for MTA:SA 1.x

      HELP! HELP! Need help? Post here.

      53k
      posts
    2. User Guides

      These guides are a good place to start learning how to achieve certain things within MTA in an efficient and well mannered way.

      11
      posts
    3. Open Source Contributors

      This space is for contributors to discuss the development of MTA. No user suggestions/support.

      1.2k
      posts
    4. Suggestions

      Suggestions and requests go here. Please note that actual feature requests must be filed on our GitHub.

      7.6k
      posts
    5. Ban appeals

      Use this forum to appeal your GLOBAL MTA:SA bans. Permanent bans only - appeals for timed ones (eg. 24 hours) will be refused.

      Do not use it for appealing server-specific bans as we do not have power over these specific servers.

      2.5k
      posts
  2. General MTA

    1. News

      News and updates on Multi Theft Auto.

      9.6k
      posts
    2. Media

      User-made screens and movies go here.

      4.4k
      posts
    3. Site/Forum/Discord/Mantis/Wiki related

      Share your comments & concerns about our services.

      5.3k
      posts
    4. MTA Chat

      MTA related chat that is NOT support related!

      2k
      posts
    5. 326.6k
      posts
  3. MTA Community

    1. Scripting

      All Lua scripting topics related to Multi Theft Auto.

      257.4k
      posts
    2. Maps

      Discussions for maps on various gamemodes.

      13.2k
      posts
    3. Resources

      Everything else about resources.

      28k
      posts
    4. Other Creations & GTA modding

      This section includes things such as GUI themes, forum userbars, user-created MTA logos, etc. Also contains topics which cover general GTA modding areas that can be used in MTA, such as modelling.

      2.2k
      posts
    5. Competitive gameplay

      Discussions about various MTA-related competitive gameplay events. Also gang (clan) forums.

      26.7k
      posts
    6. Servers

      Looking for a server to play on? Looking for someone to host your server? Looking for a place to discuss with other server owners? Here's where to look.

      15.1k
      posts
  4. Other

    1. General

      Non-MTA discussions. Anything you want.

      38k
      posts
    2. Multi Theft Auto 0.5r2

      Discussion regarding Multi Theft Auto 0.5r2 for GTAIII and Vice City.

      640
      posts
    3. Third party GTA mods

      Showcase for single player mods and requests.

      771
      posts
  5. Archive

    1. 144k
      posts
    2. Trash

      These posts have broken forum rules. They are stored here temporarily so offending users can see what they have done wrong.

      1.9k
      posts
  • Posts

    • Thank you very much, works yeah it works
    • Surely it is because of your version of VPS, in my case I did not have any problem, the update works very well for me. I am using ubuntu 18.04
    • executeSQLCreateTable ("huntertimes","map TEXT,name TEXT,serial TEXT,country TEXT,country2 TEXT,date TEXT,time INT") local HunterTable = {} local function getTopPos(time,map) local rank = executeSQLQuery("SELECT count(*)+1 as rank FROM huntertimes WHERE time < "..time.." and map='"..map.."' LIMIT 1") return rank[1].rank end local function msToTimeStr(ms) local centiseconds = tostring(math.floor(math.fmod(ms,1000)/10)) if #centiseconds == 1 then centiseconds = '0' .. centiseconds end local s = math.floor(ms/1000) local seconds = tostring(math.fmod(s,60)) if #seconds == 1 then seconds = '0'..seconds end return tostring(math.floor(s/60))..':'.. seconds ..':'..centiseconds end local function getDate() local time = getRealTime() local m = time.month+1 local d = time.monthday if tonumber(d) < 8 then d = "0"..d end if tonumber(m) < 8 then m = "0"..m end return d.."."..m.."."..tostring(tonumber(time.year)+1900) end function HexToRGB(hex) local hex = hex:gsub("#","") return tonumber("0x"..hex:sub(1,2)), tonumber("0x"..hex:sub(3,4)), tonumber("0x"..hex:sub(5,6)) end local function rDarkColor(str) local hexpos = string.find(str,"#%x%x%x%x%x%x") if hexpos then local hex = string.sub(str,hexpos,hexpos+6) local r,g,b = HexToRGB(hex) if 60 > r and 60 > g and 60 > b then str = string.gsub(str,hex,"") end hexpos2 = string.find(str,"#%x%x%x%x%x%x",4) if hexpos2 then local hex2 = string.sub(str,hexpos2,hexpos2+6) local r2,g2,b2 = HexToRGB(hex2) if 60 > r2 and 60 > g2 and 60 > b2 then str = string.gsub(str,hex2,"") end end end return str end local function createLocalTopTable(player,map) local table = {false} local accountname = getPlayerSerial(player) local t = executeSQLQuery("SELECT time,name,date,country2 FROM huntertimes WHERE serial='"..accountname.."' AND map='"..map.."' LIMIT 1") if t[1] then table = {msToTimeStr(t[1].time),rDarkColor(t[1].name),t[1].date,t[1].country2,getTopPos(t[1].time,map)} end return table end local function createTopTable(map) local table = {} local amount = 0 local te = {"--Empty--","","",""} local t = executeSQLQuery("SELECT time,name,date,country2 FROM huntertimes WHERE map='"..map.."' ORDER BY time ASC LIMIT 8") local hm = executeSQLQuery("SELECT count(*) as count FROM huntertimes WHERE map='"..map.."' LIMIT 1") amount = hm[1].count local i = 0 while i ~= 8 do i = i + 1 if t[i] then table[i] = {msToTimeStr(t[i].time),rDarkColor(t[i].name),t[i].date,t[i].country2} else table[i] = te end end table[12] = {type,string.sub(map.."("..amount.." tops)",1,44)} return table end addEvent("onClientWantRanking",true) addEventHandler("onClientWantRanking",root, function(player) local map = string.gsub(getElementData(player,"Map"),"[(')]+","") local ranking = createTopTable(map) ranking[11] = createLocalTopTable(player,map) triggerClientEvent(player,"onServerSendRanking",player,ranking) end) addEvent("onRaceStateChanging",true) addEventHandler("onRaceStateChanging", root, function(new,old) if new == "LoadingMap" then setTimer(function() HunterTable = {} end,1000,1) setTimer(function() local map = string.gsub(getMapName(),"[(')]+","") local ranking = createTopTable(map) for k,v in ipairs(getElementsByType("player")) do if getElementData(v,"state") and getElementData(v,"state") == "alive" then local t = ranking t[11] = createLocalTopTable(v,map) triggerClientEvent(v,"onServerSendRanking",v,t) end end end,8000,1) end end) local block = {}; function removeBlock(player) block[player] = nil; end function addTT(time,source) if not block[source] then block[source] = true; setTimer(removeBlock,20000,1,source); local map = string.gsub(getElementData(source,"Map"),"[(')]+","") local pos = getTopPos(time,map) if not string.find(map,"Hunter") then outputChatBox("#BF4343*[Map] #ffffff "..map,root,255,255,255,true) if pos == 1 then outputChatBox("#BF4343*[Hunter]#ffffff "..getPlayerName(source).."#ffffff has made the #00ff00WORLD RECORD #ffffffwith time "..msToTimeStr(time),root,255,255,255,true) else outputChatBox("#BF4343*[Hunter]#ffffff "..getPlayerName(source).."#ffffff has got the hunter #BF4343["..msToTimeStr(time).."]#ffffff and pos. #BF4343["..pos.."]",root,255,255,255,true) end end local accountname = getPlayerSerial(source) local result = executeSQLQuery("SELECT time FROM huntertimes WHERE serial='"..accountname.."' AND map='"..map.."' LIMIT 1") if not result[1] then executeSQLInsert ("huntertimes", "'"..map.."','"..string.gsub(getPlayerName(source),"[(')]+","").."','"..accountname.."','"..tostring(getElementData(source,"country") or "Europe").."','"..tostring(getElementData(source,"Country") or "EU").."','"..getDate().."',"..time.."") else if result[1].time > time then executeSQLUpdate("huntertimes","time = "..time..",name = '"..string.gsub(getPlayerName(source),"[(')]+","").."'","serial='"..accountname.."' AND map='"..map.."'") end end local ranking = createTopTable(map) ranking[11] = createLocalTopTable(source,map) triggerClientEvent(source,"onServerSendRanking",source,ranking) triggerClientEvent(source,"onServerSendRanking2",source,ranking) end end Error on line 94 = local map = string.gsub(getElementData(player,"Map"),"[(')]+","")  error 
    • It is  updateState(value, total, radius), like updateState(50, 100, 250) should give half a circle. It could be edited to remove radius param in our case. This is the way I update the svg :  local function setProgress(value) local svgXML = svgGetDocumentXML(mySvg) -- get xml local path = xmlNodeGetChildren(svgXML, 1) -- get path node (second node, following first example I gave) xmlNodeSetAttribute(path, "d", updateState(value, 100, 250)) -- editing the attribute svgSetDocumentXML(mySvg, svgXML) -- saving end You could imagine a command to test it like : local function startDemo() local value = 0 setTimer(function() value = value + 1 setProgress(value) end, 10, 100) end addCommandHandler("demo", startDemo) A little animation 0 to 100 % of the circle progress.
    • I tried to use this function, but unfortunately I didn't quite understand how to use it :(((   local rawSvgData = [[ <svg viewBox="0 0 600 600" xmlns="http://www.w3.org/2000/svg"> <defs> <linearGradient id="gradient"> <stop offset="5%" stop-color="#FF0000" /> <stop offset="95%" stop-color="#00FF00" /> </linearGradient> </defs> <path id="progress" fill="none" stroke="url(#gradient)" d="M300,50 A250,250,0,1,1,299.99,50" stroke-width="20" /> </svg> ]] local svgs = {} local function render(svg) if (not isElement(svg)) or (getElementType(svg) ~= "svg") then removeEventHandler("onClientRender", root, svgs[svg].handler) svgs[svg] = nil end local width, height = svgGetSize(svg) dxDrawImage(500, 500, 430, 430, svg, 0, 0, 0, tocolor(255, 255, 255), false) end local function onUpdate(svg) print("fe") if (not svgs[svg]) then svgs[svg] = { state = true, handler = function() render(svg) end } addEventHandler("onClientRender", root, svgs[svg].handler) end iprint("SVG texture updated", svg, getTickCount()) end addEventHandler("onClientResourceStart", root, function() mySvg = svgCreate(430, 430, rawSvgData, onUpdate) end) bindKey("l", "down", function() local newPath = updateState(100, 100, 300); addSVGRectNode(mySvg, path) end) function addSVGRectNode(svg, path) local svgXML = svgGetDocumentXML(svg) local rect = xmlCreateChild(svgXML, "rect") xmlNodeSetAttribute(rect, "d", path) local status = svgSetDocumentXML(svg, svgXML) print(status) end function updateState(value, total, R) local center local alpha = 360 / total * value local a = (90 - alpha) * math.pi / 180 local x = 300 + R * math.cos(a) local y = 300 - R * math.sin(a) local path if (total == value) then path = "M300,"..(300 - R).." A"..R..","..R..",0,1,1,299.99,"..(300 - R) else if (alpha > 180) then center = 1 else center = 0 end path = "M300,"..(300 - R).." A"..R..","..R..",0,"..center..",1,"..x..","..y end return path end The problem is that for some reason I can't change the source data of the svg file already (I tried to do as you said, well, for some reason it doesn't work) - besides, I didn't quite understand working with the arguments of this function, let's say I tried to manually call the function and replace the arguments the same as from the debug, but this it didn't work quite correctly, maybe I didn't quite understand the principle of these arguments of this function, what is responsible for what. Please help me

Twitter Feed

×
×
  • Create New...