maskatchi Posted August 2, 2011 Share Posted August 2, 2011 ok my script is this: addEventHandler("onClientResourceStart",resourceRoot, function() window = guiCreateWindow(15,306,121,48,"Audio Options",false) guiWindowSetSizable(window,false) on = guiCreateButton(9,24,40,15,"on",false,window) addEventHandler ( "onClientGUIClick", on, startSound, false ) off = guiCreateButton(64,25,40,14,"off",false,window) addEventHandler ( "onClientGUIClick", off, lol, false ) end ) function startSound() if not isElement(sound) then -- if our sound is not existing we can create one sound = playSound("sounds/pjanoo.mp3", false) setSoundVolume(sound, 1.0) -- i think this is default volume.. do we really need it? end end function lol() if isElement(sound) then -- if our sound is existing - we will stop it stopSound(sound) end end what it does is creates a GUI window with two buttons to turn it on and off... What i want it to do is i am going to create a col shape then when a player hits it the GUI window will pop up... but i'm not sure how i know i gotta create the col shape and do the command onColShapeHit but after that what do i do exactly? Do i onColShapeHit createGuiWindow or something like that? i'm really confused Link to comment
Castillo Posted August 2, 2011 Share Posted August 2, 2011 First, you'll need to create a colshape: https://wiki.multitheftauto.com/wiki/Cli ... _functions And second, you'll need the event handler: addEventHandler("onClientResourceStart",resourceRoot, function() window = guiCreateWindow(15,306,121,48,"Audio Options",false) guiWindowSetSizable(window,false) guiSetVisible(window, false) on = guiCreateButton(9,24,40,15,"on",false,window) addEventHandler ( "onClientGUIClick", on, startSound, false ) off = guiCreateButton(64,25,40,14,"off",false,window) addEventHandler ( "onClientGUIClick", off, lol, false ) end ) function startSound() if not isElement(sound) then -- if our sound is not existing we can create one sound = playSound("sounds/pjanoo.mp3", false) setSoundVolume(sound, 1.0) -- i think this is default volume.. do we really need it? end end function lol() if isElement(sound) then -- if our sound is existing - we will stop it stopSound(sound) end end addEventHandler( "onClientElementColShapeHit", myColShape, function ( ) if ( getElementType( source ) == "player" ) and ( source == getLocalPlayer( ) ) then guiSetVisible(window, true) showCursor(true) end end ); Link to comment
MTA Team qaisjp Posted August 2, 2011 MTA Team Share Posted August 2, 2011 Use marker instead, I think that would be better. Link to comment
Castillo Posted August 2, 2011 Share Posted August 2, 2011 Yeah, but he'll have to set his alpha, I think collision shapes are better in this case . Link to comment
MTA Team qaisjp Posted August 3, 2011 MTA Team Share Posted August 3, 2011 Hm... yeah. 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