VenomOG Posted September 26, 2019 Share Posted September 26, 2019 When i spawn the bots they turn on each other how to fix that? and set them only attacking law enforcers and also how to make if the bot died by someone that person gets $ My code so far local botpos = { {-2513.33, -625.5, 132.83,275}, {-2539.88, -598.1, 132.71,269}, {-2523.29, -597.1, 132.71,269}, {-2471.75, -626.18, 132.7,261}, {-2467.76, -611.36, 132.65,275}, {-2488.54, -609.61, 132.63,178}, {-2488.77, -623.56, 132.65,357} } for k , v in ipairs(botpos) do exports["(AAA)Slothbots"]:spawnBot(v[1],v[2],v[3],v[4],124,0,0,"Gangster",31,"guarding",source) end Link to comment
Addlibs Posted September 26, 2019 Share Posted September 26, 2019 It should be getTeamFromName("Gangster") instead of just "Gangster", as the function expects a team-element as input, not the name of the team. When the bots are on the same team they will not attack each other in "guarding" mode. To reward players for killing the bots, you'll want to use the "onBotWasted" (parameters are element attacker, float weapon, float bodypart) event called by the slothbot resource, and give money to the attacker. Link to comment
VenomOG Posted September 27, 2019 Author Share Posted September 27, 2019 So how do i define the element can i do it like ped = createPed(aa,aaa,aaaa,aaaa,aaaa) setElementData(ped,"slothbot",true) addEvent("onBotWasted",true) addEventHandler("onBotWasted",ped,function(attacker,weapon,part) if attacker then givePlayerMoney(attacker,444) end end) This is just example, can i do it like this? 23 hours ago, MrTasty said: It should be getTeamFromName("Gangster") instead of just "Gangster", as the function expects a team-element as input, not the name of the team. When the bots are on the same team they will not attack each other in "guarding" mode. To reward players for killing the bots, you'll want to use the "onBotWasted" (parameters are element attacker, float weapon, float bodypart) event called by the slothbot resource, and give money to the attacker. Link to comment
VenomOG Posted September 29, 2019 Author Share Posted September 29, 2019 Still any help? 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