GanJaRuleZ Posted December 2, 2011 Share Posted December 2, 2011 Hey all , i'm a new scripter... I've got a script originaly made by fdc-invincible This script is called hunter_alert But there it's a problem... When some one got hunter it says once , when the second got the hunter , then it says again and so on. It causes a very big spam. Can anyone to make it say just one time? Here its the script! function someoneReachedHunter(number, sort, model) if sort == "vehiclechange" and model == 425 then outputChatBox ( getPlayerName(source).." #FF6464has gotten the hunter! Run!", getRootElement(), 255, 255, 255, true ) end end addEvent("onPlayerPickUpRacePickup",true) addEventHandler("onPlayerPickUpRacePickup",getRootElement(),someoneReachedHunter) --end Thanks to everyone who helps me Link to comment
unknooooown Posted December 2, 2011 Share Posted December 2, 2011 Hey all , i'm a new scripter...I've got a script originaly made by fdc-invincible This script is called hunter_alert But there it's a problem... When some one got hunter it says once , when the second got the hunter , then it says again and so on. It causes a very big spam. Can anyone to make it say just one time? Here its the script! function someoneReachedHunter(number, sort, model) if sort == "vehiclechange" and model == 425 then outputChatBox ( getPlayerName(source).." #FF6464has gotten the hunter! Run!", getRootElement(), 255, 255, 255, true ) end end addEvent("onPlayerPickUpRacePickup",true) addEventHandler("onPlayerPickUpRacePickup",getRootElement(),someoneReachedHunter) --end Thanks to everyone who helps me Do you only want this to happen to ONE hunter in the game or all of them? The info you are giving is very limited. Link to comment
GanJaRuleZ Posted December 2, 2011 Author Share Posted December 2, 2011 It happens every time a player gets hunter I want it to say just one time , not hundred times.. Link to comment
unknooooown Posted December 2, 2011 Share Posted December 2, 2011 It happens every time a player gets hunterI want it to say just one time , not hundred times.. Okay. There are many ways to prevent this. The best way imo would be to: function someoneReachedHunter(number, sort, model) if sort == "vehiclechange" and model == 425 then outputChatBox ( getPlayerName(source).." #FF6464has gotten the hunter! Run!", getRootElement(), 255, 255, 255, true ) removeEventHandler("onPlayerPickUpRacePickup",getRootElement(),someoneReachedHunter) -- NOTE THIS LINE THAT REMOVES THE EVENT HANDLER! end end addEvent("onPlayerPickUpRacePickup",true) addEventHandler("onPlayerPickUpRacePickup",getRootElement(),someoneReachedHunter) To make sure the eventHandler exists again for the next race, you could do. This would add the event everytime the resource / race is started. function enableHunterPickup() addEventHandler("onPlayerPickUpRacePickup",getRootElement(),someoneReachedHunter) end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), enableHunterPickup) Telll me if you want another example. Oh yeah.. Another thing. You dont have to use ' getRootElement() ', ' root ' works just the same. 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