Kaylin Posted January 12, 2011 Share Posted January 12, 2011 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
Castillo Posted January 12, 2011 Share Posted January 12, 2011 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
Kaylin Posted January 12, 2011 Author Share Posted January 12, 2011 I don't get badArgument anymore, but now I've got another Problem. The Text is shown to all Players and not to those, who are in the range of 50. Link to comment
SDK Posted January 12, 2011 Share Posted January 12, 2011 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
Kaylin Posted January 13, 2011 Author Share Posted January 13, 2011 runs perfect now... Thanks for help... 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