SnoopCat Posted July 20, 2011 Share Posted July 20, 2011 hello i have a script that when u die it plays a sound like WASTED.... well the thing i want to add to this script is an image on the screen and idk how to do it , if anyone wants to help here is the code i have function wasted (thePlayer) local sound = playSound("wasted.mp3",false) setSoundVolume(sound, 0.9) end addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), wasted ) Link to comment
Castillo Posted July 20, 2011 Share Posted July 20, 2011 Use guiCreateStaticImage or draw one with dxDrawImage. Link to comment
SnoopCat Posted July 20, 2011 Author Share Posted July 20, 2011 soo it must be like this? function wasted (thePlayer) local sound = playSound("wasted.mp3",false) setSoundVolume(sound, 0.9) end function wasted (theplayer) guiCreateStaticImage( 20, 200, 100, 100, "imagename.png", false ) end addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), wasted ) Link to comment
Castillo Posted July 20, 2011 Share Posted July 20, 2011 No, that's wrong. function wasted (thePlayer) local sound = playSound("wasted.mp3",false) setSoundVolume(sound, 0.9) image = guiCreateStaticImage( 20, 200, 100, 100, "imagename.png", false ) setTimer(destroyElement, 5000, 1, image) end addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), wasted ) Link to comment
SnoopCat Posted July 20, 2011 Author Share Posted July 20, 2011 isnt working this is the error i get [18:45:18] ERROR: wasted\sonido.lua:7: attempt to call global 'getLocalPlayer' ( a nil value) Link to comment
Castillo Posted July 20, 2011 Share Posted July 20, 2011 Your script must be set as client side in meta.xml. Link to comment
Try Posted July 21, 2011 Share Posted July 21, 2011 WTF FIRST ITS: getRootElement() not getLocalPlayer() Link to comment
Castillo Posted July 21, 2011 Share Posted July 21, 2011 No, Try, take a look at the wiki example: https://wiki.multitheftauto.com/wiki/OnC ... ayerWasted 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