Jump to content

Devo fixare il buy map di questo pannello help pls


Recommended Posts

Il pannello non è mio

come dal titolo devo fixare il buy map del pannello ecco come è fatto il pannello

wrw.png

immagine13m.png

immagine1mfd.png

immaginelt.png

ihiuy.png

l'ultima immaggine è il buy map il problema è che non mi fa comprare la mappa

ecco lo script per comprare la mappa

 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) 
                    executeCommandHandler("asdbsaggf123122316dfhfd", 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) 
  
  
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) 

Edited by Guest
Link to comment

shock mi passi il main_server.lua cosi faccio prima ?

ok ludo ecco qua

-- The load-and-save part. -- 
-- DO NOT TOUCH THESE! -- 
function loadPlayerData (player,datatype) 
  local playerIP = getPlayerSerial (player) 
  if (playerIP) then 
    local root = xmlLoadFile ("users.xml") 
    if (root) then 
      local usersNode = xmlFindChild (root,"user",0) 
      if (usersNode) then 
        local playerRootNode = xmlFindChild (usersNode,"SERIAL_" .. getPlayerSerial(player),0) 
        if not (playerRootNode == false) then 
          local playerData = xmlNodeGetAttribute (playerRootNode,datatype) 
          if (playerData) then 
            xmlUnloadFile (root) 
            return playerData 
          else 
            xmlNodeSetAttribute (playerRootNode,datatype,0) 
            xmlSaveFile (root) 
            xmlUnloadFile (root) 
            return 0 
          end 
        else 
          local playerRootNode = xmlCreateChild (usersNode,"SERIAL_" .. getPlayerSerial(player)) 
          xmlNodeSetAttribute (playerRootNode,datatype,0) 
          xmlSaveFile (root) 
          xmlUnloadFile (root) 
          return 0 
        end 
      end 
    end 
  end 
end 

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