daffabahy Posted February 20, 2016 Share Posted February 20, 2016 addEvent("onPlayerDayZRegister", true) addEventHandler("onPlayerDayZRegister", getRootElement(), playerRegister) function saveAccounts() local account = getPlayerAccount(source) if account then for i, data in ipairs(playerDataTable) do setAccountData(account, data[1], getElementData(source, data[1])) end local x, y, z = getElementPosition(source) setAccountData(account, "last_x", x) setAccountData(account, "last_y", y) setAccountData(account, "last_z", z) destroyElement(getElementData(source, "playerCol")) end setElementData(source, "logedin", false) end i have small problem, i cant fix that, can you help me ? [12:57:45] WARNING: [DayZ-MTA]/DayZ/login.lua:404: Bad argument @ 'destroyElemen t' [Expected element at argument 1, got boolean] Link to comment
Noki Posted February 20, 2016 Share Posted February 20, 2016 Seems like 'getElementData(source, "playerCol")' is false. You can perform a check beforehand like: local pCol = getElementData(source, "playerCol")) if (pCol and isElement(pCol)) then destroyElement(pCol) end Link to comment
daffabahy Posted February 28, 2016 Author Share Posted February 28, 2016 Seems like 'getElementData(source, "playerCol")' is false.You can perform a check beforehand like: local pCol = getElementData(source, "playerCol")) if (pCol and isElement(pCol)) then destroyElement(pCol) end Does not work, pls help me Link to comment
Mann56 Posted February 28, 2016 Share Posted February 28, 2016 destroyElement(getElementData(source, "playerCol")) Get Element Data returns : "This function returns a variable containing the requested element data, or false if the element or the element data does not exist. When getting data corresponding to a XML attribute, this is always a string." It doesn't return an element , and also it is returning false; so when you use destroyElement boolean "false" is supplied not the element. 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