Ernoso Posted November 17, 2016 Share Posted November 17, 2016 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
Dealman Posted November 17, 2016 Share Posted November 17, 2016 You've made an infinite loop, the function createPostos() triggers itself over and over. Remove it from the timer and set the number of executions to 0 instead of 1. 1 Link to comment
Ernoso Posted November 17, 2016 Author Share Posted November 17, 2016 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
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