Fuentes Posted January 5, 2016 Posted January 5, 2016 function safeLoadCallback(qh) local result, num = dbPoll(qh, 0) for k, row in ipairs(result) do local safe = createObject(2332, row["x"],row["y"],row["z"],row["interior"],row["dimension"],row["rotation"]) setElementData(safe, "dbId", row["id"]) setElementData(safe, "x", row["x"]) setElementData(safe, "y", row["y"]) setElementData(safe, "z", row["z"]) setElementData(safe, "interior", row["interior"]) setElementData(safe, "rot", row["rotation"]) setElementData(safe, "group", row["group"]) setElementData(safe, "money", row["money"]) setElementData(safe, "kokain", row["kokain"]) setElementData(safe, "heroin", row["heroin"]) setElementData(safe, "matreial", row["material"]) end end function test(player) local money = getElementData(safe, "money") outputChatBox("money: "..money,player, 255, 0, 0) end addCommandHandler("test", test, false, false) Bad argument @ 'getElementData' [Expected element at argument 1, got nil
Dazee Posted January 5, 2016 Posted January 5, 2016 I believe the error you are getting is because the local money = getElementData(safe, "money") is in a seperate function than the object safe try this function safeLoadCallback(qh) local result, num = dbPoll(qh, 0) for k, row in ipairs(result) do local safe = createObject(2332, row["x"],row["y"],row["z"],row["interior"],row["dimension"],row["rotation"]) setElementData(safe, "dbId", row["id"]) setElementData(safe, "x", row["x"]) setElementData(safe, "y", row["y"]) setElementData(safe, "z", row["z"]) setElementData(safe, "interior", row["interior"]) setElementData(safe, "rot", row["rotation"]) setElementData(safe, "group", row["group"]) setElementData(safe, "money", row["money"]) setElementData(safe, "kokain", row["kokain"]) setElementData(safe, "heroin", row["heroin"]) setElementData(safe, "matreial", row["material"]) function test(player) local money = getElementData(safe, "money") outputChatBox("money: "..money,player, 255, 0, 0) end end end addCommandHandler("test", test, false, false) Tho I'm not sure about this I only had a quick look.
Walid Posted January 5, 2016 Posted January 5, 2016 function safeLoadCallback(qh) local result, num = dbPoll(qh, 0) for k, row in ipairs(result) do safe = createObject(2332, row["x"],row["y"],row["z"],row["interior"],row["dimension"],row["rotation"]) setElementData(safe, "dbId", row["id"]) setElementData(safe, "x", row["x"]) setElementData(safe, "y", row["y"]) setElementData(safe, "z", row["z"]) setElementData(safe, "interior", row["interior"]) setElementData(safe, "rot", row["rotation"]) setElementData(safe, "group", row["group"]) setElementData(safe, "money", row["money"]) setElementData(safe, "kokain", row["kokain"]) setElementData(safe, "heroin", row["heroin"]) setElementData(safe, "matreial", row["material"]) end end function test(player) local money = getElementData(safe, "money") if money then outputChatBox("money: "..money,player, 255, 0, 0) end end addCommandHandler("test", test) Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
Fuentes Posted January 5, 2016 Author Posted January 5, 2016 Bad argument @ 'getEleme ntData' [Expected element at argument 1, got nil]
Fuentes Posted January 5, 2016 Author Posted January 5, 2016 next getelementdata problem: local groupsafe = tonumber(getElementData(safe, "group")) and mysql datatable 2 safe id 1 safeid:faction1 2 safeid:faction2 script now i faction 1 chatbox test faction 1 safe money please help thank you function safecheck() local teamID = tonumber(getElementData(source, "group")) local groupsafe = tonumber(getElementData(safe, "group")) if teamID >0 then if groupsafe == teamID then outputChatBox ("test ") else outputChatBox ("Not are factionsafe") end else outputChatBox ("Not are faction") end end addEvent("safecheck", true ) addEventHandler("safecheck", getRootElement(),safecheck)
Addlibs Posted January 5, 2016 Posted January 5, 2016 'safe' is not defined anywhere within 'safecheck' function Previously known as MrTasty.
Fuentes Posted January 6, 2016 Author Posted January 6, 2016 'safe' is not defined anywhere within 'safecheck' function please help
Addlibs Posted January 6, 2016 Posted January 6, 2016 You're attempting to getElementData of a nil value (that is, a variable that is set to nil, or even more simply, the variable is set to nothing or not set at all) Previously known as MrTasty.
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