Jump to content

buy next map problem


ALw7sH

Recommended Posts

Posted

hello,

i have problem with dashboard buy next

if i buy next he take money from me and dont set my next

racevoting_server

function buyMap(thePlayer,mapName) 
    if mapIsAlreadySet == false then 
        if not (mapName == "") then 
            local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) 
            if playerCash >= mapCost then 
                executeCommandHandler("buynextmap",thePlayer,mapName) 
                savePlayerData(thePlayer,"cash",playerCash-mapCost) 
                outputChatBox("#FFFFFFNextmap: "..getPlayerName(thePlayer).."#FFFFFF has bought a next map!",getRootElement(),255,255,255,true) 
                outputChatBox("#FFFFFFNextmap: #0095FF"..mapName,getRootElement(),255,255,255,true) 
                mapIsAlreadySet = thePlayer 
                local oldmapbuys = loadPlayerData(thePlayer,"mapBuys") 
                savePlayerData(thePlayer,"mapBuys", oldmapbuys + 1) 
                CheckAchievement(thePlayer,13) 
                scoreboardRefresh(thePlayer) 
            else 
                outputChatBox("#0095FF# #FFFFFFYou don't have enough money to set a map!",thePlayer,255,255,255,true) 
            end 
        else 
            outputChatBox("#0095FF# #FFFFFFPlease select a map from the list first!",thePlayer,255,255,255,true) 
        end 
    else 
        outputChatBox("#0095FF# #FFFFFFA map is already set at the moment! Please try again later.",thePlayer,255,255,255,true) 
    end 
end 
addEvent("onScriptSetNextMap",true) 
addEventHandler("onScriptSetNextMap",getRootElement(), 
function (mapName, thePlayer) 
    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) 

dash

function buyMap(thePlayer,mapName,command) 
    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 
                    if not tableFind(mapQueue,mapName) then 
                        table.insert(mapQueue,mapName) 
                        outputChatBox("#ff9900[NEXT] #ffffff"..getPlayerName(thePlayer).."#FFFFFF has bought #ff9900"..tostring(mapName).."#ffffff!",getRootElement(),255,255,255,true) 
                        outputChatBox("#ff9900[NEXT] #ffffff"..tostring(mapName).."#ffffff successfully added to map queue!",getRootElement(),255,255,255,true) 
                        addStat(account,"buyedMaps",1) 
                        setAccountData(account,"cash",playerCash - mapCost) 
                        scoreboardRefresh(thePlayer) 
                        mapTimer[mapName] = setTimer(resetMapTimer,60000*35,1,mapName) 
                        if #mapQueue <= 1 then 
                            triggerEvent("onBoughtMap",getRootElement(),mapName) 
                        end 
                        callClientFunction(getRootElement(),"setMapQueue",mapQueue) 
                    else 
                        outputChatBox("#ff9900[NEXT] #FFFFFFMap "..mapName.." is already in map queue.",thePlayer,255,255,255,true) 
                    end 
                else 
                    local remaining, executesRemaining, totalExecutes = getTimerDetails(mapTimer[mapName]) 
                    if remaining < 60000 then 
                        remaining = math.floor(remaining/1000).."#ffffff second" 
                    else 
                        minutes = math.floor(remaining/60000) 
                        remaining = string.format('%02d',minutes).."#ffffff minutes" 
                    end 
                    outputChatBox("#ff9900[NEXT] #FFFFFFYou have to wait #ff9900"..remaining.." to set this map!",thePlayer,255,255,255,true) 
                end 
            else 
                outputChatBox("#ff9900[NEXT] #FFFFFFYou don't have enough money to set a map!",thePlayer,255,255,255,true) 
            end 
        else 
            outputChatBox("#ff9900[NEXT] #FFFFFFPlease select a map from the list first!",thePlayer,255,255,255,true) 
        end 
    else 
        outputChatBox("#ff9900[NEXT] #FFFFFFA map is already set at the moment! Please try again later.",thePlayer,255,255,255,true) 
    end 
end 

what is the problem?

Posted
This code doesn't seem to be yours.

yes not my code : |

the racevoting_server in game mode

and the dash in dashboard

now can you help me ? : /

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