-.Paradox.- Posted September 22, 2014 Posted September 22, 2014 Is it possible to loop the players with the same specified element data? If possible please a little help how would be appreciated. If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
crismar Posted September 22, 2014 Posted September 22, 2014 (edited) Oh well. function getPlayersByElementData(theData) local tableResult = {} for i, v in ipairs(getElementsByType("player")) do if getElementData(v, theData) then table.insert(tableResult, v) end end return tableResult end Now just use my function like this: for i, v in ipairs(getPlayersByElementData("swag")) do outputChatBox(getPlayerName(v).." has the specified element data set!", root, 0, 255, 0) end Edited September 22, 2014 by Guest Contact me if you are looking for a Web Developer. 3rd of October 2014 - Founder of RomaniaZ
-.Paradox.- Posted September 22, 2014 Author Posted September 22, 2014 Oh well. function getPlayersByElementData(theData) local tableResult for i, v in ipairs(getElementsByType("player")) do if getElementData(v, theData) then table.insert(tableResult, v) end end return tableResult end Now just use my function like this: for i, v in ipairs(getPlayersByElementData("swag")) do outputChatBox(getPlayerName(v).." has the specified element data set!", root, 0, 255, 0) end Bad argument #1 to 'insert' (table expected got nil) Anyway thanks i fixed it By the way, Here is the correction for your code i guess local tableResult = {} If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
crismar Posted September 22, 2014 Posted September 22, 2014 Oh, my fault hah. Yea, enjoy Contact me if you are looking for a Web Developer. 3rd of October 2014 - Founder of RomaniaZ
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