Jump to content

Hunter alert script help


Zin

Recommended Posts

Hey i put together this hunter alert script but the img does not show it might be to do with my META or my other stuff.

Meta :

<meta> 
  <info author="Zin" name="HunterReached" version="2.0.1" type="script" /> 
  <script src="HunterWarn_server.lua" type="server"/> 
  <script src="HunterWarn_client.lua" type="client"/> 
<file src="hunter.png" /> 
</meta> 
  

Server side :

    addEvent("onPlayerPickUpRacePickup", true) 
    function onHunter(pickupID, pickupType, vehicleModel) 
        if pickupType == "vehiclechange" and vehicleModel == 425 then 
            outputChatBox('[HUNTER] '..getPlayerName(source)..' has reached a Hunter!',getRootElement(),255,0,0) 
        end 
    end 
    addEventHandler("onPlayerPickUpRacePickup", getRootElement(), onHunter) 
      
    function HNEnd() 
        setTimer(guiSetVisible, 2000, 1, image, false) 
    end 
    addEventHandler("playHunter", getRootElement(), HNEnd) 

client side :

local image = guiCreateStaticImage( 0.2, 0.1, 0.5, 0.1, "hunter.png", true ) 
guiSetVisible(image,false) 
function HNEnd() 
    guiSetVisible(image,true) 
    setTimer(guiSetVisible, 2000, 1, image, false) 
end 
addEvent("playHunter",true) 
addEventHandler("playHunter", getRootElement(), HNEnd) 
  
  

Link to comment

I added a call to the server side to go to the client side but i got an error saying

"failed to call 'HunterWarn:HunterWarn_client'

Server side :

    addEvent("onPlayerPickUpRacePickup", true) 
        function onHunter(pickupID, pickupType, vehicleModel) 
            if pickupType == "vehiclechange" and vehicleModel == 425 then 
                outputChatBox(''..getPlayerName(source)..' has reached the Hunter!',getRootElement(),255,0,0) 
call ( getResourceFromName ( "HunterWarn" ), "HunterWarn_client") 
            end 
        end 
        addEventHandler("onPlayerPickUpRacePickup", getRootElement(), onHunter) 
          
        function HNEnd() 
            setTimer(guiSetVisible, 2000, 1, image, false) 
        end 
        addEventHandler("playHunter", getRootElement(), HNEnd) 

Link to comment
Hey i put together this hunter alert script but the img does not show it might be to do with my META or my other stuff.

Meta :

<meta> 
  <info author="Zin" name="HunterReached" version="2.0.1" type="script" /> 
  <script src="HunterWarn_server.lua" type="server"/> 
  <script src="HunterWarn_client.lua" type="client"/> 
<file src="hunter.png" /> 
</meta> 
  

Server side :

 addEvent("onPlayerPickUpRacePickup", true) 
    function onHunter(pickupID, pickupType, vehicleModel) 
        if pickupType == "vehiclechange" and vehicleModel == 425 then 
            outputChatBox('[HUNTER] '..getPlayerName(source)..' has reached a Hunter!',getRootElement(),255,0,0) 
            triggerClientEvent("playHunter",root,HNEnd) 
        end 
    end 
    addEventHandler("onPlayerPickUpRacePickup", getRootElement(), onHunter) 
  

client side :

 

local image = guiCreateStaticImage( 0.2, 0.1, 0.5, 0.1, "hunter.png", true ) 
guiSetVisible(image,false) 
function HNEnd() 
    guiSetVisible(image,true) 
    setTimer(guiSetVisible, 2000, 1, image, false) 
end 
addEvent("playHunter",true) 
addEventHandler("playHunter", getRootElement(), HNEnd) 

Link to comment

Thanks man i learned quite a bit from that so i tried to add a sound function but i failed any tips here?

client side

function HNEnd() 
local sound = playSound("hunter.mp3") 
    setSoundVolume(sound, 0.
    end 
    addEvent("playHunter",true) 
    addEventHandler("playHunter", getRootElement(), HNEnd) 

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