Jacobob14 Posted March 4, 2014 Share Posted March 4, 2014 as I can make 10 appear nemesis and not only one function BossNemesis ( thePlayer ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then local x, y, z = getElementPosition ( thePlayer ) nemesi4 = exports [ "slothBot" ]:spawnBot ( x+1,y+1,z+0.5, 90, math.random ( 300, 303 ), 0, 0, Nemesis, 38, "hunting", true ) exports.extra_health:setElementExtraHealth ( nemesi4, 150 ) setElementModel ( nemesi4, 107 ) end end addCommandHandler ( "nemesis",BossNemesis ) addEvent("onBotWasted",true) addEventHandler("onBotWasted",getRootElement(), function (killer) if (source == nemesi4) then givePlayerMoney(killer,math.random(1000,1000)) killerName = getPlayerName(killer) weapon = getPedWeapon(killer) wr, wg, wb = getPlayerNametagColor(killer) exports.killmessages:outputMessage ( {killerName,{"padding",width=3},{"icon",id=weapon or 0},{"padding",width=3},{"color",r=141,g=7,b=220},"Nemesis"},getRootElement(),wr,wg,wb ) exports.exp_system:addPlayerEXP ( killer, math.random(1, 200)) end end) Link to comment
DNL291 Posted March 4, 2014 Share Posted March 4, 2014 Try this: local nemesisBots = {} function BossNemesis ( thePlayer ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then for i=1, 10 do local x, y, z = getElementPosition ( thePlayer ) nemesisBots[i] = exports [ "slothBot" ]:spawnBot ( x+i,y+i,z+(i/2), 90, math.random ( 300, 303 ), 0, 0, Nemesis, 38, "hunting", true ) exports.extra_health:setElementExtraHealth ( nemesisBots[i], 150 ) setElementModel ( nemesisBots[i], 107 ) end end end addCommandHandler ( "nemesis",BossNemesis ) addEvent("onBotWasted",true) addEventHandler("onBotWasted",getRootElement(), function (killer) for i, nemesis in ipairs(nemesisBots) do if (source == nemesis) then givePlayerMoney(killer,math.random(1000,1000)) local killerName = getPlayerName(killer) local weapon = getPedWeapon(killer) local wr, wg, wb = getPlayerNametagColor(killer) exports.killmessages:outputMessage ( {killerName,{"padding",width=3},{"icon",id=weapon or 0},{"padding",width=3},{"color",r=141,g=7,b=220},"Nemesis"},getRootElement(),wr,wg,wb ) exports.exp_system:addPlayerEXP ( killer, math.random(1, 200)) break end end end) Link to comment
Jacobob14 Posted March 4, 2014 Author Share Posted March 4, 2014 es posible que no puede matarse unos a otros Link to comment
manawydan Posted March 4, 2014 Share Posted March 4, 2014 just create team local Nemesis = createTeam("Nemesis",250,0,0) local nemesisBots = {} function BossNemesis ( thePlayer ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then for i=1, 10 do local x, y, z = getElementPosition ( thePlayer ) nemesisBots[i] = exports [ "slothBot" ]:spawnBot ( x+i,y+i,z+(i/2), 90, math.random ( 300, 303 ), 0, 0, Nemesis, 38, "hunting", true ) exports.extra_health:setElementExtraHealth ( nemesisBots[i], 150 ) setElementModel ( nemesisBots[i], 107 ) end end end addCommandHandler ( "nemesis",BossNemesis ) addEvent("onBotWasted",true) addEventHandler("onBotWasted",getRootElement(), function (killer) for i, nemesis in ipairs(nemesisBots) do if (source == nemesis) then givePlayerMoney(killer,math.random(1000,1000)) local killerName = getPlayerName(killer) local weapon = getPedWeapon(killer) local wr, wg, wb = getPlayerNametagColor(killer) exports.killmessages:outputMessage ( {killerName,{"padding",width=3},{"icon",id=weapon or 0},{"padding",width=3},{"color",r=141,g=7,b=220},"Nemesis"},getRootElement(),wr,wg,wb ) exports.exp_system:addPlayerEXP ( killer, math.random(1, 200)) break end end end) Link to comment
Jacobob14 Posted March 4, 2014 Author Share Posted March 4, 2014 Thanks works well but when I killed the nemesis boot error on the console http://prntscr.com/2xy2vd Link to comment
manawydan Posted March 4, 2014 Share Posted March 4, 2014 try change addEventHandler("onPedWasted",getRootElement(), function (_,killer) for i, nemesis in ipairs(nemesisBots) do if (source == nemesis) then givePlayerMoney(killer,math.random(1000,1000)) local killerName = getPlayerName(killer) local weapon = getPedWeapon(killer) local wr, wg, wb = getPlayerNametagColor(killer) exports.killmessages:outputMessage ( {killerName,{"padding",width=3},{"icon",id=weapon or 0},{"padding",width=3},{"color",r=141,g=7,b=220},"Nemesis"},getRootElement(),wr,wg,wb ) exports.exp_system:addPlayerEXP ( killer, math.random(1, 200)) break end end end) 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