Kaylin Posted January 12, 2011 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...
Castillo Posted January 12, 2011 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 San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Kaylin Posted January 12, 2011 Author 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.
SDK Posted January 12, 2011 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 Learn Lua - Learn to script - GUI scripting Scripter tools - Find/fix errors yourself(!) Don't pm me for scripting help, keep it for the Scripting subforum!
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