Jump to content

Hunter Reach Problem...


GanJaRuleZ

Recommended Posts

Posted

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 :)

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

Posted
It happens every time a player gets hunter

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

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