Michcio Posted January 19, 2013 Share Posted January 19, 2013 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
novo Posted January 19, 2013 Share Posted January 19, 2013 Post your full code, what data are you sending to "onPDZmienStan"? Link to comment
Michcio Posted January 19, 2013 Author Share Posted January 19, 2013 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
novo Posted January 19, 2013 Share Posted January 19, 2013 guiGetText(stankontapd) Where stankontapd is? Link to comment
Michcio Posted January 20, 2013 Author Share Posted January 20, 2013 stankontapd is at the beggining of the code. The problem is not in stankontapd but in : xmlNodeSetAttribute(v, "ilosc", tostring(tonumber(stann) - 60000)) Link to comment
Scooby Posted January 20, 2013 Share Posted January 20, 2013 just add some checks in it to make sure that the gui ur getting the text from contains a number. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now