Jump to content

help pls :S


maskatchi

Recommended Posts

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 :S 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 :shock:

Link to comment

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

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