bencskrisz Posted August 4, 2019 Posted August 4, 2019 (edited) function bot1() bot1 = exports.slothbot:spawnBot (4845.0258789063, -1713.5711669922, 59.668750762939, 0, 108, 0, 0, teamLV, 31, "guarding", true ) end addEventHandler ( "onResourceStart", getResourceRootElement(), bot1 ) addEventHandler( "onBotWasted", getRootElement( ), function() setTimer( spawnBot, 5000, 1, source , 4845.0258789063, -1713.5711669922, 59.668750762939, 0, 108, 0, 0, teamLV, 31, "guarding", true ) end ) Edited August 4, 2019 by IIYAMA
Moderators IIYAMA Posted August 4, 2019 Moderators Posted August 4, 2019 (edited) local container = createElement("bots") function spawnBot(...) local bot = exports.slothbot:spawnBot(...) setElementParent(bot, container) end addEventHandler ( "onResourceStart", getResourceRootElement(), function () spawnBot(4845.0258789063, -1713.5711669922, 59.668750762939, 0, 108, 0, 0, teamLV, 31, "guarding", true) end) addEventHandler( "onBotWasted", container, function() setTimer( spawnBot, 5000, 1 , 4845.0258789063, -1713.5711669922, 59.668750762939, 0, 108, 0, 0, teamLV, 31, "guarding", true ) end ) Something like that. @bencskrisz Edited August 4, 2019 by IIYAMA
Feche1320 Posted August 4, 2019 Posted August 4, 2019 local bot1 = nil addEventHandler("onResourceStart", getResourceRootElement(), function() bot1 = exports.slothbot:spawnBot(4845.0258789063, -1713.5711669922, 59.668750762939, 0, 108, 0, 0, teamLV, 31, "guarding", true) end ) addEventHandler("onBotWasted", getRootElement(), function() setTimer(spawnPlayer, 5000, 1, bot1, 4845.0258789063, -1713.5711669922, 59.668750762939) end )
bencskrisz Posted August 4, 2019 Author Posted August 4, 2019 It still does not respawn after killing him.. Still not
Moderators IIYAMA Posted August 4, 2019 Moderators Posted August 4, 2019 1 hour ago, bencskrisz said: Nah, it still does not respawn.. 1 minute ago, bencskrisz said: It still does not respawn after killing him.. Still not Add some debug lines to your code and debug it, else you will get nowhere. And we will not be able to help you... You don't know how to do that? There is a tutorial just for that.
Feche1320 Posted August 4, 2019 Posted August 4, 2019 (edited) addEventHandler("onResourceStart", getResourceRootElement(), function() exports.slothbot:spawnBot(3, 3, 5, 0, 108, 0, 0, teamLV, 31, "guarding", true) end ) addEvent("onBotWasted") addEventHandler("onBotWasted", getRootElement(), function() setTimer( function() exports.slothbot:spawnBot(3, 3, 5, 0, 108, 0, 0, teamLV, 31, "guarding", true) end , 5000, 1) end ) You were missing 'addEvent' and on the timer to use exported functions you need to make the function inside the timer. Edited August 4, 2019 by Feche1320 1
bencskrisz Posted August 4, 2019 Author Posted August 4, 2019 Thank you SOO much Feche!! Now it finally works! God bless you brother!
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