Jump to content

Costom Func


#Paper

Recommended Posts

What's wrong in this func?

function savePlayerData (player,datatype,newvalue) 
  local playerIP = getPlayerSerial(source) 
  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 newNodeValue = xmlNodeSetAttribute (playerRootNode,datatype,newvalue) 
          xmlSaveFile ("users.xml") 
          xmlUnloadFile ("users.xml") 
          return newNodeValue 
        else 
          local playerRootNode = xmlCreateChild (usersNode,"SERIAL_" .. getPlayerSerial(player)) 
          local newNodeValue = xmlNodeSetAttribute (playerRootNode,datatype,newvalue) 
          xmlSaveFile ("users.xml") 
          xmlUnloadFile ("users.xml") 
          return newNodeValue 
        end 
      end 
    end 
  end 
end 

Link to comment

there's is a "player" here:

function savePlayerData (player,datatype,newvalue)

and "source" on the next line:

local playerIP = getPlayerSerial(source)

is source even passed to this function? otherwise i don't see what else is wrong.

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