Jump to content

Working limit


Zcraks

Recommended Posts

On 26/06/2019 at 10:01, IIYAMA said:

local playersInJobs = {
["job-name"] = {}
}

table.insert(playersInJobs["job-name"], player)


if #playersInJobs["job-name"] == 10 then
  
end

 


            for k, i in ipairs(playersInJobs["job-name"]) do
                while playersInJobs["job-name"][i] do
                    if i == element then
                        table.remove(playersInJobs["job-name"], i)
                    end
                end
            end   

Why not removed from the table?

Link to comment
7 hours ago, #,xiRocKyz said:

for index = 1, #playersInJobs["job-name"] do
    if playersInJobs["job-name"][index] == element then
        table.remove(playersInJobs["job-name"], index)
        break
    end
end

 

if #playersInJobs["job-name"] <= 9 and  #playersInTurn["job-name"] ~= nil then
	for k,i in ipairs(playersInTurn["job-name"]) do
		player = getPlayerFromNick (playersInTurn["job-name"][i])
			if player ~= false then
				outputChatBox ("Go to job !", player)
      		end
	end		
end

How to make sure that when a place becomes available, it notifies the first player in the queue ?

Link to comment
1 hour ago, Zcraks said:

if #playersInJobs["job-name"] <= 9 and  #playersInTurn["job-name"] ~= nil then
	for k,i in ipairs(playersInTurn["job-name"]) do
		player = getPlayerFromNick (playersInTurn["job-name"][i])
			if player ~= false then
				outputChatBox ("Go to job !", player)
      		end
	end		
end


How to make sure that when a place becomes available, it notifies the first player in the queue ?

for index = 1, #playersInJobs["job-name"] do
    if playersInJobs["job-name"][index] == element then
        table.remove(playersInJobs["job-name"], index)
        if playersInJobs["job-name"][1] and isElement ( playersInJobs["job-name"][1] ) then
            outputChatBox ( "NOTIFICATION : Go to the job" , playersInJobs["job-name"][1] )
        end
        break
    end
end

 

  • Thanks 1
Link to comment
On 28/06/2019 at 15:56, #x1AhMeD-09 said:

for index = 1, #playersInJobs["job-name"] do
    if playersInJobs["job-name"][index] == element then
        table.remove(playersInJobs["job-name"], index)
        if playersInJobs["job-name"][1] and isElement ( playersInJobs["job-name"][1] ) then
            outputChatBox ( "NOTIFICATION : Go to the job" , playersInJobs["job-name"][1] )
        end
        break
    end
end

 

while  playersInJobs["Job"] == 10  do
	while  playersInTurn["Job"] == 0  do
                if playersInTurn["Job"][1] and isElement ( playersInTurn["Job"][1] ) then
                    outputChatBox ( "Go to the job" , playersInTurn["Job"][1] )
                    one = (playersInTurn["lawn"][1])
                    	timer = setTimer(function (one)
                        	table.remove(playersInTurn["lawn"], one)
                            outputChatBox("Time is out", one)
                        end, 20000, 1)
						break  
                end
   end
end 

How to make it work? 

Link to comment
local Timers = {}
while  playersInJobs["Job"] == 10  do
    while  playersInTurn["Job"] == 0  do
        if playersInTurn["Job"][1] and isElement ( playersInTurn["Job"][1] ) then
            outputChatBox ( "Go to the job" , playersInTurn["Job"][1] )
            local newIndex = #Timers+1
            Timers[newIndex] = setTimer ( 
                function ( newIndex )
                    table.remove(playersInTurn["lawn"], 1)
                    outputChatBox("Time is out", playersInTurn["lawn"][1])
                    Timers[newIndex] = false
                end
            , 20000, 1, newIndex)
            break  
        end
    end
end 

 

Edited by #x1AhMeD-09
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...