Zin Posted October 13, 2014 Share Posted October 13, 2014 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
tosfera Posted October 13, 2014 Share Posted October 13, 2014 You aren't doing any call to the client side to show the image. After the outputChatBox() add a call to the clientside to show the image. Link to comment
Zin Posted October 14, 2014 Author Share Posted October 14, 2014 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
ZL|LuCaS Posted October 14, 2014 Share Posted October 14, 2014 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
Zin Posted October 16, 2014 Author Share Posted October 16, 2014 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
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