Jump to content

create Zone (Nemesis)


ZuKi|R

Recommended Posts

Posted (edited)

Hello, I am trying to create a Nemesis that is created with an area and that that area is adapted to the Nemesis but do not manage to do it a suggestion or help?

 

server.lua

 function Boss ( )
      NemesisRa = exports [ "slothBot" ]:spawnBot ( -2551.4892578125, 640.34375, 27.8125, 90, 312, 0, 0, NemesisRa, 23,"chasing", true )
      setElementModel ( NemesisRa, 134 )
      exports.extra_health:setElementExtraHealth ( NemesisRa, 5000 )
      exports.BiOWindow: show ( getRootElement (), "info", "#FF0000[EVENTO]> #00ff00El Boss De San Fierro Ha Aparecido\n#00ff00Si lo Matas De Recompenza Se Te Dara #00ff00$15.000", 8000,"#FF0000|ZA|~> Zombie Attack ~ Boss SF",false )
      local hillArea = createColRectangle (NemesisRa, 90, 150 )      
      attachElements ( hillArea, NemesisRa, 0, 0, 2 )
      local x, y, z = getElementPosition(NemesisRa)
      blipRa = (createBlipAttachedTo ( NemesisRa, 23 ))
      setElementData ( NemesisRa, "nemesis1", true  )
     
      setTimer(Boss, 3000000, 1)
      setTimer(destroyElement, 3000000, 1, NemesisRa)
      setTimer(destroyElement, 3000000, 1, blipRa)
end
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), Boss )  

function hill_Enter ( thePlayer, matchingDimension )
        -- announce to everyone that the player entered the hill
        if (getElementType(thePlayer) == "player") then
                outputChatBox( getPlayerName(thePlayer) .. " entered the zone!", getRootElement(), 255, 255, 109 )
                setRadarAreaFlashing ( hillRadar, true )
                triggerClientEvent (thePlayer, "nsound", thePlayer )
        end
end
addEventHandler ( "onColShapeHit", hillArea, hill_Enter )

 

Edited by ZuKi|R
Posted
3 hours ago, IIYAMA said:

You are not specific enough.

 

I am trying to create a zone that ties with the Nemesis and each player who approaches the Nemesis that serious that between wing zone of Nemesis lowers the life to him whenever it approaches to him

  • Moderators
Posted
Just now, ZuKi|R said:

I am trying to create a zone that ties with the Nemesis and each player who approaches the Nemesis that serious that between wing zone of Nemesis lowers the life to him whenever it approaches to him

Your goal is clear, but you do not describe your problem.

 

Posted
2 minutes ago, IIYAMA said:

Your goal is clear, but you do not describe your problem.

 

The code I did it of that way… but it does not create the zone in the Nemesis does not tie it… not as it is my error in the code.

  • Moderators
Posted

There should be a warning on line 26. Because the hillArea hasn't been created yet. That happens after the resource has been started.

  • Moderators
Posted

It is always recommended to check if something has been created (or not) before executing more code.

 

if NemesisRa then
	-- ...
else
	iprint("NemesisRa has not been created")
end

 


 

This is not good, using the same variable for different data, which will overwrite itself. Unless there is a very good reason for...

NemesisRa = exports [ "slothBot" ]:spawnBot ( -2551.4892578125, 640.34375, 27.8125, 90, 312, 0, 0, NemesisRa, 23,"chasing", true )

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...