Resto Posted August 3, 2016 Share Posted August 3, 2016 Hi, I don't know where is problem.. any can help me? arg2 is element (car, player etc..) Warning: WARNING: Bad argument @ 'getElementData' [Expected element at argument 1, got nil] if (getElementData(arg2,"bleeding") or 0) > 0 and (getElementData(getLocalPlayer(),"Bandage") or 0) >= 1 then Link to comment
Captain Cody Posted August 3, 2016 Share Posted August 3, 2016 Can I see the rest of the script, to ensue it's defined correctly. Link to comment
Walid Posted August 3, 2016 Share Posted August 3, 2016 Warning: WARNING: Bad argument @ 'getElementData' [Expected element at argument 1, got nil] Try this: -- Check here if arg2 exist then .... local bleeding = getElementData(arg2,"bleeding") or 0 local bandage = getElementData(localPlayer,"Bandage") or 0 if bleeding > 0 and bandage >= 1 then -- put your code here end Link to comment
Resto Posted August 3, 2016 Author Share Posted August 3, 2016 (edited) Warning: WARNING: Bad argument @ 'getElementData' [Expected element at argument 1, got nil] Try this: -- Check here if arg2 exist then .... local bleeding = getElementData(arg2,"bleeding") or 0 local bandage = getElementData(localPlayer,"Bandage") or 0 if bleeding > 0 and bandage >= 1 then -- put your code here end This? if isElement(arg2) then -- or if getElementType(arg2) == "player" then ??? local bleeding = getElementData(arg2,"bleeding") or 0 local bandage = getElementData(localPlayer,"Bandage") or 0 if bleeding > 0 and bandage >= 1 then -- put your code here end end and localPlayer / getLocalPlayer() is the same or? Edited August 3, 2016 by Guest Link to comment
Captain Cody Posted August 3, 2016 Share Posted August 3, 2016 Yes they are, but some times getLocalPlayer() and localPlayer return different results at times. Link to comment
Resto Posted August 3, 2016 Author Share Posted August 3, 2016 Yes they are, but some times getLocalPlayer() and localPlayer return different results at times. I used if isElement(arg2) and warning is the same. Link to comment
Captain Cody Posted August 3, 2016 Share Posted August 3, 2016 is this server side or client sided. Link to comment
Resto Posted August 3, 2016 Author Share Posted August 3, 2016 is this server side or client sided. Client. Link to comment
Walid Posted August 3, 2016 Share Posted August 3, 2016 and localPlayer / getLocalPlayer() is the same or? Yes they are, but some times getLocalPlayer() and localPlayer return different results at times. localPlayer is predefined variable ( returns the player element of the local player.) So using localPlayer / getLocalPlayer() is the same thing. I'm pretty sure arg2 is not defined in your code, post full code here. Link to comment
Resto Posted August 4, 2016 Author Share Posted August 4, 2016 and localPlayer / getLocalPlayer() is the same or? Yes they are, but some times getLocalPlayer() and localPlayer return different results at times. localPlayer is predefined variable ( returns the player element of the local player.) So using localPlayer / getLocalPlayer() is the same thing. I'm pretty sure arg2 is not defined in your code, post full code here. function showClientMenuItem(arg1,arg2,arg3,arg4) local number = 0 if arg1 == "Player" then if isElement(arg2) then if (getElementData(arg2,"bleeding") or 0) > 0 and (getElementData(getLocalPlayer(),"Bandage") or 0) >= 1 then number = number+1 guiSetVisible(spalteGuiImage[number],true) guiSetText(spalteGuiText[number],"Give Bandage") guiLabelSetColor (spalteGuiText[1],50,255,50) setElementData(spalteGuiText[1],"markedMenuItem",true) setElementData(spalteGuiText[number],"usedItem","bandage") end end end addEvent("showClientMenuItem", true) addEventHandler("showClientMenuItem", getLocalPlayer(), showClientMenuItem) Link to comment
Resto Posted August 4, 2016 Author Share Posted August 4, 2016 show me the server side. it's only client-side not server-side. Link to comment
Walid Posted August 4, 2016 Share Posted August 4, 2016 show me the server side. it's only client-side not server-side. ???? so why you add the event handler here ???? are you sure that it's your code. addEvent("showClientMenuItem", true) addEventHandler("showClientMenuItem", getLocalPlayer(), showClientMenuItem) Link to comment
Resto Posted August 4, 2016 Author Share Posted August 4, 2016 show me the server side. it's only client-side not server-side. ???? so why you add the event handler here ???? are you sure that it's your code. addEvent("showClientMenuItem", true) addEventHandler("showClientMenuItem", getLocalPlayer(), showClientMenuItem) It's not my code.. but |LT|Marwin and -ffs-Sniper was released the dayz.. Link to comment
Rataj Posted August 6, 2016 Share Posted August 6, 2016 Anyone please? arg2 is probably not supplied, problem is somewhere in server-side. Trust us or not, but that event is called from some server-sided script (or maybe at least from another client-sided script). 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