Jump to content

Need help with xml file.


Michcio

Recommended Posts

I have problem. Debug outputs: "ERROR: panelszefa\panelszefapd_s.lua:52: attempt to perform arithmetic on a nil value". This is "xmlNodeSetAttribute(v, "ilosc", tostring(tonumber(stann) - 60000))" line.

function zmienstan (ranga,stann) 
    if ranga == "Szef" then 
    local root = xmlLoadFile ("pd.xml") 
    local pdroot = xmlFindChild (root,"stankontapd",0) 
    if (pdroot) then 
        for i,v in ipairs (xmlNodeGetChildren(pdroot)) do 
        xmlNodeSetAttribute(v, "ilosc", tostring(tonumber(stann) - 60000)) 
        end 
    end 
    end 
end 
addEvent("onPDZmienStan",true) 
addEventHandler("onPDZmienStan",getRootElement(),zmienstan) 

Link to comment

It is triggered on client-side.

function dajwyplatewpd () 
if source == dajwyplatepd then 
if guiGridListGetSelectedItem ( pszefapdgrid ) then 
local kto = guiGridListGetItemText ( pszefapdgrid, guiGridListGetSelectedItem ( pszefapdgrid ), column1 ) 
local ranga = guiGridListGetItemText ( pszefapdgrid, guiGridListGetSelectedItem ( pszefapdgrid ), column3 ) 
triggerServerEvent("onPDDajWyplate",getRootElement(),kto,ranga,getLocalPlayer()) 
triggerServerEvent("onPDZmienStan",getRootElement(),ranga,guiGetText(stankontapd)) 
end 
end 
end 
addEventHandler("onClientGUIClick",getRootElement(),dajwyplatewpd) 

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