Jump to content

[HELP] doubt how to make life lower in boss


side

Recommended Posts

SERVER
----------------------------------------------
local hillRadar = createRadarArea ( 1586.71667, -1156.09753, 220, 180, 53, 29, 174, 150 )
setElementData( hillRadar, 'zombieProof', true )
function nemesissbymanawydan ( )  
     --baz = createObject ( 360, 1629.98816, -1090.66821, 23.90625, 0, 0, 0 )
     nemesis = exports [ "slothBot" ]:spawnBot ( 1629.98816, -1090.66821, 23.90625, 90,  math.random ( 300, 303 ), 0, 0, Nemesis, 38, "hunting", true )
     setElementModel ( nemesis, 2 )
     setElementData(nemesis,"SWAT", true)
     exports.notifications:showBox(root,"warning","#FFFF00[EVENTO]\n#FFFFFFUn experimento conocido como #800000BOSS SWAT #FFFFFFha escapado\nhacia #FF0000Los Santos!#FFFFFF Matalo y te recompensáremos #FF0000$15.000!")

     outputChatBox ("#FFFFFF",getRootElement(), 255, 255, 255, true )
     outputChatBox ("#FFFFFF",getRootElement(), 255, 255, 255, true )
     outputChatBox ("#FFFF00[EVENTO] #FFFFFFUn experimento conocido como #800000BOSS SWAT #FFFFFFha escapado hacia Los Santos! Matalo y te recompensáremos #FF0000$15.000!",getRootElement(), 255, 255, 255, true )
     outputChatBox ("#FFFFFF",getRootElement(), 255, 255, 255, true )
     outputChatBox ("#FFFFFF",getRootElement(), 255, 255, 255, true )

     myBlip = (createBlipAttachedTo ( nemesis, 23 ))
     --attachElements ( baz, nemesis, 0.2, 0.1, 0.5, 0, 90, 0 )
     exports.extra_health:setElementExtraHealth(nemesis, 7000)
     end
addEventHandler("onResourceStart", resourceRoot, nemesissbymanawydan) 

function money (theKiller)
     if (source == nemesis) then
          givePlayerMoney(theKiller,15000)
          killerName = getPlayerName(theKiller)
          weapon = getPedWeapon(theKiller)
          wr, wg, wb = getPlayerNametagColor(theKiller)
          
          exports.killmessages:outputMessage ( {killerName,{"padding",width=3},{"icon",id=weapon or 0},{"padding",width=3},{"color",r=128,g=0,b=0}," BOSS SWAT"},getRootElement(),wr,wg,wb )
          
          x,y,z = getElementPosition(source)
          triggerClientEvent ( "bossGrito", root, x, y, z)
          exports.notifications:showBox(root,"info","#FFFF00[EVENTO]\n#FFFFFFPueden estar tranquilos, el jugador:\n#FF0000"..getPlayerName ( theKiller ).."\n#FFFFFFaniquiló al #800000BOSS SWAT #FFFFFFy fue recompensado con #FF0000$15.000!")
          outputChatBox ("#FFFFFF",getRootElement(), 255, 255, 255, true )
          outputChatBox ("#FFFFFF",getRootElement(), 255, 255, 255, true )
          outputChatBox ( "#FFFF00[EVENTO] #FFFFFFPueden estar tranquilos, el jugador: #FF0000"..getPlayerName ( theKiller ).." #FFFFFFaniquiló al #800000BOSS SWAT #FFFFFFy fue recompensado con #FF0000$15.000!",getRootElement(), 255, 255, 255, true )
          outputChatBox ("#FFFFFF",getRootElement(), 255, 255, 255, true )
          outputChatBox ("#FFFFFF",getRootElement(), 255, 255, 255, true )
          
          setTimer(nemesissbymanawydan, 3600000, 1)
          destroyElement(myBlip)
     end
end
addEvent("onBotWasted", true)
addEventHandler("onBotWasted", getRootElement(), money)

function destroy ()
     if ( not isElement ( nemesis ) ) then
     destroyElement(myBlip)
     end
end
addEvent("onBotWasted", true)
addEventHandler("onBotWasted", getRootElement(), destroy)

-----------------------------------
CLIENT

function grito(x, y, z)
    local boomb = playSound3D("SWAT.mp3", x, y, z, false)
    setSoundMaxDistance(boomb, 800)
 end
addEvent( "bossGrito", true )
addEventHandler("bossGrito", root, grito )
 
--#	Funcion Util: Barra de Vida
function drawHPBar(x, y, v, d)
    if v < 0 then v = 0 elseif v > 7000 then v = 7000 end
    dxDrawRectangle(x - 21, y, 42, 5, tocolor(0, 0, 0, 255 - d))
    dxDrawRectangle(x - 20, y + 1, v / 2.5, 3, tocolor((100 - v) * 2.55, v * 2.55, 0, 255 - d))
end

local maxDist = 50
function SWAT()
local bosses = getElementsByType ( "ped",getRootElement(),true )
local Px,Py,Pz = getCameraMatrix( )
for theKey,nemesis in ipairs(bosses) do
if ( isElement( nemesis ) ) then
local Zx,Zy,Zz = getElementPosition( nemesis )
local zhx,zhy,zhz = getPedBonePosition( nemesis,6 )
if (getDistanceBetweenPoints3D( Px, Py, Pz, Zx, Zy, Zz ) < maxDist ) then
if ( getElementData (nemesis, "SWAT") == true) then
local sxx,syy = getScreenFromWorldPosition(zhx,zhy,zhz+0.3)
local currentDistance = getDistanceBetweenPoints3D(Px, Py, Pz, Zx, Zy, Zz)
if sxx and getElementHealth(nemesis) > 0 then
sx,sy = sxx-5,syy-10


dxDrawText("BOSS SWAT", (sx)+1, (sy)+1, sx+1, (sy)+1, tocolor(0, 0, 0, 255), 1.0, "default-bold", "center", "center", false, false, false)
dxDrawText("BOSS SWAT", (sx), (sy), sx, sy, tocolor(128, 0, 0,255), 1.0, "default-bold", "center", "center", false, false, false)

local health = getElementHealth(nemesis)
if ( health > 0 ) then
    drawHPBar(sx, sy+10.5, health, currentDistance)
end

end
end
end
end
end
end
addEventHandler( "onClientRender", root, SWAT )

 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...