Jump to content

i buyed from sigmar


Recommended Posts

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)
                       
Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...