Speak Posted October 1, 2014 Posted October 1, 2014 players = {} for k,v in ipairs(getElementsByType("player")) do players[#players+1] = v; end how to remove a specific player? players[#players - 1] = v; ? using - does not work
'LinKin Posted October 1, 2014 Posted October 1, 2014 What? If you want to remove an specific player IN THAT table, you have two ways: 1) table.remove(players, table_index) 2) players[table_index] = nil -- Where table_index is the position of the table that you want to remove. Need a clanwar script? Click here! Do you want some free scripts for your DD server? Visit my website.
Speak Posted October 1, 2014 Author Posted October 1, 2014 What? If you want to remove an specific player IN THAT table, you have two ways:1) table.remove(players, table_index) 2) players[table_index] = nil -- Where table_index is the position of the table that you want to remove. I want to remove only one player v = ... ? players[v_index] = nil ?
Moderators IIYAMA Posted October 1, 2014 Moderators Posted October 1, 2014 Insert the player as key: players[v]=true -- Insert players[v]=nil -- remove It it easier to manage. Require the pairs loop, to loop the list. (not the ipairs) Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Anubhav Posted October 1, 2014 Posted October 1, 2014 players = {} for k,v in ipairs(getElementsByType("player")) do players[v] = v; end -- removing part: players[getPlayerFromName("someNmae")] = nil See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
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