Jump to content

Pls Help User-Panel


Snake

Recommended Posts

No work buy maps

-- Buy a next map 
function buyMap(mapName) 
        local account = getPlayerAccount(source) 
        local cash = getAccountData(account, "cash") 
        local level = getAccountData(account, "level") 
        if not (mapName == "") then 
        if not (isGuestAccount(getPlayerAccount(source))) then 
            if tonumber(level) >= 10 then 
                if tonumber(cash) >= 3500 then 
                    triggerEvent("onNextmapBuy",source,mapName) 
                else 
                    outputChatBox("#FFFFFF[userpanel] #FF9900You don't have enough money to set a map!",source,255,255,255,true) 
                end 
            else 
                outputChatBox("#FFFFFF[userpanel] #FF9900You need to be level #FFFFFF10 #FF9900to buy maps!",source,255,255,255,true) 
            end 
        end  
        else 
            outputChatBox("#FFFFFF[userpanel] #FF9900Please select a map from the list first!",source,255,255,255,true) 
        end 
end 
addEvent("triggerbuyMap",true) 
addEventHandler( "triggerbuyMap", getRootElement(),buyMap ) 
  
function onBuyMapReady() 
local account = getPlayerAccount(source) 
addStat(account,"cash",-3500) 
end 
addEvent("setCashofBuyMap",true) 
addEventHandler( "setCashofBuyMap", getRootElement(), onBuyMapReady ) 
  
--end MAP 

thanks in advance

Link to comment

Add executeCommandHandler ( "nextmap" , thePlayer, MapName )

Server_lua.

-- Buy a next map 
function buyMap(mapName) 
        local account = getPlayerAccount(source) 
        local cash = getAccountData(account, "cash") 
        local level = getAccountData(account, "level") 
        if not (mapName == "") then 
        if not (isGuestAccount(getPlayerAccount(source))) then 
            if tonumber(level) >= 10 then 
                if tonumber(cash) >= 3500 then 
                    executeCommandHandler ( "nextmap" , thePlayer, MapName ) 
                else 
                    outputChatBox("#FFFFFF[userpanel] #FF9900You don't have enough money to set a map!",source,255,255,255,true) 
                end 
            else 
                outputChatBox("#FFFFFF[userpanel] #FF9900You need to be level #FFFFFF10 #FF9900to buy maps!",source,255,255,255,true) 
            end 
        end  
        else 
            outputChatBox("#FFFFFF[userpanel] #FF9900Please select a map from the list first!",source,255,255,255,true) 
        end 
end 
addEvent("triggerbuyMap",true) 
addEventHandler( "triggerbuyMap", getRootElement(),buyMap ) 
  
function onBuyMapReady() 
local account = getPlayerAccount(source) 
addStat(account,"cash",-3500) 
end 
addEvent("setCashofBuyMap",true) 
addEventHandler( "setCashofBuyMap", getRootElement(), onBuyMapReady ) 
  
--end MAP 

Racevoting_server.lua

addCommandHandler('nextmap', 
    function( player, command, ... ) -- CADU !@ HERE 
        local query = #{...}>0 and table.concat({...},' ') or nil 
        if not query then 
            if g_ForcedNextMap then 
                outputRace( 'Next map is ' .. getMapName( g_ForcedNextMap ), player ) 
            else 
                outputRace( 'Next map is not set', player ) 
            end 
            return 
        end 
        if not _TESTING and not isPlayerInACLGroup(player, g_GameOptions.admingroup) then 
            return 
        end 
        local map, errormsg = findMap( query ) 
        if not map then 
            outputRace( errormsg, player ) 
            return 
        end 
        if g_ForcedNextMap == map then 
            outputRace( 'Next map is already set to ' .. getMapName( g_ForcedNextMap ), player ) 
            return 
        end 
        --NextMapBuyed = true 
        g_ForcedNextMap = map 
        outputChatBox('#00B2EE* #ECECECNextmap: #ABCDEF' .. getMapName( g_ForcedNextMap ) .. ' #00FF00set #ECECECby #ECECEC' .. getPlayerName( player ), g_Root, 236, 236, 236, true) 
        triggerClientEvent ( "setNextMap", getRootElement(), getMapName( g_ForcedNextMap ) ) 
    end 
) 
  
function startingNextText() -- CADU!@ 
    --getMapsCompatibleWithGamemode  
    g_ForcedNextMap = getRandomMapCompatibleWithGamemode( getThisResource(), 10, g_GameOptions.ghostmode and 0 or getTotalPlayerCount() ) 
    if g_ForcedNextMap then 
        triggerClientEvent ( "setNextMap", getRootElement(), getMapName( g_ForcedNextMap ) ) 
    end 
end 
addEventHandler( "onMapStarting", getRootElement(), startingNextText) 
  
buyed = {} 
addCommandHandler('buynextmap', 
    function( player, command, ... ) 
        local query = #{...}>0 and table.concat({...},' ') or nil 
        if not query then 
            if g_ForcedNextMap then 
                outputRace( 'Next map is ' .. getMapName( g_ForcedNextMap ), player ) 
            else 
                outputRace( 'Next map is not set', player ) 
            end 
            return 
        end 
        local map, errormsg = findMap( query ) 
        if not map then 
            outputRace( errormsg, player ) 
            return 
        end 
        if g_ForcedNextMap then 
        outputRace ( 'Another player buy next map !', player ) 
        return 
        end 
        if g_ForcedNextMap == map then 
            outputRace( 'Next map is already set to ' .. getMapName( g_ForcedNextMap ), player ) 
            return 
        end 
        g_ForcedNextMap = map 
        outputChatBox('#00B2EE* #ECECECNextmap: #ABCDEF' .. getMapName( g_ForcedNextMap ) .. ' #00FF00bought #ECECECby #ECECEC' .. getPlayerName( player ), g_Root, 255, 255, 255, true) 
        triggerClientEvent ( "setNextMap", getRootElement(), getMapName( g_ForcedNextMap ) ) 
        buyed[player] = 1 
    end 
) 
--onMapStarting 
  
addCommandHandler ( '~buyednextmap~', 
function ( player, cmd, amount ) 
if buyed[player] == 1 then 
takePlayerMoney ( player, amount ) 
buyed[player] = 0 
end 
end 
) 
  

Result:)

rawahl.png

Link to comment

Add executeCommandHandler ( "nextmap" , thePlayer, MapName )

Server_lua.

-- Buy a next map 
function buyMap(mapName) 
        local account = getPlayerAccount(source) 
        local cash = getAccountData(account, "cash") 
        local level = getAccountData(account, "level") 
        if not (mapName == "") then 
        if not (isGuestAccount(getPlayerAccount(source))) then 
            if tonumber(level) >= 10 then 
                if tonumber(cash) >= 3500 then 
                    executeCommandHandler ( "nextmap" , thePlayer, MapName ) 
                else 
                    outputChatBox("#FFFFFF[userpanel] #FF9900You don't have enough money to set a map!",source,255,255,255,true) 
                end 
            else 
                outputChatBox("#FFFFFF[userpanel] #FF9900You need to be level #FFFFFF10 #FF9900to buy maps!",source,255,255,255,true) 
            end 
        end  
        else 
            outputChatBox("#FFFFFF[userpanel] #FF9900Please select a map from the list first!",source,255,255,255,true) 
        end 
end 
addEvent("triggerbuyMap",true) 
addEventHandler( "triggerbuyMap", getRootElement(),buyMap ) 
  
function onBuyMapReady() 
local account = getPlayerAccount(source) 
addStat(account,"cash",-3500) 
end 
addEvent("setCashofBuyMap",true) 
addEventHandler( "setCashofBuyMap", getRootElement(), onBuyMapReady ) 
  
--end MAP 

Racevoting_server.lua

addCommandHandler('nextmap', 
    function( player, command, ... ) -- CADU !@ HERE 
        local query = #{...}>0 and table.concat({...},' ') or nil 
        if not query then 
            if g_ForcedNextMap then 
                outputRace( 'Next map is ' .. getMapName( g_ForcedNextMap ), player ) 
            else 
                outputRace( 'Next map is not set', player ) 
            end 
            return 
        end 
        if not _TESTING and not isPlayerInACLGroup(player, g_GameOptions.admingroup) then 
            return 
        end 
        local map, errormsg = findMap( query ) 
        if not map then 
            outputRace( errormsg, player ) 
            return 
        end 
        if g_ForcedNextMap == map then 
            outputRace( 'Next map is already set to ' .. getMapName( g_ForcedNextMap ), player ) 
            return 
        end 
        --NextMapBuyed = true 
        g_ForcedNextMap = map 
        outputChatBox('#00B2EE* #ECECECNextmap: #ABCDEF' .. getMapName( g_ForcedNextMap ) .. ' #00FF00set #ECECECby #ECECEC' .. getPlayerName( player ), g_Root, 236, 236, 236, true) 
        triggerClientEvent ( "setNextMap", getRootElement(), getMapName( g_ForcedNextMap ) ) 
    end 
) 
  
function startingNextText() -- CADU!@ 
    --getMapsCompatibleWithGamemode  
    g_ForcedNextMap = getRandomMapCompatibleWithGamemode( getThisResource(), 10, g_GameOptions.ghostmode and 0 or getTotalPlayerCount() ) 
    if g_ForcedNextMap then 
        triggerClientEvent ( "setNextMap", getRootElement(), getMapName( g_ForcedNextMap ) ) 
    end 
end 
addEventHandler( "onMapStarting", getRootElement(), startingNextText) 
  
buyed = {} 
addCommandHandler('buynextmap', 
    function( player, command, ... ) 
        local query = #{...}>0 and table.concat({...},' ') or nil 
        if not query then 
            if g_ForcedNextMap then 
                outputRace( 'Next map is ' .. getMapName( g_ForcedNextMap ), player ) 
            else 
                outputRace( 'Next map is not set', player ) 
            end 
            return 
        end 
        local map, errormsg = findMap( query ) 
        if not map then 
            outputRace( errormsg, player ) 
            return 
        end 
        if g_ForcedNextMap then 
        outputRace ( 'Another player buy next map !', player ) 
        return 
        end 
        if g_ForcedNextMap == map then 
            outputRace( 'Next map is already set to ' .. getMapName( g_ForcedNextMap ), player ) 
            return 
        end 
        g_ForcedNextMap = map 
        outputChatBox('#00B2EE* #ECECECNextmap: #ABCDEF' .. getMapName( g_ForcedNextMap ) .. ' #00FF00bought #ECECECby #ECECEC' .. getPlayerName( player ), g_Root, 255, 255, 255, true) 
        triggerClientEvent ( "setNextMap", getRootElement(), getMapName( g_ForcedNextMap ) ) 
        buyed[player] = 1 
    end 
) 
--onMapStarting 
  
addCommandHandler ( '~buyednextmap~', 
function ( player, cmd, amount ) 
if buyed[player] == 1 then 
takePlayerMoney ( player, amount ) 
buyed[player] = 0 
end 
end 
) 
  

Result:)

rawahl.png

Link to comment

You Have 2 Erros

#1 thePlayer -- not defined

#2 (mapName)

in the command you put MapName !

-- Buy a next map 
function buyMap(mapName) 
        local account = getPlayerAccount(source) 
        local cash = getAccountData(account, "cash") 
        local level = getAccountData(account, "level") 
        if not (mapName == "") then 
        if not (isGuestAccount(getPlayerAccount(source))) then 
            if tonumber(level) >= 10 then 
                if tonumber(cash) >= 3500 then 
                    executeCommandHandler ( "nextmap" , source, mapName ) 
                else 
                    outputChatBox("#FFFFFF[userpanel] #FF9900You don't have enough money to set a map!",source,255,255,255,true) 
                end 
            else 
                outputChatBox("#FFFFFF[userpanel] #FF9900You need to be level #FFFFFF10 #FF9900to buy maps!",source,255,255,255,true) 
            end 
        end  
        else 
            outputChatBox("#FFFFFF[userpanel] #FF9900Please select a map from the list first!",source,255,255,255,true) 
        end 
end 
addEvent("triggerbuyMap",true) 
addEventHandler( "triggerbuyMap", getRootElement(),buyMap ) 
  
function onBuyMapReady() 
local account = getPlayerAccount(source) 
addStat(account,"cash",-3500) 
end 
addEvent("setCashofBuyMap",true) 
addEventHandler( "setCashofBuyMap", getRootElement(), onBuyMapReady ) 
  
--end MAP 

Link to comment

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...