Jump to content

SuleymanM

Members
  • Posts

    306
  • Joined

  • Last visited

Posts posted by SuleymanM

  1. Hi all,

    Today to my server people can't join. Not appear in "Server Browser". I wait 5hours and not appear.

    But i can join on my ip 79.......:22003 (not local!!)

    Yesterday function ... already resource and all!

    I have not changed anything.

    And in cmd my ipv4 is: 192.***.***.101

    But Forward =192.***.***.101 :

    22003 - UDP

    22126 - UDP

    22005 - TCP

    But i Open server and start DUc. no-ip

  2. --- dash_client.lua

    ------------------------------ 
    --
    --      Dashboard by Xiti
    --
    ------------------------------
     
    --141,182,205  #8DB6CD
     
     
    sX,sY = guiGetScreenSize()
    scale = (sX/1920)*(sY/1200)
     
     
    gui_widnows = {
        guiCreateWindow(0,0,640,480,"",false),
        guiCreateWindow(0,0,640,480,"",false)
    }
     
    for i,window in pairs(gui_widnows) do
        guiSetPosition(window,sX/2-640/2,sY/2-480/2,false)
        guiWindowSetMovable(window,false)
        guiWindowSetSizable(window,false)
        guiSetVisible(window,false)
        guiSetAlpha(window,0)
    end
     
    interface = {
        pos = {sX/2-640/2,sY/2-480/2},
        globalClickBlock = false,
        news = {
                title = {"","","",""},
                data = {"","","",""},
                info = {"","","",""},
                members = ""
            },
        stats = {
            tab = 1,
            player = {
                button = createElement("button"),
                gridlist = createElement("gridlist"),
                gridData = {},
                gridPos = 1,
                gridSel = 0,
                labels = {"Money: $","EXP: ","Toptimes: ","Hunters: ","Maps played: ","Total maps won: ","Total deaths: ","Highest winstreak: ","Total spins: ","Total bets: ","Time spent: ","Times joined: "},
                value = {0,0,0,0,0,0,0,0,0,0,0,0},
                name = getPlayerName(localPlayer),
            },
            leaderboard = {
                buttons = {createElement("button")},
                choose = createElement("choose"),
                chooseData = {"Money & EXP","Hunters & Toptimes","Maps won & Deaths","Time spent & Winstreak"},
                chooseCurrent = 1,
                labels = {"Money","EXP","Hunters","Toptimes","Maps won","Deaths","Time spent","Winstreak"},
                name = {{"#00AAFF?","","","","","","","","","","","","","","",""},{"","","","","","","","","","","","","","","",""}},
                value = {{"$10000","","","","","","","","","","","","","","",""},{"","","","","","","","","","","","","","","",""}}
            },
        },
        maps = {
            tab = 1,
            buttons = {createElement("button"),createElement("button"),createElement("button"),},
            gridlist = createElement("gridlist"),
            maps = {},
            gridData = {},
            gridPos = 1,
            gridSel = 0,
            input = guiCreateEdit(20,60,220,30,"",false,gui_widnows[1]),
            mapLabel = {"Map name: ","Author: ","Last time played: ","Times played: ","Toptimes: ","Hunters: ","Likes: "},
            mapData = {"Not available","Not available","Not available","Not available","Not available","Not available","Not available"},
            topName = {"Empty","Empty","Empty"},
            topTime = {"30:00:000","30:00:000","30:00:000"},
            queue = {},
        },
        tune = {
            color = {{255,255,255},{125,125,125},{0,0,0}},
            buttons = {createElement("button"),createElement("button"),createElement("button"),createElement("button"),createElement("button"),createElement("button"),createElement("button")},
            buttonLabel = {"buy police headlights - $80000","buy disco headlights - $100000","buy black&white - $200000","buy poison - $200000"},
            label = {"Police headlights - ","Disco headlights - ","Black & White - ","Poison car color - "},
            state = {"not bought","not bought","not bought","not bought"},
            info = {"This feature chnage your headlights color like police.","Random headlights colors, changing all the time.","Car color chaning from black to blue and vice versa.","Car color changing all the time from green to yellow."},
        },
        options = {
            title = {
                "water shader","car paint shader","hdr shader","bloom shader","new infernus skin",
            },
            state = {
                "#dd1111disabled","#dd1111disabled","#dd1111disabled","#dd1111disabled","#dd1111disabled"
            },
            info = {
                "this shader makes your old water look more relistic.",
                "makes all car paint more shiny.",
                "this tehnique change your all game to makes it more realistic.",
                "makes all lights in game more shiny.",
                "option this change your old GTA SA infernus skin to a new one.",
            },
            buttonLabel = {
                "enable","enable","enable","enable","enable"
            },
            buttons = {createElement("button"),createElement("button"),createElement("button"),createElement("button"),createElement("button")}
        },
        donator = {
            status = false,
            time = "N/A",
            tab = 1,
            text = "Test",
            statusText = "#dd1111INACTIVE",
            time = "N/A",
            buttons = {createElement("button"),createElement("button"),createElement("button"),createElement("button"),createElement("button"),createElement("button"),createElement("button"),createElement("button"),createElement("button"),createElement("button")},
            labels = {"rainbow car color - ","rainbow headlights - ","black to red car color - ","red to yellow car color - ",
                        "custom wheels - ","skidmark shader - ","",""},
            state = {"#dd1111disabled","#dd1111disabled","#dd1111disabled","#dd1111disabled","#dd1111disabled","#dd1111disabled","#dd1111disabled","#dd1111disabled"},
            buttonLabels = {"enable","enable","enable","enable","enable","enable","enable","select"},
            deatilLabel = {"this special feature change your car color all time like rainbow colors.","this special feature change your headlights color all time like rainbow colors.",
                            "this special option chnage your car color from black to red and vice versa.","this special option change your car color from red to yellow and vice versa.",
                            "this special feature change your all default wheels from GTA SA to a new one. 4MB will be downloaded.","this option will chnage your default skidmarks from GTA SA to new colored." },
        },
    }
     
    local leaderTable = {
        "cash","points","totalHunters","totalToptimes","mapsWon","totalDeaths","playingTime","highestWinstreak"
    }
     
    guiSetProperty(interface.maps.input,"InheritsAlpha","False")
     
    function onPlayerStartDashboard()
        loadNews()
        readDonatorText()
        callServerFunction("getServerMaps",getLocalPlayer())
        setTimer(loadOptionsFromXML,1000,1)
        callServerFunction("getPlayerStats",getLocalPlayer(),localPlayer)
        callServerFunction("getTopList",localPlayer,leaderTable[interface.stats.leaderboard.chooseCurrent*2-1],1)
        callServerFunction("getTopList",localPlayer,leaderTable[interface.stats.leaderboard.chooseCurrent*2],2)
    end
    addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),onPlayerStartDashboard)
     
    function drawInterface()
        if isCursorShowing() and window.draw then
            local x,y = getCursorPosition()
            local x,y = x*sX,y*sY
            if window.current == 7 then
                dxDrawText("news",interface.pos[1],interface.pos[2],interface.pos[1]+640,interface.pos[2]+42,tocolor(255,255,255,255),2,"default-bold","center","center")
                dxDrawText("Newest informations about server:",interface.pos[1],interface.pos[2]+50,interface.pos[1]+400,interface.pos[2]+80,tocolor(255,255,255,255),1.5,"default-bold","center","center")
                dxDrawText("Our members:",interface.pos[1]+400,interface.pos[2]+50,interface.pos[1]+630,interface.pos[2]+80,tocolor(255,255,255,255),1.5,"default-bold","center","center")
                dxDrawRectangle(interface.pos[1]+405,interface.pos[2]+80,220,395,tocolor(0,0,0,100))
                dxDrawText(interface.news.members,interface.pos[1]+400,interface.pos[2]+90,interface.pos[1]+630,interface.pos[2]+430,tocolor(255,255,255,255),1,"default-bold","center","top",false,false,false,true)
                for i=1,#interface.news.title do
                    dxDrawRectangle(interface.pos[1]+20,interface.pos[2]+80+(100*(i-1)),380,95,tocolor(0,0,0,100))
                    dxDrawText(interface.news.title[i],interface.pos[1]+30,interface.pos[2]+80+(100*(i-1)),interface.pos[1]+390,interface.pos[2]+80+(100*(i-1))+30,tocolor(141,182,205,255),1.2,"default-bold","left","center")
                    dxDrawText(interface.news.data[i],interface.pos[1]+30,interface.pos[2]+80+(100*(i-1)),interface.pos[1]+390,interface.pos[2]+80+(100*(i-1))+30,tocolor(141,182,205,255),1.2,"default-bold","right","center")
                    dxDrawText(interface.news.info[i],interface.pos[1]+30,interface.pos[2]+80+(100*(i-1))+30,interface.pos[1]+390,interface.pos[2]+80+(100*(i-1))+90,tocolor(255,255,255,255),1,"default-bold","left","top",true,true,false)
                end
            end
            if window.current == 4 then
                if interface.stats.tab == 1 then
                    dxDrawText("player stats",interface.pos[1],interface.pos[2],interface.pos[1]+640,interface.pos[2]+42,tocolor(255,255,255,255),2,"default-bold","center","center")
                    createButton(interface.pos[1]+10,interface.pos[2]+5,"leaderboards",interface.stats.player.button)
                    createGridlist(interface.pos[1]+20,interface.pos[2]+60,220,400,interface.stats.player.gridlist,interface.stats.player.gridData,interface.stats.player.gridPos,interface.stats.player.gridSel,true)
                    for i=1,#interface.stats.player.labels do
                        dxDrawText(interface.stats.player.labels[i]..interface.stats.player.value[i],interface.pos[1]+280,interface.pos[2]+160+(20*(i-1)),interface.pos[1]+620,interface.pos[2]+160+(20*i),tocolor(255,255,255,255),1,"default-bold","left","center")
                    end
                    dxDrawText("Looking stats for player: \n"..string.gsub(interface.stats.player.name,"#%x%x%x%x%x%x",""),interface.pos[1]+281,interface.pos[2]+62,interface.pos[1]+620,interface.pos[2]+160,tocolor(0,0,0,255),2,"default-bold","left","center",false,false,false,false)
                    dxDrawText("Looking stats for player: \n"..interface.stats.player.name,interface.pos[1]+280,interface.pos[2]+60,interface.pos[1]+620,interface.pos[2]+160,tocolor(255,255,255,255),2,"default-bold","left","center",false,false,false,true)
                else
                    dxDrawText("leaderboard",interface.pos[1],interface.pos[2],interface.pos[1]+640,interface.pos[2]+42,tocolor(255,255,255,255),2,"default-bold","center","center")
                    createButton(interface.pos[1]+10,interface.pos[2]+5,"stats",interface.stats.leaderboard.buttons[1])
                    dxDrawRectangle(interface.pos[1]+20,interface.pos[2]+110,295,350,tocolor(0,0,0,100))
                    dxDrawRectangle(interface.pos[1]+325,interface.pos[2]+110,295,350,tocolor(0,0,0,100))
                    dxDrawRectangle(interface.pos[1]+20,interface.pos[2]+110,295,30,tocolor(0,0,0,100))
                    dxDrawRectangle(interface.pos[1]+325,interface.pos[2]+110,295,30,tocolor(0,0,0,100))
                    dxDrawText(interface.stats.leaderboard.labels[interface.stats.leaderboard.chooseCurrent*2-1],interface.pos[1]+20,interface.pos[2]+110,interface.pos[1]+20+295,interface.pos[2]+110+30,tocolor(255,255,255,255),1.2,"default-bold","center","center")
                    dxDrawText(interface.stats.leaderboard.labels[interface.stats.leaderboard.chooseCurrent*2],interface.pos[1]+325,interface.pos[2]+110,interface.pos[1]+325+295,interface.pos[2]+110+30,tocolor(255,255,255,255),1.2,"default-bold","center","center")
                    for i=1,16 do
                        dxDrawText(i..". "..interface.stats.leaderboard.name[1][i],interface.pos[1]+30,interface.pos[2]+140+(20*(i-1)),interface.pos[1]+10+295,interface.pos[2]+160+(20*(i-1)),tocolor(255,255,255,255),1,"default-bold","left","center",false,false,false,true)
                        dxDrawText(interface.stats.leaderboard.value[1][i],interface.pos[1]+30,interface.pos[2]+140+(20*(i-1)),interface.pos[1]+10+295,interface.pos[2]+160+(20*(i-1)),tocolor(255,255,255,255),1,"default-bold","right","center")
                        dxDrawText(i..". "..interface.stats.leaderboard.name[2][i],interface.pos[1]+335,interface.pos[2]+140+(20*(i-1)),interface.pos[1]-20+295+335,interface.pos[2]+160+(20*(i-1)),tocolor(255,255,255,255),1,"default-bold","left","center",false,false,false,true)
                        dxDrawText(interface.stats.leaderboard.value[2][i],interface.pos[1]+335,interface.pos[2]+140+(20*(i-1)),interface.pos[1]-20+295+335,interface.pos[2]+160+(20*(i-1)),tocolor(255,255,255,255),1,"default-bold","right","center")
                        --dxDrawText(interface.stats.leaderboard.labels[interface.stats.leaderboard.chooseCurrent*2],interface.pos[1]+325,interface.pos[2]+110,interface.pos[1]+325+295,interface.pos[2]+110+20,tocolor(255,255,255,255),1,"default-bold","center","center")
                    end
                    dxDrawText("Choose current data at list: ",interface.pos[1]+30,interface.pos[2]+50,interface.pos[1]+620,interface.pos[2]+100,tocolor(255,255,255,255),2,"default-bold","left","center",false,false,false)
                    createChooseBar(interface.pos[1]+460,interface.pos[2]+60,interface.stats.leaderboard.choose,interface.stats.leaderboard.chooseData,interface.stats.leaderboard.chooseCurrent)
                end
            end
            if window.current == 3 then
                drawMusicStore()
            end
            if window.current == 1 then
                if interface.maps.tab == 1 then
                    guiSetVisible(gui_widnows[1],true)
                    dxDrawText("map shop",interface.pos[1],interface.pos[2],interface.pos[1]+640,interface.pos[2]+42,tocolor(255,255,255,255),2,"default-bold","center","center")
                    createButton(interface.pos[1]+10,interface.pos[2]+5,"map queue",interface.maps.buttons[1])
                    createGridlist(interface.pos[1]+20,interface.pos[2]+100,220,320,interface.maps.gridlist,interface.maps.gridData,interface.maps.gridPos,interface.maps.gridSel)
                    createButton(interface.pos[1]+20,interface.pos[2]+430,"add map to queue - $5000",interface.maps.buttons[3],200)
                    dxDrawText("Map information",interface.pos[1]+240,interface.pos[2]+60,interface.pos[1]+640,interface.pos[2]+100,tocolor(255,255,255,255),2,"default-bold","center","center")
                    for i=1,#interface.maps.mapLabel do
                        dxDrawText(interface.maps.mapLabel[i]..interface.maps.mapData[i],interface.pos[1]+270,interface.pos[2]+130+(20*(i-1)),interface.pos[1]+620,interface.pos[2]+130+(20*(i)),tocolor(255,255,255,255),1,"default-bold","left","center",true)
                    end
                    dxDrawText("Toptimes at map",interface.pos[1]+240,interface.pos[2]+270,interface.pos[1]+640,interface.pos[2]+350,tocolor(255,255,255,255),2,"default-bold","center","center")
                    for i=1,3 do
                        dxDrawText("#"..i..". #ffffff"..interface.maps.topName[i],interface.pos[1]+300,interface.pos[2]+350+(20*(i-1)),interface.pos[1]+590,interface.pos[2]+350+(20*(i)),tocolor(141,182,205,255),1,"default-bold","left","center",false,false,false,true)
                        dxDrawText(interface.maps.topTime[i],interface.pos[1]+300,interface.pos[2]+350+(20*(i-1)),interface.pos[1]+590,interface.pos[2]+350+(20*(i)),tocolor(255,255,255,255),1,"default-bold","right","center")
                    end
                else
                    dxDrawText("map queue",interface.pos[1],interface.pos[2],interface.pos[1]+640,interface.pos[2]+42,tocolor(255,255,255,255),2,"default-bold","center","center")
                    createButton(interface.pos[1]+10,interface.pos[2]+5,"map shop",interface.maps.buttons[2])
                    dxDrawRectangle(interface.pos[1]+20,interface.pos[2]+70,600,390,tocolor(0,0,0,100))
                    dxDrawRectangle(interface.pos[1]+20,interface.pos[2]+70,600,30,tocolor(0,0,0,50))
                    dxDrawText("Maps in queue: ",interface.pos[1]+20,interface.pos[2]+70,interface.pos[1]+620,interface.pos[2]+100,tocolor(255,255,255,255),1.6,"default-bold","center","center")
                    for i=1,12 do
                        if interface.maps.queue[i] then
                            dxDrawText("   #"..i..". "..interface.maps.queue[i],interface.pos[1]+20,interface.pos[2]+100+(30*(i-1)),interface.pos[1]+620,interface.pos[2]+100+(30*(i)),tocolor(255,255,255,255),1.6,"default-bold","left","center")
                        else
                            dxDrawText("   #"..i..".  Not available",interface.pos[1]+20,interface.pos[2]+100+(30*(i-1)),interface.pos[1]+620,interface.pos[2]+100+(30*(i)),tocolor(255,255,255,255),1.6,"default-bold","left","center")
                        end
                    end
                    guiSetVisible(gui_widnows[1],false)
                end
            else
                guiSetVisible(gui_widnows[1],false)
            end
            if window.current == 2 then
                dxDrawText("tune your car",interface.pos[1],interface.pos[2],interface.pos[1]+640,interface.pos[2]+42,tocolor(255,255,255,255),2,"default-bold","center","center")
                dxDrawRectangle(interface.pos[1]+20,interface.pos[2]+70,190,90,tocolor(interface.tune.color[1][1],interface.tune.color[1][2],interface.tune.color[1][3],255))
                dxDrawRectangle(interface.pos[1]+33+190,interface.pos[2]+70,190,90,tocolor(interface.tune.color[2][1],interface.tune.color[2][2],interface.tune.color[2][3],255))
                dxDrawRectangle(interface.pos[1]+46+380,interface.pos[2]+70,190,90,tocolor(interface.tune.color[3][1],interface.tune.color[3][2],interface.tune.color[3][3],255))
                dxDrawRectangle(interface.pos[1]+20,interface.pos[2]+70,190,30,tocolor(0,0,0,100))
                dxDrawRectangle(interface.pos[1]+33+190,interface.pos[2]+70,190,30,tocolor(0,0,0,100))
                dxDrawRectangle(interface.pos[1]+46+380,interface.pos[2]+70,190,30,tocolor(0,0,0,100))
                dxDrawText("#1 Car color",interface.pos[1]+20,interface.pos[2]+70,interface.pos[1]+210,interface.pos[2]+100,tocolor(255,255,255,255),1,"default-bold","center","center")
                dxDrawText("#2 Car color",interface.pos[1]+33+190,interface.pos[2]+70,interface.pos[1]+210+13+190,interface.pos[2]+100,tocolor(255,255,255,255),1,"default-bold","center","center")
                dxDrawText("Headlights color",interface.pos[1]+20+26+380,interface.pos[2]+70,interface.pos[1]+20+26+380+190,interface.pos[2]+100,tocolor(255,255,255,255),1,"default-bold","center","center")
                createButton(interface.pos[1]+20,interface.pos[2]+170,"buy #1 car color",interface.tune.buttons[1],170)
                createButton(interface.pos[1]+33+190,interface.pos[2]+170,"buy #2 car color",interface.tune.buttons[2],170)
                createButton(interface.pos[1]+46+380,interface.pos[2]+170,"buy headlight color",interface.tune.buttons[3],170)
                dxDrawText("special features",interface.pos[1],interface.pos[2]+200,interface.pos[1]+640,interface.pos[2]+260,tocolor(255,255,255,255),2,"default-bold","center","center")
                for i=1,4 do
                    dxDrawText(interface.tune.label[i]..interface.tune.state[i],interface.pos[1]+40,interface.pos[2]+260+(50*(i-1)),400,400,tocolor(255,255,255,255),1.4,"default-bold")
                    dxDrawText(interface.tune.info[i],interface.pos[1]+40,interface.pos[2]+290+(50*(i-1)),400,400,tocolor(255,255,255,255),1,"default-bold")
                    createButton(interface.pos[1]+46+380,interface.pos[2]+270+(50*(i-1)),interface.tune.buttonLabel[i],interface.tune.buttons[3+i],170)
                end
            end
            if window.current == 6 then
                dxDrawText("options",interface.pos[1],interface.pos[2],interface.pos[1]+640,interface.pos[2]+42,tocolor(255,255,255,255),2,"default-bold","center","center")
                for i=1,5 do
                    dxDrawText(interface.options.title[i].."  -  "..interface.options.state[i],interface.pos[1]+30,interface.pos[2]+60+(80*(i-1)),interface.pos[1]+640,interface.pos[2]+60+(80*(i-1))+50,tocolor(255,255,255,255),2,"default-bold","left","center",false,false,false,true)
                    dxDrawText(interface.options.info[i],interface.pos[1]+30,interface.pos[2]+110+(80*(i-1)),interface.pos[1]+400,interface.pos[2]+110+(80*(i-1))+30,tocolor(255,255,255,255),1,"default-bold","left","center",false,true,false)
                    createButton(interface.pos[1]+420,interface.pos[2]+60+(80*(i-1))+25,interface.options.buttonLabel[i],interface.options.buttons[i],180)
                end
            end
            if window.current == 5 then
               
  3. Hi all,

    I found an dashboard (userpanel) by xiti. And not all is compiled .

    And i have an problem . Whn buy map in userpanel , that maps was bought not loading. Probably need an function in racevoting_server.lua .Please help me and give to me this code.

    hd6w.png

    I have this code of racevoting_server.lua to 8Q userpanel, but don't function at xiti.... not if modfy 8q with xiti.

    -- code racevoting_server.lua

    function race_voting_8q (...) 
      local query = #{...}>0 and table.concat({...},' ') or nil 
      local map, errormsg = findMap( query ) 
      if not map then 
       outputRace( errormsg, source ) 
       return 
      end 
     g_ForcedNextMap = map 
      
    end 
    addEvent("race_voting_8q",true) 
    addEventHandler( "race_voting_8q", getRootElement(), race_voting_8q) 
    

    dash.lua --

    ------------------------------------------------------------------------------------------------------------- 
    --  Original file by NeXTreme. Thanks for you'r awesome resource.                                          --
    --                                                                                                         --
    --  This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.--
    --  [url=http://creativecommons.org/licenses/by-nc-nd/3.0/ ]http://creativecommons.org/licenses/by-nc-nd/3.0/ [/url]                                                     --
    --                                                                                                         --
    --  Edited by Xiti. All right reserved. Copyright 2012.                                                --
    -------------------------------------------------------------------------------------------------------------
     
    -- String.random characters
    chars = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","r","s","t","u","v","w","x","y","z","1","2","3","4","5","6","7","8","9","0"}
     
     
     
     
     
     
     
     
    local dataTable = {
        "cash",
        "points",
        "firstTimeJoin",
        "totalTimesJoined",
        "mapsWon",
        "totalToptimes",
        "totalHunters",
        "mapsPlayed",
        "totalBets",
        "totalBetsWon",
        "totalDeaths",
        "totalPlayingTimeMinutes",
        "totalPlayingTimeHours",
        "totalReactionTests",
        "highestWinstreak",
        "totalSpins",
        "DMwins",
        "DMplayed",
        "DDwins",
        "DDplayed",
        "buyedMaps",
        "firstRed",
        "firstGreen",
        "firstBlue",
        "secoundRed",
        "secoundGreen",
        "secoundBlue",
        "headRed",
        "headGreen",
        "headBlue",
        "policeLights",
        "discoLights",
        "poisonColor",
        "blackColor",
        "policeEnabled",
        "discoEnabled",
        "poisonEnabled",
        "blackEnabled",
        "firstEnabled",
        "secoundEnabled",
        "headEnabled",
        "donatorEnabled",
        "donatorTime",
    }
     
    textDataTable = {"nick"}
    playerTableStats = {}
    respawnFix = {}
    hunterFix = {}
     
     
     
    -----------
    -- Settings
    -----------
    betTimeLimit = 40       -- Duration of the betting period in seconds.
    minPlayers = 5          -- Minimum required players to bet.        
    mapCost = 5000          -- The price for setting maps.     
    vehicleColor = 10000
    headlightColor = 20000  
    nitroColor =  15000
    discoLightsCost = 100000
    VIPcolor = 200000
    moneyEarnPart = 30      -- The amount of money to calculate with to get the final money to give to the player.
     
     
    reactionMin = 200       -- Minimum money for the reaction test
    reactionMax = 500       -- Maximum money for the reaction test
    reactionDuration = 20   -- Duration of the reaction test in seconds
    reactionMinRedo = 300   -- Minimum amount of time to pass before a new reaction test is started in seconds
    reactionMaxRedo = 400   -- Maximum amount of time to pass before a new reaction test is started in seconds
    reactionLength = 10     -- Number of characters to use in the reaction test
     
     
    function onResourceStart()
        mapIsAlreadySet = false
        reactionString = ""
        reactionMoney = 0
        mapType = ""
        mapName = ""
        mapBlock = ""
        setTimer(newReactionTest,math.random(reactionMinRedo*1000,reactionMaxRedo*1000),1)
    end
     
     
    -- Disable voting
    function disableVote()
        cancelEvent()
    end
    addCommandHandler("voteredo",disableVote)
    addCommandHandler("new",disableVote)
     
    ----------------------------
    -- Refresh Players
    ----------------------------
     
    function triggerRebuildPlayerGridlist(thePlayer)
        local loggedPlayers = {}
        for i,player in ipairs(getElementsByType("player")) do
            if not (isGuestAccount(getPlayerAccount(player))) then
                table.insert(loggedPlayers, tostring(getPlayerName(player)))
            end
            setTimer(callClientFunction,1000,1,getRootElement(),"refreshConnectedPlayers",loggedPlayers)
        end
    end
    addEventHandler("onPlayerChangeNick",getRootElement(),triggerRebuildPlayerGridlist)
    addEventHandler("onPlayerLogin",getRootElement(),triggerRebuildPlayerGridlist)
    addEventHandler("onPlayerJoin",getRootElement(),triggerRebuildPlayerGridlist)
    addEventHandler("onPlayerLogout",getRootElement(),triggerRebuildPlayerGridlist)
    addEventHandler("onPlayerQuit",getRootElement(),triggerRebuildPlayerGridlist)
     
    ----------------------------------
    -- Tables System based on Accounts
    ----------------------------------
    function createNewTables()
        local account = getPlayerAccount(source)
        if not (isGuestAccount(account)) then
            for i, data in ipairs(dataTable) do
                if not (getAccountData(account, data)) then
                    setAccountData(account, data, "0")
                    outputDebugString("Setting data: "..tostring(data).." for player: "..tostring(getPlayerName(source)).." to 0")
                end
            end
        end
        if not (isGuestAccount(account)) then
            for i, data in pairs(textDataTable) do
                if not (getAccountData(account, data)) then
                    setAccountData(account, data, getPlayerName(source))
                end
            end
        end
    end
    addEventHandler("onPlayerLogin", getRootElement(), createNewTables)
     
    addCommandHandler("resetStats",
    function (player, cmd, arg1)
        if (arg1) then
            local account = getPlayerAccount(player)
            if (isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("Admin"))) then
                local target = getPlayerWildcard(arg1)
                if (target) then
                    local account = getPlayerAccount(target)
                    if not (isGuestAccount(account)) then
                        for i, data in ipairs(dataTable) do
                            setAccountData(account, data, "0")
                            outputDebugString("Setting data: "..tostring(data).." for player: "..tostring(getPlayerName(target)).." to 0")
                        end
                    end
                    if not (isGuestAccount(account)) then
                        for i, data in pairs(textDataTable) do
                        end
                    end
                end
            end
        end
    end)
     
     
     
    function checkLoggedPlayer()
        for id,thePlayer in pairs(getElementsByType("player")) do
            local account = getPlayerAccount(thePlayer)
            if not (isGuestAccount(account)) then
                onPlayerLoginHandler(thePlayer)
            end
        end
    end
     
    -------------------------------------------
    -- Userpanel - handle requests from clients
    -------------------------------------------
     
    function timesJoin()
        setElementData(source,"join","joined")
        scoreboardRefresh(source)
    end
    addEventHandler("onPlayerJoin",getRootElement(),timesJoin)
     
     
    -- Stats view
    function getPlayerStats(triggeringPlayer,thePlayer)
        local account = getPlayerAccount(thePlayer)
        if not (isGuestAccount(account)) then
            playerTableStats[1] = getPlayerName(thePlayer)
            playerTableStats[1] = tonumber(getAccountData(account,"cash"))
            playerTableStats[2] = tonumber(getAccountData(account,"points"))
            playerTableStats[4] = tonumber(getAccountData(account,"totalHunters"))
            playerTableStats[3] = tonumber(getAccountData(account,"totalToptimes"))
            playerTableStats[5] = tonumber(getAccountData(account,"mapsPlayed"))
            playerTableStats[6] = tonumber(getAccountData(account,"mapsWon"))
            playerTableStats[7] = tonumber(getAccountData(account,"totalDeaths"))
            playerTableStats[8] = tonumber(getAccountData(account,"highestWinstreak"))
            playerTableStats[9] = tonumber(getAccountData(account,"totalSpins"))
            playerTableStats[10] = tonumber(getAccountData(account,"totalBets"))
            playerTableStats[11] = tonumber(getAccountData(account,"totalSpins"))
            playerTableStats[12] = "00:00"
            minutes = tonumber(getAccountData(account,"totalPlayingTimeMinutes"))
            hours = tonumber(getAccountData(account,"totalPlayingTimeHours"))
            if hours < 10 then
                hours = "0"..hours
            end
            if minutes < 10 then
                minutes = "0"..minutes
            end
            playerTableStats[12] = ""..hours..":"..minutes.."" -- Total Playing Time
            playerTableStats[13] = tonumber(getAccountData(account,"totalTimesJoined"))
            callClientFunction(triggeringPlayer,"buildPlayerData",playerTableStats,thePlayer)
        end
    end
     
     
    -- Maps
    function getServerMaps(loadList)
        local tableOut = {}
        if loadList then
            local maps = call(getResourceFromName("mapmanager"), "getMapsCompatibleWithGamemode" , getResourceFromName("race"))
            for i,map in ipairs (maps) do
                tableOut[i] = getResourceInfo(map, "name") or getResourceName(map)
            end
            table.sort(tableOut, sortCompareFunction)
        end
        callClientFunction(loadList,"createMapList", tableOut)
    end
     
    function sortCompareFunction(s1, s2)
        if type(s1) == "table" and type(s2) == "table" then
            s1, s2 = s1.name, s2.name
        end
        s1, s2 = s1:lower(), s2:lower()
       
  4. Hi all,

    1) Why i can't use /nextmap command? Im admin and server say : Found 0 Matches for ... and too in admin-panel. How to solve? In console not say anithing. And maps loading in servers and can play...

    2) Why sometime kick me to server : [Time Out] and server not restarted or anything....

  5. Hi all

    I need your help but idk how to...

    --- I need meta for this userpanel ... please help me. I dont know who is author.

    * Resource have files in .psd format.

    I create an meta but don't function.. look at the photos.

    add me skype pls: metin.white

    I have this Userpanel :

    -- Photos

    3ezt.png

  6. Hi all,

    To can buy nextmap in 8Q Dashboard , i add this line to racevoting_server:

    function race_voting_8q (...) 
      local query = #{...}>0 and table.concat({...},' ') or nil 
      local map, errormsg = findMap( query ) 
      if not map then 
       outputRace( errormsg, source ) 
       return 
      end 
     g_ForcedNextMap = map 
      
    end 
    addEvent("race_voting_8q",true) 
    addEventHandler( "race_voting_8q", getRootElement(), race_voting_8q) 
    

    and to Xiti Dashboard what add ?

  7. Hi all,

    I have not opened my server for a long time. And today when opened i observed an error.

    8q_panell. ( but resource is added to admin right)...

    -------------

    -- Console (when press 'F7' (to open)) :

    ERROR: Client triggered serverside event iAmLoggedIn, but event is not added serverside 
    

  8. Hi all,

    Today i was buyed from sigmar all multy lobby with 90E. You can quest Sigmar !

    and always this problem:

    idk with this interval....

    ERROR: [gamemodes]\a\server.lua:119: bad argument #2 to 'random' (interval is empty)

    Idk how to solve ... , i Have 4 sigmar scripts : score, kill, hunt, load and lobby called folder "a"

    -- server.lua

    setGameType("MTA") 
     
    for k,v in ipairs(getElementsByType("player")) do
        setElementData(v,"Map",nil);
        setElementData(v,"MapID",nil);
        setElementData(v,"room",nil);
        if getElementData(v,"spamBlock") then
            killTimer(getElementData(v,"spamBlock"))
            setElementData(v,"spamBlock",nil)
        end
        setElementData(v,"spamBlock",nil);
        setElementData(v,"ttimeleft",nil);
        killPed(v);
    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
        local minutes = tostring(math.floor(s/60))
        return minutes .. ':' .. seconds .. ':' .. centiseconds
    end
     
    addEvent("onClientReady2",true)
    addEventHandler("onClientReady2",root,
    function()
        triggerLatentClientEvent(source,"onServerSendS",100000,false,source,scriptstr);
    end)
     
    local DL = {};
    local DL2 = {};
    local DL3 = {};
    local dlpos = 1;
    local dlpos2 = 1;
    local dlpos3 = 1;
    local g_HunterMap = {};
    local g_MapsHunter = {};
    local hmt = false;
    local dmt = false;
    local mmt = false;
    local omt = false;
    local g_Maps = {};
    local g_MapsDD = {};
    local g_MapsOS = {};
    local g_DMMap = {};
    local g_DDMap = {};
    local g_OSMap = {};
    local DMState = "nomap";
    local DDState = "nomap";
    local OSState = "nomap";
    local DMCheck = 0;
    local DDCheck = 0;
    local OSCheck = 0;
    local MapTags = {"/eas/","/nor/","/har/","/spe/","/slo/","/old/","/new/","/rec/"};
     
    for k,v in ipairs(getResources()) do
        if (getResourceInfo(v,"type") == "map") and (getResourceInfo(v,"gamemodes") == "race") and getResourceInfo(v,"name") then
            local name = getResourceInfo(v,"name")
            if name then
                if name:find("/old/",1,true) then
                    g_MapsOS[#g_MapsOS+1] = {getResourceName(v),name,0}
                elseif name:find("[DM]",1,true) then
                    g_Maps[#g_Maps+1] = {getResourceName(v),name,0}
                elseif name:find("[Hunter]",1,true) then
                    g_MapsHunter[#g_MapsHunter+1] = {getResourceName(v),name,0}
                elseif name:find("[DD]",1,true) then
                    g_MapsDD[#g_MapsDD+1] = {getResourceName(v),name,0}
                end
            end
        end
    end
     
    local function generateMap(MapID,arg2)
        if (arg2 == 2) and (getElementData(source,"spamBlock")) then
            local r = getTimerDetails(getElementData(source,"spamBlock"));
            outputChatBox("*PM: Please wait "..math.floor(r/1000).." seconds before you can load new map!",source,200,0,0)
            return;
        elseif (arg2 == 2) then
            setElementData(source,"spamBlock",setTimer(setElementData,30000,1,source,"spamBlock",nil))
        end
        local mapName = false
        local resName = false
        if (arg2 == 2) then
            mapName = g_Maps[MapID][2]
            resName = g_Maps[MapID][1]
            local oMapID = getElementData(source,"MapID")
            local room = getElementData(source,"room")
            if oMapID then
                for k,v in ipairs(getElementsByType("player")) do
                    if v ~= source then
                        local room2 = getElementData(v,"room");
                        if getElementData(v,"MapID") == oMapID and room == room2 then
                            local txt = getPlayerName(source).."#ffffff has left this map."
                            triggerClientEvent(v,"onClientNotice",v,0,txt,false)
                        end
                    end
                end
                g_Maps[oMapID][3] = g_Maps[oMapID][3] - 1
            end
            setElementData(source,"MapID",MapID)
            g_Maps[MapID][3] = g_Maps[MapID][3] + 1
            --//Let everyone know i joined this map.
            for k,v in ipairs(getElementsByType("player")) do
                if v ~= source then
                    local room2 = getElementData(v,"room");
                    if getElementData(v,"Map") == mapName and room == room2 then
                        local txt = getPlayerName(source).."#ffffff has joined this map."
                        triggerClientEvent(v,"onClientNotice",v,0,txt,false)
                    end
                end
            end
        elseif (arg2 == 1) then
            MapID = math.random(1,#g_MapsHunter);
            mapName = g_MapsHunter[MapID][2]
            resName = g_MapsHunter[MapID][1]
        elseif (arg2 == 4) then
            MapID = math.random(1,#g_Maps);
            mapName = g_Maps[MapID][2]
            resName = g_Maps[MapID][1]
        elseif (arg2 == 5) then
            MapID = math.random(1,#g_MapsDD);
            mapName = g_MapsDD[MapID][2]
            resName = g_MapsDD[MapID][1]
        elseif (arg2 == 6) then
            MapID = math.random(1,#g_MapsOS);
            mapName = g_MapsOS[MapID][2]
            resName = g_MapsOS[MapID][1]
        end
        local mapName2 = mapName
        for k,v in ipairs(MapTags) do
            mapName2 = string.gsub(mapName2,v,"")
        end
        --//Now actually loading the map.
        local mapMeta = xmlLoadFile(":"..resName.."/meta.xml")
        if mapMeta then
            local mapChild = xmlFindChild(mapMeta,"map",0)
            local mapPath = xmlNodeGetAttributes(mapChild)
            local mapFile = xmlLoadFile(":"..resName.."/"..mapPath["src"])
            if mapFile then
                local tempTable = {}
                local fileTable = {}
                local fileSize = 0
                local spawnTable = {}
                local scripts = xmlNodeGetChildren(mapMeta)
                for i, node in ipairs(scripts) do
                    local type = xmlNodeGetName(node)
                    if type == "script" then
                        local info = xmlNodeGetAttributes(node)
                        if info["type"] and info["type"] == "client" then
                            local hFile = fileOpen(":"..resName.."/"..info["src"],true)
                            if hFile then
                                local size = fileGetSize(hFile)
                                tempTable[#tempTable+1] = {type,fileRead(hFile, size)}
                                fileClose(hFile)
                            end
                        end
                    elseif type == "file" then
                        local info = xmlNodeGetAttributes(node)
                        if info["src"] then
                            --if not string.find(info["src"],".mp3",1) and not string.find(info["src"],".ogg",1) then
                                fileTable[#fileTable+1] = info["src"]
                                local hFile = fileOpen(":"..resName.."/"..info["src"],true)
                                fileSize = fileSize + fileGetSize(hFile)
                                fileClose(hFile)
                            --end
                        end
                    end 
                end
                local mapStuff = xmlNodeGetChildren(mapFile)
                for i,node in ipairs(mapStuff) do
                    local type = xmlNodeGetName(node)
                    local attrs = xmlNodeGetAttributes ( node )
                    local et = {}
                    local st = {}
                    if type == "object" then
                        local collisions = true;
                        local alpha = 255;
                        local interior = 0;
                        local scale = 1;
                        if (attrs["interior"]) then
                            interior = attrs["interior"];
                        end
                        if (attrs["collisions"]) then
                            collisions = attrs["collisions"];
                        end
                        if (attrs["alpha"]) then
                            alpha = attrs["alpha"];
                        end
                        if (attrs["MSTalpha"]) then
                            alpha = attrs["MSTalpha"];
                        end
                        if (attrs["scale"]) then
                            scale = attrs["scale"];
                        end
                        et = {type,attrs["model"],attrs["posX"],attrs["posY"],attrs["posZ"],attrs["rotX"],attrs["rotY"],attrs["rotZ"],interior,collisions,alpha,scale}
                    elseif type == "marker" then
                        et = {type,attrs["posX"],attrs["posY"],attrs["posZ"],attrs["type"],attrs["size"],attrs["color"],attrs["interior"],attrs["id"]}
                    elseif type == "vehicle" then
                        et = {type,attrs["model"],attrs["posX"],attrs["posY"],attrs["posZ"],attrs["rotX"],attrs["rotY"],attrs["rotZ"]}
                    elseif type == "racepickup" then
                        et = {type,attrs["type"],attrs["vehicle"],attrs["posX"],attrs["posY"],attrs["posZ"],attrs["rotX"],attrs["rotY"],attrs["rotZ"]}
                    elseif type == "spawnpoint" then
                        et = {type,attrs["vehicle"],attrs["posX"],attrs["posY"],attrs["posZ"],attrs["rotX"],attrs["rotY"],attrs["rotZ"]}
                    end
                    tempTable[#tempTable+1] = et
                end
     
                local realtime = tonumber(string.sub(get("#"..resName..".time"),1,2)) or 0;
     
                local weather = tonumber(get("#"..resName..".weather")) or 0;
     
                if (arg2 == 2) then
                    setElementData(source,"Map",mapName2)
                    triggerLatentClientEvent(source,"onServerSendMapTable",200000,false,source,tempTable,realtime,weather,resName,fileTable,fileSize);
                elseif (arg2 == 1) then
                    g_HunterMap = {tempTable,realtime,weather,resName,fileTable,fileSize,mapName2};
                    for k,v in ipairs(getElementsByType("player")) do
                        local room = getElementData(v,"room");
                        if room and (room == 1) then
                            setElementData(v,"Map",mapName2)
                            triggerLatentClientEvent(v,"onServerSendMapTable",200000,false,v,g_HunterMap[1],g_HunterMap[2],g_HunterMap[3],g_HunterMap[4],g_HunterMap[5],g_HunterMap[6]);
                        end
                    end
                elseif (arg2 == 4) then
                    g_DMMap = {tempTable,realtime,weather,resName,fileTable,fileSize,mapName2};
                    for k,v in ipairs(getElementsByType("player")) do
                        local room = getElementData(v,"room");
                        if room and (room == 4) then
                            setElementData(v,"Map",mapName2)
                            setElementData(v,"Ready",false)
                            setElementData(v,"State","Loading")
                            triggerLatentClientEvent(v,"onServerSendMapTable",200000,false,v,g_DMMap[1],g_DMMap[2],g_DMMap[3],g_DMMap[4],g_DMMap[5],g_DMMap[6]);
                        end
                    end
                    DMState = "waiting";
                elseif (arg2 == 5) then
                    g_DDMap = {tempTable,realtime,weather,resName,fileTable,fileSize,mapName2};
                    local id = 1;
                    for k,v in ipairs(getElementsByType("player")) do
                        local room = getElementData(v,"room");
                        if room and (room == 5) then
                            setElementData(v,"Map",mapName2)
                           
  9. Hi all,

    Today , i download this : http://ffsgaming.net/threads/14096-Mult ... post147988

    Is :

    After put lobby and resources in my sv , i give admin rights...

    After i open server ... and restart lobby.... and:

    I wait 20 mins and nothing happened

    -- Console :

    [2013-07-07 15:02:31] Resources: 1204 loaded, 0 failed

    [2013-07-07 15:02:32] Querying game-monitor.com master server... failed! (302: Moved temporarily)

    [2013-07-07 15:02:32] Querying backup master server... success!

    [2013-07-07 15:02:33] Starting resources...

    [2013-07-07 15:02:34] Server minclientversion is now 1.3.0-9.03772

    [2013-07-07 15:02:35] ERROR: Couldn't find resource joinquit. Check it exists.

    [2013-07-07 15:02:36] WARNING: join\infobox_s.lua:2: Bad argument @ 'addEventHandler' [Expected function at argument 3, got nil]

    [2013-07-07 15:02:36] ERROR: Couldn't find resource lagreduce. Check it exists.

    [2013-07-07 15:02:36] ERROR: Couldn't find resource new. Check it exists.

    [2013-07-07 15:02:39] INFO: Successfully created a table.

    [2013-07-07 15:02:41] Server minclientversion is now 1.3.0-9.04134

    [2013-07-07 15:02:41] Creating new DB table huntertimes

    [2013-07-07 15:02:42] WARNING: lobby/server.lua(Line 1948) [server] isPlayerDead is deprecated and may not work in future versions. Please replace with isPedDead before Tuesday.

    [2013-07-07 15:02:42] Some files in 'lobby' use deprecated functions.

    [2013-07-07 15:02:42] Use the 'upgrade' command to perform a basic upgrade of resources.

    [2013-07-07 15:02:42] ERROR: [gamemodes]\lobby\server.lua:114: bad argument #2 to 'random' (interval is empty)

    [2013-07-07 15:02:42] Server started and is ready to accept connections!

    [2013-07-07 15:02:42] To stop the server, type 'shutdown' or press Ctrl-C

    [2013-07-07 15:02:42] Type 'help' for a list of commands.

    [2013-07-07 15:03:38] CONNECT: -spr-#3300FFSuleyman connected (IP: 192.168.56.1 Serial: DB4EF5E2B7A8633C5EB738AD56CA35A3 Version: 1.3.3-9.05588.0)

    [2013-07-07 15:03:42] JOIN: -spr-#3300FFSuleyman joined the game (IP: 192.168.56.1)

    [2013-07-07 15:03:52] INFO: Updating rank for: -spr-Suleyman

    [2013-07-07 15:03:52] LOGIN: (Console, Admin, Everyone) -spr-#3300FFSuleyman successfully logged in as '[sPR]#FF0000Suleyman' (IP: 192.168.56.1 Serial: DB4EF5E2B7A8633C5EB738AD56CA35A3)

    [2013-07-07 15:03:53] ERROR: Client triggered serverside event onClientReady2, but event is not added serverside

    [2013-07-07 15:06:17] stop: Requested by -spr-#3300FFSuleyman([sPR]#FF0000Suleyman)

    [2013-07-07 15:06:17] Stopping rules

    [2013-07-07 15:06:21] restart: Requested by -spr-#3300FFSuleyman([sPR]#FF0000Suleyman)

    [2013-07-07 15:06:21] Stopping lobby

    [2013-07-07 15:06:23] Starting lobby

    [2013-07-07 15:06:23] ERROR: [gamemodes]\lobby\server.lua:114: bad argument #2 to 'random' (interval is empty)

    [2013-07-07 15:06:23] Gamemode 'Race: Training' started.

    [2013-07-07 15:06:23] lobby restarted successfully

    [2013-07-07 15:06:29] ERROR: Client triggered serverside event onClientReady2, but event is not added serverside

    [2013-07-07 15:07:40] INFO: Updating rank for all player

    [2013-07-07 15:11:23] Stopping lobby

    [2013-07-07 15:11:24] Starting lobby

    [2013-07-07 15:11:24] ERROR: [gamemodes]\lobby\server.lua:114: bad argument #2 to 'random' (interval is empty)

    [2013-07-07 15:11:24] Gamemode 'Race: Training' started.

    [2013-07-07 15:11:24] start: Resource 'lobby' started

    [2013-07-07 15:11:28] ERROR: Client triggered serverside event onClientReady2, but event is not added serverside

    --- server.lua

    setGameType("Gamemode") 
     
    for k,v in ipairs(getElementsByType("player")) do
        setElementData(v,"Map",nil);
        setElementData(v,"MapID",nil);
        setElementData(v,"room",nil);
        if getElementData(v,"spamBlock") then
            killTimer(getElementData(v,"spamBlock"))
            setElementData(v,"spamBlock",nil)
        end
        setElementData(v,"spamBlock",nil);
        setElementData(v,"ttimeleft",nil);
        killPed(v);
    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
        local minutes = tostring(math.floor(s/60))
        return minutes .. ':' .. seconds .. ':' .. centiseconds
    end
     
    local DL = {};
    local DL2 = {};
    local DL3 = {};
    local dlpos = 1;
    local dlpos2 = 1;
    local dlpos3 = 1;
    local g_HunterMap = {};
    local g_MapsHunter = {};
    local hmt = false;
    local dmt = false;
    local mmt = false;
    local omt = false;
    local g_Maps = {};
    local g_MapsDD = {};
    local g_MapsOS = {};
    local g_DMMap = {};
    local g_DDMap = {};
    local g_OSMap = {};
    local DMState = "nomap";
    local DDState = "nomap";
    local OSState = "nomap";
    local DMCheck = 0;
    local DDCheck = 0;
    local OSCheck = 0;
    local MapTags = {"/eas/","/nor/","/har/","/spe/","/slo/","/old/","/new/","/rec/"};
     
    for k,v in ipairs(getResources()) do
        if (getResourceInfo(v,"type") == "map") and (getResourceInfo(v,"gamemodes") == "race") and getResourceInfo(v,"name") then
            local name = getResourceInfo(v,"name")
            if name then
                if name:find("[DM]",1,true) then
                    g_Maps[#g_Maps+1] = {getResourceName(v),name,0}
                    if name:find("/old/",1,true) then
                        g_MapsOS[#g_MapsOS+1] = {getResourceName(v),name,0}
                    end
                elseif name:find("[Hunter]",1,true) then
                    g_MapsHunter[#g_MapsHunter+1] = {getResourceName(v),name,0}
                elseif name:find("[DD]",1,true) then
                    g_MapsDD[#g_MapsDD+1] = {getResourceName(v),name,0}
                end
            end
        end
    end
     
    local function generateMap(MapID,arg2)
        if (arg2 == 2) and (getElementData(source,"spamBlock")) then
            local r = getTimerDetails(getElementData(source,"spamBlock"));
            outputChatBox("*PM: Please wait "..math.floor(r/1000).." seconds before you can load new map!",source,200,0,0)
            return;
        elseif (arg2 == 2) then
            setElementData(source,"spamBlock",setTimer(setElementData,30000,1,source,"spamBlock",nil))
        end
        local mapName = false
        local resName = false
        if (arg2 == 2) then
            mapName = g_Maps[MapID][2]
            resName = g_Maps[MapID][1]
            local oMapID = getElementData(source,"MapID")
            local room = getElementData(source,"room")
            if oMapID then
                for k,v in ipairs(getElementsByType("player")) do
                    if v ~= source then
                        local room2 = getElementData(v,"room");
                        if getElementData(v,"MapID") == oMapID and room == room2 then
                            local txt = getPlayerName(source).."#ffffff has left this map."
                            triggerClientEvent(v,"onClientNotice",v,0,txt,false)
                        end
                    end
                end
                g_Maps[oMapID][3] = g_Maps[oMapID][3] - 1
            end
            setElementData(source,"MapID",MapID)
            g_Maps[MapID][3] = g_Maps[MapID][3] + 1
            --//Let everyone know i joined this map.
            for k,v in ipairs(getElementsByType("player")) do
                if v ~= source then
                    local room2 = getElementData(v,"room");
                    if getElementData(v,"Map") == mapName and room == room2 then
                        local txt = getPlayerName(source).."#ffffff has joined this map."
                        triggerClientEvent(v,"onClientNotice",v,0,txt,false)
                    end
                end
            end
        elseif (arg2 == 1) then
            MapID = math.random(1,#g_MapsHunter);
            mapName = g_MapsHunter[MapID][2]
            resName = g_MapsHunter[MapID][1]
        elseif (arg2 == 4) then
            MapID = math.random(1,#g_Maps);
            mapName = g_Maps[MapID][2]
            resName = g_Maps[MapID][1]
        elseif (arg2 == 5) then
            MapID = math.random(1,#g_MapsDD);
            mapName = g_MapsDD[MapID][2]
            resName = g_MapsDD[MapID][1]
        elseif (arg2 == 6) then
            MapID = math.random(1,#g_MapsOS);
            mapName = g_MapsOS[MapID][2]
            resName = g_MapsOS[MapID][1]
        end
        local mapName2 = mapName
        for k,v in ipairs(MapTags) do
            mapName2 = string.gsub(mapName2,v,"")
        end
        --//Now actually loading the map.
        local mapMeta = xmlLoadFile(":"..resName.."/meta.xml")
        if mapMeta then
            local mapChild = xmlFindChild(mapMeta,"map",0)
            local mapPath = xmlNodeGetAttributes(mapChild)
            local mapFile = xmlLoadFile(":"..resName.."/"..mapPath["src"])
            if mapFile then
                local tempTable = {}
                local fileTable = {}
                local fileSize = 0
                local spawnTable = {}
                local scripts = xmlNodeGetChildren(mapMeta)
                for i, node in ipairs(scripts) do
                    local type = xmlNodeGetName(node)
                    if type == "script" then
                        local info = xmlNodeGetAttributes(node)
                        if info["type"] and info["type"] == "client" then
                            local hFile = fileOpen(":"..resName.."/"..info["src"],true)
                            if hFile then
                                local size = fileGetSize(hFile)
                                tempTable[#tempTable+1] = {type,fileRead(hFile, size)}
                                fileClose(hFile)
                            end
                        end
                    elseif type == "file" then
                        local info = xmlNodeGetAttributes(node)
                        if info["src"] then
                            --if not string.find(info["src"],".mp3",1) and not string.find(info["src"],".ogg",1) then
                                fileTable[#fileTable+1] = info["src"]
                                local hFile = fileOpen(":"..resName.."/"..info["src"],true)
                                fileSize = fileSize + fileGetSize(hFile)
                                fileClose(hFile)
                            --end
                        end
                    end 
                end
                local mapStuff = xmlNodeGetChildren(mapFile)
                for i,node in ipairs(mapStuff) do
                    local type = xmlNodeGetName(node)
                    local attrs = xmlNodeGetAttributes ( node )
                    local et = {}
                    local st = {}
                    if type == "object" then
                        local collisions = true;
                        local alpha = 255;
                        local interior = 0;
                        local scale = 1;
                        if (attrs["interior"]) then
                            interior = attrs["interior"];
                        end
                        if (attrs["collisions"]) then
                            collisions = attrs["collisions"];
                        end
                        if (attrs["alpha"]) then
                            alpha = attrs["alpha"];
                        end
                        if (attrs["MSTalpha"]) then
                            alpha = attrs["MSTalpha"];
                        end
                        if (attrs["scale"]) then
                            scale = attrs["scale"];
                        end
                        et = {type,attrs["model"],attrs["posX"],attrs["posY"],attrs["posZ"],attrs["rotX"],attrs["rotY"],attrs["rotZ"],interior,collisions,alpha,scale}
                    elseif type == "marker" then
                        et = {type,attrs["posX"],attrs["posY"],attrs["posZ"],attrs["type"],attrs["size"],attrs["color"],attrs["interior"],attrs["id"]}
                    elseif type == "vehicle" then
                        et = {type,attrs["model"],attrs["posX"],attrs["posY"],attrs["posZ"],attrs["rotX"],attrs["rotY"],attrs["rotZ"]}
                    elseif type == "racepickup" then
                        et = {type,attrs["type"],attrs["vehicle"],attrs["posX"],attrs["posY"],attrs["posZ"],attrs["rotX"],attrs["rotY"],attrs["rotZ"]}
                    elseif type == "spawnpoint" then
                        et = {type,attrs["vehicle"],attrs["posX"],attrs["posY"],attrs["posZ"],attrs["rotX"],attrs["rotY"],attrs["rotZ"]}
                    end
                    tempTable[#tempTable+1] = et
                end
     
                local realtime = tonumber(string.sub(get("#"..resName..".time"),1,2)) or 0;
     
                local weather = tonumber(get("#"..resName..".weather")) or 0;
     
                if (arg2 == 2) then
                    setElementData(source,"Map",mapName2)
                    triggerLatentClientEvent(source,"onServerSendMapTable",200000,false,source,tempTable,realtime,weather,resName,fileTable,fileSize);
                elseif (arg2 == 1) then
                    g_HunterMap = {tempTable,realtime,weather,resName,fileTable,fileSize,mapName2};
                    for k,v in ipairs(getElementsByType("player")) do
                        local room = getElementData(v,"room");
                        if room and (room == 1) then
                            setElementData(v,"Map",mapName2)
                            triggerLatentClientEvent(v,"onServerSendMapTable",200000,false,v,g_HunterMap[1],g_HunterMap[2],g_HunterMap[3],g_HunterMap[4],g_HunterMap[5],g_HunterMap[6]);
                        end
                    end
                elseif (arg2 == 4) then
                    g_DMMap = {tempTable,realtime,weather,resName,fileTable,fileSize,mapName2};
                    for k,v in ipairs(getElementsByType("player")) do
                        local room = getElementData(v,"room");
                        if room and (room == 4) then
                            setElementData(v,"Map",mapName2)
                            setElementData(v,"Ready",false)
                            setElementData(v,"State","Loading")
                            triggerLatentClientEvent(v,"onServerSendMapTable",200000,false,v,g_DMMap[1],g_DMMap[2],g_DMMap[3],g_DMMap[4],g_DMMap[5],g_DMMap[6]);
                        end
                    end
                    DMState = "waiting";
                elseif (arg2 == 5) then
                    g_DDMap = {tempTable,realtime,weather,resName,fileTable,fileSize,mapName2};
                    local id = 1;
                    for k,v in ipairs(getElementsByType("player")) do
                        local room = getElementData(v,"room");
                        if room and (room == 5) then
                            setElementData(v,"Map",mapName2)
                            setElementData(v,"Ready",false)
                            setElementData(v,"State","Loading")
                            triggerLatentClientEvent(v,"onServerSendMapTable",200000,false,v,g_DDMap[1],g_DDMap[2],g_DDMap[3],g_DDMap[4],g_DDMap[5],g_DDMap[6],id);
                            id = id + 1;
                        end
                    end
                    DDState =
×
×
  • Create New...