CRX Posted July 2, 2011 Share Posted July 2, 2011 Hi, I have script "Hunter Alert". When anyone gets a Hunter should appear msg "blabla gets a Hunter!" and should appear image "Hunter has been reached". Script: local image function hunterAlert(mapInfo, pickupID, pickupType, vehicleModel) info = mapInfo.modename if info == "Destruction derby" then if pickupType == "vehiclechange" then if vehicleModel == 425 then outputChatBox('[HUNTER] '..getPlayerName(source)..' has reached a Hunter!',getRootElement(),255,0,0) image = guiCreateStaticImage( 0.2, 0.1, 0.5, 0.1, "hunter.png", true ) guiSetVisible(image, false) end end end end function HNEnd() setTimer(guiSetVisible, 2000, 1, image, false) guiSetVisible(image, true) end addEventHandler("playHunter", getLocalPlayer(), HNEnd) addEventHandler("onPlayerPickUpRacePickup",getRootElement(),hunterAlert) Link to comment
CRX Posted July 2, 2011 Author Share Posted July 2, 2011 Msg and picture not displayed. Link to comment
bandi94 Posted July 2, 2011 Share Posted July 2, 2011 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) i never worked whit image .... Link to comment
CRX Posted July 2, 2011 Author Share Posted July 2, 2011 Heh thanks, but I need version with image (msg too). ;D Link to comment
#Paper Posted July 2, 2011 Share Posted July 2, 2011 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) image = guiCreateStaticImage( 0.2, 0.1, 0.5, 0.1, "hunter.png", true ) end end addEventHandler("onPlayerPickUpRacePickup", getRootElement(), onHunter) function HNEnd() setTimer(guiSetVisible, 2000, 1, image, false) end addEventHandler("playHunter", getRootElement(), HNEnd) Put this script in Server side, idk if it works, test Link to comment
bandi94 Posted July 2, 2011 Share Posted July 2, 2011 tell me if AcitanoX's sript not work i will try to make the img (msg tool) Link to comment
#Paper Posted July 2, 2011 Share Posted July 2, 2011 tell me if AcitanoX's sript not work i will try to make the img (msg tool) in mine script there is the img part... .-. Link to comment
karlis Posted July 2, 2011 Share Posted July 2, 2011 server: addEvent("onPlayerPickUpRacePickup", true) addEventHandler("onPlayerPickUpRacePickup", getRootElement(), function(_, pickupType, vehicleModel) if pickupType == "vehiclechange" and vehicleModel == 425 then outputChatBox('[HUNTER] '..getPlayerName(source)..' has reached a Hunter!',getRootElement(),255,0,0) triggerClientEvent("playHunter",getRootElement()) end end) client: 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
JR10 Posted July 2, 2011 Share Posted July 2, 2011 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) image = guiCreateStaticImage( 0.2, 0.1, 0.5, 0.1, "hunter.png", true ) end end addEventHandler("onPlayerPickUpRacePickup", getRootElement(), onHunter) function HNEnd() setTimer(guiSetVisible, 2000, 1, image, false) end addEventHandler("playHunter", getRootElement(), HNEnd) Put this script in Server side, idk if it works, test Client side.* Link to comment
karlis Posted July 2, 2011 Share Posted July 2, 2011 most common bug out here: mixing clientside functions with serverside functions(or serverside versions of function) Link to comment
CRX Posted July 4, 2011 Author Share Posted July 4, 2011 Thanks, but when i get the hunter i see "[HUNTER] #00AADDC#FFC000RX has reached a Hunter! How to change [HUNTER] CRX (or CRX) has reached a Hunter! Link to comment
karlis Posted July 4, 2011 Share Posted July 4, 2011 outputChatBox('[HUNTER] '..getPlayerName(source)..' has reached a Hunter!',getRootElement(),255,0,0,true) 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