FSXTim Posted June 12, 2012 Posted June 12, 2012 Hello, I triggered something. (clientside --> serverside) Error in the serverside script (line 2): Bad argument @ 'getElementData' [Expexted element at argument 1, got nil] clientside: function repair1_Button (state) if state == "left" then if source == GUIEditor_Button[1] then local lp = getLocalPlayer() triggerServerEvent("repair1", lp) end end end addEventHandler("onClientGUIClick", getRootElement(), repair1_Button) serverside: function repair1 (lp) if (tonumber(getElementData(lp, "Money")) >= 50) then outputDebugString(getElementData(lp,"Money")) setElementData(lp, "Money", getElementData(lp, "Money") - 50) outputChatBox ("Dein Auto wurde repariert!", lp, 0, 205, 0 ) else outputChatBox("Du hast nicht genug Geld!", lp, 255, 48, 48) end end addEvent ( "repair1", true ) addEventHandler ( "repair1", getRootElement(), repair1 ) Greets
Castillo Posted June 12, 2012 Posted June 12, 2012 1: Remove "lp" from the function name @ server side. 2: Replace "lp" with "source" @ server side. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
FSXTim Posted June 12, 2012 Author Posted June 12, 2012 (edited) function repair1 () if (tonumber(getElementData(source, "Money")) >= 50) then outputDebugString(getElementData(source,"Money")) setElementData(source, "Money", getElementData(source, "Money") - 50) outputChatBox ("Dein Auto wurde repariert!", source, 0, 205, 0 ) else outputChatBox("Du hast nicht genug Geld!", source, 255, 48, 48) end end addEvent ( "repair1", true ) addEventHandler ( "repair1", getRootElement(), repair1 ) Nothing happens now. Just nothing. Also no DebugString. Greets Edited June 12, 2012 by Guest
Wei Posted June 12, 2012 Posted June 12, 2012 addEvent ( "repair1", true ) addEventHandler ( "repair1", getRootElement(), repair1 ) Diet with russian vodka, lose 3 days in one week !
Wei Posted June 13, 2012 Posted June 13, 2012 no problem Diet with russian vodka, lose 3 days in one week !
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