Castillo Posted September 23, 2010 Share Posted September 23, 2010 hey, i've found a really weird problem at my script, i'm triggering from client side some datas and when i want to get them at server keeps saying "nil", if i change the argument positions at function it will work some times but its really annoying to catch them all working, here is my code. function editDatas(cliente,evento,color,bank,cash) local jug = getElementData(cliente,"clickedPlayer") local charjug = getElementData(cliente,"clickedCharacter") if evento == "color" then exports.CasHaw:setCharacterData(jug,charjug,"redcolor",color[1]) exports.CasHaw:setCharacterData(jug,charjug,"greencolor",color[2]) exports.CasHaw:setCharacterData(jug,charjug,"blueolor",color[3]) outputChatBox("Colors changed to: ".. color[1] ..":".. color[2] ..":".. color[3] .."!",cliente,0,255,0) elseif evento == "bank" then exports.CasHaw:setCharacterData(jug,charjug,"bank",tostring(bank)) outputChatBox("Bank balance set to: ".. tostring(bank) .."!",cliente,0,255,0) elseif evento == "cash" then exports.CasHaw:setCharacterData(jug,charjug,"cash",tostring(cash)) outputChatBox("Hand money set to: ".. tostring(cash) .."!",cliente,0,255,0) end end addEvent( "changeCharData", true ) addEventHandler( "changeCharData", getRootElement(),editDatas) Link to comment
dzek (varez) Posted September 23, 2010 Share Posted September 23, 2010 i can only say two things 1. debug. you are here for long time and still can't debug? 2. indentations. you are scripting for long time and still not making proper indentations? 2nd one makes me too lazy to check what's your code doing and where could be error Link to comment
Castillo Posted September 23, 2010 Author Share Posted September 23, 2010 i can only say two things1. debug. you are here for long time and still can't debug? 2. indentations. you are scripting for long time and still not making proper indentations? 2nd one makes me too lazy to check what's your code doing and where could be error what do you mean with "debug"?? its output when i execute the function "nil" .. Link to comment
dzek (varez) Posted September 23, 2010 Share Posted September 23, 2010 https://wiki.multitheftauto.com/wiki/Debugging and remember: debug is not that "debugscript 3" window, debug it's idea of spotting errors. Link to comment
Castillo Posted September 24, 2010 Author Share Posted September 24, 2010 https://wiki.multitheftauto.com/wiki/Debuggingand remember: debug is not that "debugscript 3" window, debug it's idea of spotting errors. really, i don't see what can be wrong, i change the arguments positions and works but then others stops working Edit: well, nevermind then i've made separate functions (was my first idea) so now works well, thanks anyway. 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