lucas_ssg Posted May 5, 2014 Share Posted May 5, 2014 I am trying to use bots on my DayZ server to guard a cargobob, for event, so when player go to the cargobob to get the items, the bots will guard and shot the players. But the problem is that the bots can't die and can't damage players! I don't know much about scripting, but can someone please help me? I am using this code: --[[function boss (player,comando,weaponid,skinid) local x,y,z = getElementPosition(player) slothbot1 = exports [ "slothbot" ]:spawnBot ( x,y,z , 90, tonumber(skinid), 0, 0, ex, tonumber(weaponid), "guarding", true ) end addCommandHandler("spawnbot",boss)]] ex = createTeam("Zombies",255,0,0) function boss (player,comando,weaponid,skinid) local x,y,z = getElementPosition(player) slothbot1 = exports [ "slothbot" ]:spawnBot ( x,y,z , 0, tonumber(weaponid), 0, 0, ex, tonumber(skinid), "guarding", true ) end addCommandHandler("spawnbot",boss) function pauseBot (player,command,state) local allBots = getElementsByType ( "ped" ) for index, boss in ipairs(allBots) do if ( exports [ "slothbot" ]: getBotAttackEnabled ( boss ) == false ) then exports [ "slothbot" ]: setBotAttackEnabled ( boss, true ) elseif ( exports [ "slothbot" ]: getBotAttackEnabled ( boss ) == true ) then exports [ "slothbot" ]: setBotAttackEnabled ( boss, false ) end end end addCommandHandler("pausebot",pauseBot) function restartBot (ped,commando) local allBots = getElementsByType ( "ped" ) for index, boss in pairs(allBots) do killPed(boss) end end addCommandHandler("rbot",restartBot) function rewardOnWasted ( ammo, killer, killerweapon, bodypart ) if ( killer ) and ( killer ~= source ) then givePlayerMoney ( killer, 150 ) end end addEventHandler ( "onPedWasted", getRootElement(), rewardOnWasted ) function info(player) outputChatBox("Syntaxis : /spawnbot SkinID - WeaponID",player,255,0,0) outputChatBox("Example : /spawnbot 24 0",player,255,0,0) end addCommandHandler("botinfo",info) Sorry about my english! Link to comment
tosfera Posted May 5, 2014 Share Posted May 5, 2014 Has it come to your attention that the entire code is out-commented because of this "--[["? Link to comment
lucas_ssg Posted May 5, 2014 Author Share Posted May 5, 2014 --[[function boss (player,comando,weaponid,skinid) local x,y,z = getElementPosition(player) slothbot1 = exports [ "slothbot" ]:spawnBot ( x,y,z , 90, tonumber(skinid), 0, 0, ex, tonumber(weaponid), "guarding", true ) end addCommandHandler("spawnbot",boss)]] Stops right here 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