Jump to content

I search scripter /racevoting.lua/


JoZeFSvK

Recommended Posts

Posted

Hey i search scripter i have nextreme's old panel "thepanel" and when i buy maps and nothing i think problem is in racevoting.lua and i dont know edit it. who knows please coment. we can negotiate the price or something else

Posted

Client

  
-- Get all maps on server 
function getMaps() 
    totalServerMaps = 0 
    totalDmMaps = 0 
    totalDdMaps = 0 
    setTimer(callServerFunction,500,1,"getServerMaps",getLocalPlayer()) 
end 
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),getMaps) 
  
  
  
function loadMaps(gamemodeMapTable, gamemode, map) 
    guiGridListClear(gridMaps) 
    if gamemodeMapTable then 
        aGamemodeMapTable = gamemodeMapTable 
        for id,gamemode in pairs (gamemodeMapTable) do 
            if (gamemode.name == "Race") then 
                for id,map in ipairs (gamemode.maps) do 
                    local row = guiGridListAddRow ( gridMaps ) 
                    guiGridListSetItemText ( gridMaps, row, 1, map.name, false, false ) 
                    guiGridListSetItemData ( gridMaps, row, 1, map.resname) 
                    totalServerMaps = totalServerMaps+1 
                    if (string.find(map.name,"[DM]",1,true)) then 
                        totalDmMaps = totalDmMaps+1 
                    elseif (string.find(map.name,"[DD]",1,true)) then 
                        totalDdMaps = totalDdMaps+1 
                    end 
                    updateMapLabels(1) 
                end 
            end 
        end 
    end 
end 
  
  
-- Map search 
function mapSearch() 
    guiGridListClear(gridMaps) 
    local searchString = string.lower(guiGetText(editMapSearch)) 
    if ( searchString == "" ) then 
        for id,gamemode in pairs (aGamemodeMapTable) do 
            if (gamemode.name == "Race") then 
                for id,map in ipairs (gamemode.maps) do 
                    local row = guiGridListAddRow ( gridMaps ) 
                    guiGridListSetItemText ( gridMaps, row, 1, map.name, false, false ) 
                    guiGridListSetItemData ( gridMaps, row, 1, map.resname) 
                end 
            end 
        end 
    else 
        for id,gamemode in pairs (aGamemodeMapTable) do 
            if (gamemode.name == "Race") then 
                local noMapsFound = true 
                for id,map in ipairs (gamemode.maps) do 
                    if string.find(string.lower(map.name.." "..map.resname), searchString, 1, true) then 
                        local row = guiGridListAddRow ( gridMaps ) 
                        guiGridListSetItemText ( gridMaps, row, 1, map.name, false, false ) 
                        guiGridListSetItemData ( gridMaps, row, 1, map.resname) 
                        noMapsFound = false 
                    end 
                end 
                if noMapsFound == true then 
                    local row = guiGridListAddRow(gridMaps) 
                    guiGridListSetItemText (gridMaps, row, 1, "No maps matching your search query!", false, false) 
                    guiGridListSetItemColor (gridMaps, row, 1, 255,50,50) 
                end 
            end 
        end 
    end 
    updateMapLabels(2) 
end 
  
function buyNextMap() 
    local row,column = guiGridListGetSelectedItem(gridMaps) 
    local mapName = guiGridListGetItemText(gridMaps,row,1) 
    callServerFunction("buyMap",getLocalPlayer(),mapName) 
end 
-- Update labels 
function updateMapLabels(updateMode) 
    if updateMode == 1 then 
        guiSetText(lblTotalMapsOnServer,"Total maps on the server: "..totalServerMaps) 
        guiSetText(lblTotalDmMaps,"Total DM Maps:  "..totalDmMaps) 
        guiSetText(lblTotalDdMaps,"Total DD Maps:  "..totalDdMaps) 
    else 
        local row,column = guiGridListGetSelectedItem(gridMaps) 
        local mapName = guiGridListGetItemText(gridMaps,row,1) 
        if mapName == "" then 
            guiSetText(lblSelectedMapName,"N/A") 
            guiSetText(lblSelectedMapAuthor,"N/A") 
        else 
            guiSetText(lblSelectedMapName,mapName) 
            if string.find(mapName,"[DM]",1,true) then 
                guiSetText(lblSelectedMapAuthor,"Deathmatch") 
            elseif string.find(mapName,"[DD]",1,true) then 
                guiSetText(lblSelectedMapAuthor,"Destruction Derby") 
            elseif string.find(mapName,"[FUN]",1,true) then 
                guiSetText(lblSelectedMapAuthor,"Fun map") 
            else 
                guiSetText(lblSelectedMapAuthor,"UNKNOWN") 
            end 
        end 
    end 
end 

Server

  
-- Maps 
function getServerMaps (loadList) 
    local tableOut 
    if loadList then 
        tableOut = {} 
        -- local deletedMaps = {} 
        local gamemodes = {} 
        gamemodes = call(getResourceFromName("mapmanager"), "getGamemodes") 
        for id,gamemode in ipairs (gamemodes) do 
            tableOut[id] = {} 
            tableOut[id].name = getResourceInfo(gamemode, "name") or getResourceName(gamemode) 
            tableOut[id].resname = getResourceName(gamemode) 
            tableOut[id].maps = {} 
            local maps = call(getResourceFromName("mapmanager"), "getMapsCompatibleWithGamemode" , gamemode) 
            for _,map in ipairs (maps) do 
                table.insert(tableOut[id]["maps"] ,{name = getResourceInfo(map, "name") or getResourceName(map), resname = getResourceName(map)}) 
            end 
            table.sort(tableOut[id]["maps"], sortCompareFunction) 
        end 
        table.sort((tableOut), sortCompareFunction) 
        table.insert(tableOut, {name = "no gamemode", resname = "no gamemode", maps = {}}) 
        local countGmodes = #tableOut 
        local maps = call(getResourceFromName("mapmanager"), "getMapsCompatibleWithGamemode") 
        for id,map in ipairs (maps) do 
            -- if fileOpen(":"..getResourceName(map).."/deleted") then 
                -- table.insert(deletedMaps ,{name = getResourceInfo(map, "name") or getResourceName(map), resname = getResourceName(map)}) 
            -- else 
                table.insert(tableOut[countGmodes]["maps"] ,{name = getResourceInfo(map, "name") or getResourceName(map), resname = getResourceName(map)}) 
            -- end 
        end 
        -- table.sort(deletedMaps, sortCompareFunction) 
        table.sort(tableOut[countGmodes]["maps"], sortCompareFunction) 
        -- table.insert(tableOut, {name = "deleted maps", resname = "deleted maps", maps = {}}) 
        -- local countGmodes = countGmodes + 1 
        -- tableOut[countGmodes]["maps"] = deletedMaps 
    end 
    local map = call(getResourceFromName("mapmanager"), "getRunningGamemodeMap") 
    local gamemode = call(getResourceFromName("mapmanager"), "getRunningGamemode") 
    gamemode = gamemode and getResourceName(gamemode) or "N/A" 
    map = map and getResourceName(map) or "N/A" 
    callClientFunction(loadList,"loadMaps", tableOut, gamemode, map) 
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() 
    if s1 == s2 then 
        return false 
    end 
    local byte1, byte2 = string.byte(s1:sub(1,1)), string.byte(s2:sub(1,1)) 
    if not byte1 then 
        return true 
    elseif not byte2 then 
        return false 
    elseif byte1 < byte2 then 
        return true 
    elseif byte1 == byte2 then 
        return sortCompareFunction(s1:sub(2), s2:sub(2)) 
    else 
        return false 
    end 
end 
  
function callGetMaps() 
    for i,player in ipairs(getElementsByType("player")) do 
        callClientFunction(player,"getMaps") 
    end 
end 
addCommandHandler("rebuildMaps",callGetMaps) 

and

  
-- Buy a next map 
-- function buyMap(thePlayer,mapName) 
    -- local playerLevel = tonumber(loadPlayerData(thePlayer,"level")) 
    -- local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) 
    -- if mapIsAlreadySet == false then 
        -- if not (mapName == "") then 
            -- if playerLevel >= mapLevel then 
                -- if playerCash >= mapCost then 
                    -- triggerEvent("onExternalNextmapRequest",thePlayer,thePlayer,mapName) 
                -- else 
                    -- outputChatBox("#FF6600* #FFFFFFYou don't have enough money to set a map!",thePlayer,255,255,255,true) 
                -- end 
            -- else--  
                -- outputChatBox("#FF6600* #FFFFFFYou need to be level #ABCDEF"..mapLevel.." #FFFFFFor higher to set maps!",thePlayer,255,255,255,true) 
            -- end 
        -- else 
            -- outputChatBox("#FF6600* #FFFFFFPlease select a map from the list first!",thePlayer,255,255,255,true) 
        -- end 
    -- else 
        -- outputChatBox("#FF6600* #FFFFFFA map is already set at the moment! Please try again later.",thePlayer,255,255,255,true) 
    -- end 
-- end 
  
  
  
  
function resetMapSetStatus() 
    mapIsAlreadySet = false 
end 
addEventHandler("onMapStarting",getRootElement(),resetMapSetStatus) 
  
  
  
  
  

-- Find all maps which match the query string 
function findMaps( query ) 
    local results = {} 
    --escape all meta chars 
    query = string.gsub(query, "([%*%+%?%.%(%)%[%]%{%}%\%/%|%^%$%-])","%%%1") 
    -- Loop through and find matching maps 
    for i,resource in ipairs(exports.mapmanager:getMapsCompatibleWithGamemode(getThisResource())) do 
        local resName = getResourceName( resource ) 
        local infoName = getMapName( resource  ) 
  
        -- Look for exact match first 
        if query == resName or query == infoName then 
            return {resource} 
        end 
  
        -- Find match for query within infoName 
        if string.find( infoName:lower(), query:lower() ) then 
            table.insert( results, resource ) 
        end 
    end 
    return results 
end 
addEvent('buyMapFromPanel', true) 
function buyMFP(mapname) 
    -- if g_ForcedNextMap then 
        -- outputChatBox('Next map is ' ..getMapName(g_ForcedNextMap), source) 
        -- return 
    -- end 
    -- local query = #{mapname}>0 and table.concat({mapname},' ') or nil 
    -- if not query then 
        -- if g_ForcedNextMap then 
            -- outputChatBox('Next map is ' ..getMapName(g_ForcedNextMap), source) 
        -- else 
            -- outputChatBox('Next map is not set', source, 255, 0, 0) 
        -- end 
        -- return 
    -- end 
    -- local map, errormsg = findMap(query) 
    -- if not map then 
        -- outputChatBox(errormsg, source) 
        -- return 
    -- end 
    -- local playerLevel = tonumber(loadPlayerData(source,"level")) 
    -- local playerCash = tonumber(loadPlayerData(source,"cash")) 
    -- if playerLevel >= mapLevel then 
        -- if playerCash >= mapCost then 
            -- if lastmap_B == map then 
                -- outputChatBox('That map has been played too much recently.', source, 255, 0, 0) 
            -- else 
                -- local TotalPlayerCash = playerCash - mapCost 
                -- g_ForcedNextMap = map 
                -- outputChatBox(getPlayerName(source).. " bought map '" ..getMapName(g_ForcedNextMap).. "' for "..mapCost.."$.", g_Root, 0, 240, 0) 
                -- savePlayerData(source,"cash", TotalPlayerCash) 
                -- lastmap_B = g_ForcedNextMap 
                -- achievement31(source) 
                -- scoreboardRefresh(source) 
            -- end 
        -- else 
            -- outputChatBox("#FF6600* #FFFFFFYou don't have enough money to set a map!",source,255,255,255,true) 
        -- end 
    -- else 
        -- outputChatBox("#FF6600* #FFFFFFYou need to be level #ABCDEF"..mapLevel.." #FFFFFFor higher to set maps!",source,255,255,255,true) 
    -- end 
    buyMap(source, command, mapname) 
end 
addEventHandler('buyMapFromPanel', g_Root, buyMFP) 
  
function buyMap(player, command, ...) 
    if g_ForcedNextMap then 
        outputChatBox( 'Next map is ' .. getMapName( g_ForcedNextMap ), player ) 
        return 
    end 
    local query = #{...}>0 and table.concat({...},' ') or nil 
    if not query then 
        if g_ForcedNextMap then 
            outputChatBox( 'Next map is ' .. getMapName( g_ForcedNextMap ), player ) 
        else 
            outputChatBox( 'Next map is not set', player, 255, 0, 0 ) 
        end 
        return 
    end 
    local map, errormsg = findMap(query) 
    if not map then 
        outputChatBox(errormsg, player) 
        return 
    end 
    local playerLevel = tonumber(loadPlayerData(player,"level")) 
    local playerCash = tonumber(loadPlayerData(player,"cash")) 
    if playerLevel >= mapLevel then 
        if playerCash >= mapCost then 
        if lastmap_B == map then 
            outputChatBox( 'That map has been played too much recently.', player, 255, 0, 0 ) 
        else 
            g_ForcedNextMap = map 
                local TotalPlayerCash = playerCash - mapCost 
                outputChatBox("#007FFF[Map]#FFFFFF" ..getPlayerName(player).. "#FFFFFF set '#007FFF" ..getMapName(g_ForcedNextMap).."#FFFFFF' as nextmap.", getRootElement(), 0, 240, 0, true) 
                savePlayerData(player,"cash", TotalPlayerCash) 
            lastmap_B = g_ForcedNextMap 
            achievement31(player) 
            scoreboardRefresh(player) 
        end 
        else 
            outputChatBox("#FF6600* #FFFFFFYou don't have enough money to set a map!",source,255,255,255,true) 
        end 
    else 
        outputChatBox("#FF6600* #FFFFFFYou need to be level #ABCDEF"..mapLevel.." #FFFFFFor higher to set maps!",source,255,255,255,true) 
    end 
end 
addCommandHandler('bm', buyMap) 
addCommandHandler('buymap', buyMap) 
addCommandHandler("mapcount", 
    function(source) 
        local resourceTable = getResources() 
        local mapcount = 0 
        for resourceKey, resourceValue in ipairs(resourceTable) do 
            local type = getResourceInfo(resourceValue, "type") 
            local game = getResourceInfo(resourceValue, "gamemodes") 
            if type == "map" and game == "race" then 
                mapcount = mapcount+1 
            else 
                cancelEvent() 
            end 
        end 
        outputChatBox("There are " ..tostring(mapcount).. " maps on the server.", source, 46, 154, 254) 
    end 
) 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
addEvent("onScriptSetNextMap",true) 
addEventHandler("onScriptSetNextMap",getRootElement(), 
function (mapName) 
    thePlayer = source 
    local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) 
    savePlayerData(thePlayer,"cash",playerCash-mapCost) 
    outputChatBox("#FFFFFFNextmap: "..getPlayerName(thePlayer).."#FFFFFF has bought a next map!",getRootElement(),255,255,255,true) 
    outputChatBox("#FFFFFFNextmap: #FF8800"..mapName,getRootElement(),255,255,255,true) 
    mapIsAlreadySet = true 
    scoreboardRefresh(thePlayer) 
    achievement31(thePlayer) 
end) 
  
addEvent("onRaceSetNextMap",true) 
addEventHandler("onRaceSetNextMap",getRootElement(), 
function () 
    mapIsAlreadySet = true 
end) 
  

LoL o.O now will create something which i add to racevoting.lua in race floder :/ , i try now create

addCommandHandler('buymap', 
function(player, command,...)   
  

and idk ... i need help :/ skype , email ,

Posted
each 2 servers have this panel why he accused me ? I did not steal it, I do not write our name on it, i have only problem , buymap dont work

Then script it?

Posted

Agree with Solidsnake.

Ontopic: Do it own by yourself, these scripts were not made by you, or just ask NexTreme to fix problems.

Im not sure, but you can't use these scripts.

Posted
Agree with Solidsnake.

Ontopic: Do it own by yourself, these scripts were not made by you, or just ask NexTreme to fix problems.

Im not sure, but you can't use these scripts.

+1

Posted

first, you can ask Nextreme ( for use his panel )

second,

Ontopic: Do it own by yourself, these scripts were not made by you, or just ask NexTreme to fix problems.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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