Jump to content

weird problem


Castillo

Recommended Posts

Posted

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) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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? o.O

2nd one makes me too lazy to check what's your code doing and where could be error

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
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? o.O

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

https://wiki.multitheftauto.com/wiki/Debugging

and remember: debug is not that "debugscript 3" window, debug it's idea of spotting errors.

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
https://wiki.multitheftauto.com/wiki/Debugging

and 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 :roll::roll:

Edit: well, nevermind then i've made separate functions (was my first idea) so now works well, thanks anyway.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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