Jump to content

Long execution error


Ernoso

Recommended Posts

Hello, I need some help here! I'm making a new gamemode for a server, but there is an error that's appearing and it's making ' Network Trouble ', it's like a infinite error!

This is what appears at console:

logs.txt

[2016-11-17 13:06:50] WARNING: Long execution (rustgamemode)
[2016-11-17 13:06:51] WARNING: [rust]\rustgamemode\vehicles_System.lua:120: Bad argument @ 'setElementData' [Expected element at argument 1, got nil]
[2016-11-17 13:06:51] WARNING: [rust]\rustgamemode\vehicles_System.lua:121: Bad argument @ 'setElementData' [Expected element at argument 1, got nil]

and then the same errors appears again, it's like infinite ultil I shutdown the server.

And there is the ' vehicles_System.lua (server-side)' file where the error appears :

function createPostos ()
	for i,postos in ipairs(posicoesPostos) do
	local x,y,z = postos[1],postos[2],postos[3]
		postosCol = createColSphere(x,y,z,3)
		setElementData(postosCol,"postogasosa",true)
		setElementData(postosCol,"gasosanoposto",100)
		
		local patrolTime = setTimer( function()
			for i, postosdestruir in ipairs(getElementsByType("colshape")) do
				if getElementData(postosdestruir,"postogasosa") then
					destroyElement(postosdestruir)
					createPostos() --respawn patrolstation (give them 100 fuel again)
				else
					--
				end
			end
		end,3600000,1) --1 hour 'till respawn fuel again
		
	end
end

createPostos() --make the patrolstation colshape and give them 100 fuel

Can you guys help me with this issue? I don't know how to fix it. Sorry for my bad english! hehe

Link to comment

Thank you, it's working now!

I removed the createPostos() function from the timer and instead added a setElementData function! and I also changed the number 1 to 0 in the timer.

This is how it looks now : 

function createPostos ()
	for i,postos in ipairs(posicoesPostos) do
	local x,y,z = postos[1],postos[2],postos[3]
		postosCol = createColSphere(x,y,z,3)
		setElementData(postosCol,"postogasosa",true)
		setElementData(postosCol,"gasosanoposto",100)
		
		local patrolTime = setTimer( function()
			for i, postosdestruir in ipairs(getElementsByType("colshape")) do
				if getElementData(postosdestruir,"postogasosa") then
					setElementData(postosdestruir,"gasosanoposto",100) --instead of destroy all patrol colshapes, it just set to 100 the fuel again!
					outputServerLog("[Rust]: Patrolpoints respawned succesfully!") --just a warning on console
				end
			end
		end,5400000,0) --new time and 0 instead of 1
		
	end
end

createPostos() --create patrolpoints on server start

Thank you, Dealman!

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...