Jump to content

ElementPosition - badArgument


Kaylin

Recommended Posts

if(message) 
    then 
        for playerKey, playerValue in ipairs(getAlivePlayers()) 
        do 
            local x1, y1, z1 = getElementPosition(thePlayer) -- badArgument here... WHY?! 
            local x2, y2, z2 = getElementPosition(playerKey) 
            if(getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) <= 50) 
            then 
                outputChatBox("[uC]"..playerName..": "..message, playerKey, 25, 105, 25, true) -- nothing special, that I will have badargument here, too -.- 
            end 
        end 

My Problem are these badArguments...and I don't know how I can fix it...

Link to comment

try this,

  
if(message) 
    then 
        for playerKey, playerValue in ipairs(getAlivePlayers()) 
        do 
            local x1, y1, z1 = getElementPosition(playerValue) -- was a bad argument because you put wrong player arg 
            local x2, y2, z2 = getElementPosition(playerValue) 
            if(getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) <= 50) 
            then 
                outputChatBox("[uC]"..playerName..": "..message, playerValue, 25, 105, 25, true) -- nothing special, that I will have badargument here, too -.- 
            end 
        end 

Link to comment

Because these two lines do the same:

            local x1, y1, z1 = getElementPosition(playerValue) 
           local x2, y2, z2 = getElementPosition(playerValue) 

One of them should get the position of the player you're comparing to, so change the second playerValue to the correct player element

Link to comment

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