Jump to content

[HELP] Warning


Resto

Recommended Posts

Posted

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 

Posted
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  

Posted (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 by Guest
Posted
Yes they are, but some times getLocalPlayer() and localPlayer return different results at times.

I used if isElement(arg2) and warning is the same.

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

Posted
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) 
  

Posted
show me the server side.

it's only client-side not server-side.

:shock: ????

so why you add the event handler here ???? are you sure that it's your code.

addEvent("showClientMenuItem", true) 
addEventHandler("showClientMenuItem", getLocalPlayer(), showClientMenuItem) 

Posted
show me the server side.

it's only client-side not server-side.

:shock: ????

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

Posted
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). :)

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