Jump to content

Ayuda userpanel


lpdc99

Recommended Posts

Agrega esto en tu racevoting_server

addCommandHandler ('acd', -- este comando lo sacas de el lua server side que trae tu userpanel en la funciona que dice executeCommandHandler 
    function ( player, command, ... ) 
        local query = #{...} > 0 and table.concat ( {...}, ' ' ) or nil 
        if not query then 
            if g_ForcedNextMap then 
                outputDebugString ( 'Next map is ' .. getMapName ( g_ForcedNextMap ) ); 
            else 
                outputDebugString ( 'Next map is not set' ); 
            end 
            return 
        end 
        local map, errormsg = findMap ( query ); 
        if not map then 
            outputRace ( errormsg, player ); 
            return 
        end 
        local account = getPlayerAccount ( player ); 
        if ( isGuestAccount ( account ) == false ) then 
            g_ForcedNextMap = map; 
        --  local confirm = true 
       triggerClientEvent ( "onNextMap", getRootElement(), getMapName( g_ForcedNextMap ) ) 
            if account then 
                setAccountData ( account, "money", tostring ( getPlayerMoney ( player ) ) ); 
            end 
        else 
        end 
    end 
) 

Link to comment

No es necesario postear todo el codigo, lo que necesitas es esto:

-- Buy a next map 
function buyMap(thePlayer,mapName,command) 
    if not PVP[thePlayer] then 
        local account = getPlayerAccount(thePlayer) 
        if not (isGuestAccount(account)) then 
            local playerCash = tonumber(getAccountData(account,"cash")) 
            if not (mapName == "") then 
                if playerCash >= mapCost then 
                    if command then 
                        mapName = getMapName(mapName) 
                    else 
                        mapName = tostring(mapName) 
                    end 
                    if not mapTimer[mapName] then 
                        table.insert(mapQueue,mapName) 
                        local freeMaps = tonumber(getAccountData(account,"freeMaps")) 
                        if freeMaps ~= 0 then 
                            addStat(account,"freeMaps",-1) 
                        else 
                            setAccountData(account,"cash",playerCash - mapCost) 
                        end 
                        addStat(account,"buyedMaps",1) 
                        scoreboardRefresh(thePlayer) 
                        mapTimer[mapName] = true 
                        setTimer(resetMapTimer,900000,1,mapName) 
                        if #mapQueue == 1 then 
                            triggerEvent("onUseranelWantSetMap",getRootElement(),mapQueue[1]) 
                        end 
                        callClientFunction(thePlayer,"setFreeMapPurchase",getAccountData(account,"freeMaps")) 
                        unlockAchievement(thePlayer,18) 
                        unlockAchievement(thePlayer) 
                        showServerMsg(getRootElement(),"Map queue",getPlayerName(thePlayer).." #ffffffbought and add "..mapName.." to map queue") 
                        callClientFunction(getRootElement(),"updateMapQueueList",mapQueue) 
                    else 
                        showServerMsg(thePlayer,"Buy nextmap","#FFFFFFYou can't set this map now, wait some time to set!") 
                    end 
                else 
                    showServerMsg(thePlayer,"Buy nextmap","#FFFFFFYou don't have enough money to set a map!") 
                end 
            else 
                showServerMsg(thePlayer,"Buy nextmap","#FFFFFFPlease select a map from the list first!") 
            end 
        end 
    else 
        showServerMsg(thePlayer,"Buy nextmap","#FFFFFFYou can't buy maps because you're playing a PVP match now!") 
    end 
end 

y si no me equivoco la linea que importa es esta:

triggerEvent("onUseranelWantSetMap",getRootElement(),mapQueue[1]) 

Hay que cambiarla a:

executeCommandHandler ( "acd", getRootElement(), mapQueue[1]) 

PD: no olvides darle derechos de administrador a tu userpanel.

Link to comment
  • Recently Browsing   0 members

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