TorNix~|nR Posted November 5, 2017 Share Posted November 5, 2017 (edited) Hello guys, I have a event that appears sometimes, is a boss, and it's element is "boss" I want when the element is activated, the zombies doesn't appear, and when it's disabled the zombies appear again, help? local aa = getElementData("zombie") if getElementData("boss") ~= true then destroyElement(aa) How can I do it? Edited November 5, 2017 by TorNix~|nR Link to comment
itHyperoX Posted November 6, 2017 Share Posted November 6, 2017 if isElement(aa) then return false end 1 Link to comment
TorNix~|nR Posted November 7, 2017 Author Share Posted November 7, 2017 function isBossActivated(bb) local ee = getElementData(bb,"zombie") if getElementData(bb,"boss") ~= true then if isElement(ee) then return false end end end it's not working? Link to comment
Moderators IIYAMA Posted November 7, 2017 Moderators Share Posted November 7, 2017 You will have to study the script that is creating the `boss`, because this is just bull:~ code and will not get you anywhere. Check for export functions or custom events you could trigger. 1 Link to comment
TorNix~|nR Posted November 7, 2017 Author Share Posted November 7, 2017 I do not found the solution I try at least 100 times, even I use outputChatBox, and it didn't show I just want when the boss is activated, the zombies disappear. Link to comment
Moderators IIYAMA Posted November 7, 2017 Moderators Share Posted November 7, 2017 Before you can try, you have to understand else those 100 times are for nothing. So tell me what did you learn from the code? 1 Link to comment
TorNix~|nR Posted November 7, 2017 Author Share Posted November 7, 2017 (edited) I think I should not use true I should use, like this local boss = getElementData(source, "boss") if boss then is it? Also I found this little code (example) on my client-side, so I think it's like that addEventHandler("onClientPedDamage", root, function (attacker, weapon) local boss = getElementData(source, "boss") if boss and antiWeapon[weapon] then cancelEvent() end end) but the problem, I do not know how to do it.. Edited November 7, 2017 by TorNix~|nR Link to comment
Moderators IIYAMA Posted November 7, 2017 Moderators Share Posted November 7, 2017 Because you haven't found it yet. The boss is probably created serverside, because it has to be synced with all other players. I do not know the script, neither I am going to spend time searching it for you (I don't have that luxury either). This will be your first research case, where you have to search and find a component you want to edit. Did you know that I spend more than 30 hours researching a single resource? (one of the first large resources I came in contact with) While researching I started to edit things on the way, which makes researching a bit more interesting. Tell me @TorNix~|nR, how much energy and time are you going to spend on achieving this? 1 Link to comment
TorNix~|nR Posted November 7, 2017 Author Share Posted November 7, 2017 I will spend what I can Thank you. 1 Link to comment
ShayF2 Posted November 8, 2017 Share Posted November 8, 2017 (edited) addEventHandler('onClientPedDamage',root,function(attacker,weapon,bodyPart,loss) if loss then local boss = getElementData(source,'boss') if boss then -- if you want to get its actual data.. if boss == 'yes its the :Oin boss xD' then cancelEvent() setElementHealth(source,(getElementHealth(source)-(loss%5))) -- this is if you want the boss to SLOWLY lose health.. end end end) --[[ getElementData(element element, string dataName [, inherit = true/false]) setElementData(element element, string dataName, var value [, bool sync = true/false]) ]] Everything inside [] are optional arguments, the rest is required (usually). Note that it is Element First, meaning ped, player, vehicle, whatever you are targeting.. Then after element is the data name.. Edited November 8, 2017 by ShayF 1 Link to comment
TorNix~|nR Posted November 8, 2017 Author Share Posted November 8, 2017 @ShayF, Thank you, but I just want to stop spawning zombies while the boss is activated and when the boss died, zombies come back, like that.. Link to comment
pa3ck Posted November 8, 2017 Share Posted November 8, 2017 Zombies aren't just appearing randomly, some part of the code is spawning them.. go there, add an if statement to check whether a boss is spawned and that's it. There's more than likely a timer or something already there that keeps the code running over and over again, so a simple if statement should be enough. 1 Link to comment
TorNix~|nR Posted November 8, 2017 Author Share Posted November 8, 2017 Done! guys I fixed it, and it was so easy xD, I just use startResource and stopResource, while the boss is activated Thanks for everyone! 1 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