JeViCo Posted August 23, 2018 Share Posted August 23, 2018 Hello everyone! I have a list of numbers from 1 to 100 (ids of npcs). Player take a quest to kill one. How can i avoid the quest where 2 and more players have to kill the same npc? How can i get unused npc's id? Link to comment
SycroX Posted August 23, 2018 Share Posted August 23, 2018 9 minutes ago, JeViCo said: Hello everyone! I have a list of numbers from 1 to 100 (ids of npcs). Player take a quest to kill one. How can i avoid the quest where 2 and more players have to kill the same npc? How can i get unused npc's id? use tables .. insert the used id to the table and check that the id isn't in the table when a player try to take a quest ex .. local myTable = {} addCommandHandler("q", function(p,_,n) local n = tonumber(n) if not myTable[n] then outputChatBox("number inserted to table .. ", p) myTable[n] = true else outputChatBox("this number is already inserted to the table", p) end end ) 1 Link to comment
JeViCo Posted August 23, 2018 Author Share Posted August 23, 2018 sweet. That helps me with other scripts too. Thanks you 1 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