Jump to content

chat block when gui is open


Monty

Recommended Posts

is it possible to block the chat (main and team) when this gui is open?

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
GUIEditor_Window[1] = guiCreateWindow(255,131,359,185,"Play Sound From URL",false) 
guiSetVisible(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
URLE = guiCreateEdit(16,72,328,38,"",false,GUIEditor_Window[1]) 
GUIEditor_Label[1] = guiCreateLabel(21,44,75,18,"Sound URL :",false,GUIEditor_Window[1]) 
GUIEditor_Label[2] = guiCreateLabel(11,116,330,20,"*  File Extensions :  mp3 , wav, ogg, riff , mod, xm, it , s3m",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[2],255,0,0) 
PlayStop = guiCreateButton(204,140,127,36,"Play",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[4],255,0,0) 
GUIEditor_Label[5] = guiCreateLabel(97,25,47,16,"Speed :",false,GUIEditor_Window[1]) 
sup = guiCreateButton(161,24,27,23,"+",false,GUIEditor_Window[1]) 
sdown = guiCreateButton(189,24,27,23,"-",false,GUIEditor_Window[1]) 
sn = guiCreateLabel(144,26,16,18,"0",false,GUIEditor_Window[1]) 
guiLabelSetColor(sn,0,255,0) 
GUIEditor_Label[7] = guiCreateLabel(220,26,50,18,"Volume :",false,GUIEditor_Window[1]) 
sv = guiCreateLabel(272,28,18,21,"0",false,GUIEditor_Window[1]) 
guiLabelSetColor(sv,255,255,0) 
vup = guiCreateButton(292,24,27,23,"+",false,GUIEditor_Window[1]) 
vdown = guiCreateButton(322,24,26,23,"-",false,GUIEditor_Window[1]) 
--[[ 
local volume = true 
local speed = true 
--]] 
local sound = true 
function onGuiClick (button, state, absoluteX, absoluteY) 
  
    if (source == PlayStop) then 
    if sound == true then 
    local URL = guiGetText ( URLE ) 
  
         sp = playSound(URL) 
         outputChatBox ( "Sound loading maybe take time ...", getLocalPlayer(), 255, 0, 0, true ) 
         outputChatBox ( "Sound starting !", getLocalPlayer, 255, 0, 0, true ) 
  
guiSetText(PlayStop,"Stop") 
sound = false 
else 
        stopSound(sp) 
guiSetText(PlayStop,"Play") 
outputChatBox ( "Sound stopped !", getLocalPlayer(), 255, 0, 0, true ) 
guiSetText(sn,"1") 
guiSetText(sv,"1") 
sound = true 
  
end 
end 
end 
  
  
addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) 
  
  
function GuiClick (button, state, absoluteX, absoluteY) 
if (source == sup) then 
local ss = getSoundSpeed(sp)+1 
  
while not setSoundSpeed ( sp, ss ) do ss = ss + 1 end 
guiSetText(sn,""..ss.."") 
elseif (source == sdown) then 
  
local ss = getSoundSpeed(sp)-1 
while not setSoundSpeed ( sp, ss ) do ss = ss - 1 end 
guiSetText(sn,""..ss.."") 
elseif (source == vup) then 
  
local svol = getSoundVolume(sp)+1 
while not setSoundVolume ( sp, svol ) do svol = svol + 1 end 
guiSetText(sv,""..svol.."") 
  
elseif (source == vdown) then 
  
local svol = getSoundVolume(sp)-1 
  
 while not setSoundVolume ( sp, svol ) do svol = svol -1 
end 
  
 guiSetText(sv,""..svol.."") 
end 
end 
addEventHandler ("onClientGUIClick", getRootElement(), GuiClick) 
  
  
function show() 
    if guiGetVisible(GUIEditor_Window[1]) == true then 
        guiSetVisible(GUIEditor_Window[1],false) 
        showCursor(false) 
    else 
        guiSetVisible(GUIEditor_Window[1],true) 
        showCursor(true) 
    end 
end 
addCommandHandler("su",show) 
  

Link to comment
guiSetInputMode ("no_binds") 

T, Y and any other binds will be disabled when the GUI is open.

guiSetInputMode ("no_binds_when_editing") 

T, Y and any other binds will be disbled when you are editing a field in the GUI.

Link to comment

what's wrong?

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
  
function guiMyCwindow(w,h,t) 
      local x,y = guiGetScreenSize() 
      return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) 
    end 
GUIEditor_Window[1] = guiMyCwindow(359,185,"Play Sound From URL") 
guiSetVisible(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
URLE = guiCreateEdit(16,72,328,38,"",false,GUIEditor_Window[1]) 
GUIEditor_Label[1] = guiCreateLabel(21,44,75,18,"Sound URL :",false,GUIEditor_Window[1]) 
GUIEditor_Label[2] = guiCreateLabel(11,116,330,20,"*  File Extensions :  mp3 , wav, ogg, riff , mod, xm, it , s3m",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[2],255,0,0) 
PlayStop = guiCreateButton(204,140,127,36,"Play",false,GUIEditor_Window[1]) 
GUIEditor_Label[3] = guiCreateLabel(11,159,25,15,"By :",false,GUIEditor_Window[1]) 
GUIEditor_Label[4] = guiCreateLabel(37,160,101,18,"|S.s|SoRa",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[4],255,0,0) 
GUIEditor_Label[5] = guiCreateLabel(97,25,47,16,"Speed :",false,GUIEditor_Window[1]) 
sup = guiCreateButton(161,24,27,23,"+",false,GUIEditor_Window[1]) 
sdown = guiCreateButton(189,24,27,23,"-",false,GUIEditor_Window[1]) 
sn = guiCreateLabel(144,26,16,18,"0",false,GUIEditor_Window[1]) 
guiLabelSetColor(sn,0,255,0) 
GUIEditor_Label[7] = guiCreateLabel(220,26,50,18,"Volume :",false,GUIEditor_Window[1]) 
sv = guiCreateLabel(272,28,18,21,"0",false,GUIEditor_Window[1]) 
guiLabelSetColor(sv,255,255,0) 
vup = guiCreateButton(292,24,27,23,"+",false,GUIEditor_Window[1]) 
vdown = guiCreateButton(322,24,26,23,"-",false,GUIEditor_Window[1]) 
--[[ 
local volume = true 
local speed = true 
--]] 
local sound = true 
function onGuiClick (button, state, absoluteX, absoluteY) 
  
    if (source == PlayStop) then 
    if sound == true then 
    local URL = guiGetText ( URLE ) 
  
         sp = playSound(URL) 
         outputChatBox ( "Sound loading maybe take time ...", getLocalPlayer(), 255, 0, 0, true ) 
         outputChatBox ( "Sound starting !", getLocalPlayer, 255, 0, 0, true ) 
  
guiSetText(PlayStop,"Stop") 
sound = false 
else 
        stopSound(sp) 
guiSetText(PlayStop,"Play") 
outputChatBox ( "Sound stopped !", getLocalPlayer(), 255, 0, 0, true ) 
guiSetText(sn,"1") 
guiSetText(sv,"1") 
sound = true 
  
end 
end 
end 
  
  
addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) 
  
  
function GuiClick (button, state, absoluteX, absoluteY) 
if (source == sup) then 
local ss = getSoundSpeed(sp)+1 
  
while not setSoundSpeed ( sp, ss ) do ss = ss + 1 end 
guiSetText(sn,""..ss.."") 
elseif (source == sdown) then 
  
local ss = getSoundSpeed(sp)-1 
while not setSoundSpeed ( sp, ss ) do ss = ss - 1 end 
guiSetText(sn,""..ss.."") 
elseif (source == vup) then 
  
local svol = getSoundVolume(sp)+1 
while not setSoundVolume ( sp, svol ) do svol = svol + 1 end 
guiSetText(sv,""..svol.."") 
  
elseif (source == vdown) then 
  
local svol = getSoundVolume(sp)-1 
  
 while not setSoundVolume ( sp, svol ) do svol = svol -1 
end 
  
 guiSetText(sv,""..svol.."") 
end 
end 
addEventHandler ("onClientGUIClick", getRootElement(), GuiClick) 
  
  
function show() 
    if guiGetVisible(GUIEditor_Window[1]) == true then 
        guiSetVisible(GUIEditor_Window[1],false) 
        showCursor(false) 
    else 
        guiSetVisible(GUIEditor_Window[1],true) 
        showCursor(true) 
    end 
end 
addCommandHandler("su",show) 
  

Link to comment

You haven't add the function, you posted the same code as before.

It should be like:

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
  
function guiMyCwindow(w,h,t) 
      local x,y = guiGetScreenSize() 
      return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) 
    end 
GUIEditor_Window[1] = guiMyCwindow(359,185,"Play Sound From URL") 
guiSetVisible(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
URLE = guiCreateEdit(16,72,328,38,"",false,GUIEditor_Window[1]) 
GUIEditor_Label[1] = guiCreateLabel(21,44,75,18,"Sound URL :",false,GUIEditor_Window[1]) 
GUIEditor_Label[2] = guiCreateLabel(11,116,330,20,"*  File Extensions :  mp3 , wav, ogg, riff , mod, xm, it , s3m",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[2],255,0,0) 
PlayStop = guiCreateButton(204,140,127,36,"Play",false,GUIEditor_Window[1]) 
GUIEditor_Label[3] = guiCreateLabel(11,159,25,15,"By :",false,GUIEditor_Window[1]) 
GUIEditor_Label[4] = guiCreateLabel(37,160,101,18,"|S.s|SoRa",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[4],255,0,0) 
GUIEditor_Label[5] = guiCreateLabel(97,25,47,16,"Speed :",false,GUIEditor_Window[1]) 
sup = guiCreateButton(161,24,27,23,"+",false,GUIEditor_Window[1]) 
sdown = guiCreateButton(189,24,27,23,"-",false,GUIEditor_Window[1]) 
sn = guiCreateLabel(144,26,16,18,"0",false,GUIEditor_Window[1]) 
guiLabelSetColor(sn,0,255,0) 
GUIEditor_Label[7] = guiCreateLabel(220,26,50,18,"Volume :",false,GUIEditor_Window[1]) 
sv = guiCreateLabel(272,28,18,21,"0",false,GUIEditor_Window[1]) 
guiLabelSetColor(sv,255,255,0) 
vup = guiCreateButton(292,24,27,23,"+",false,GUIEditor_Window[1]) 
vdown = guiCreateButton(322,24,26,23,"-",false,GUIEditor_Window[1]) 
guiSetInputMode ("no_binds_when_editing") 
--[[ 
local volume = true 
local speed = true 
--]] 
local sound = true 
function onGuiClick (button, state, absoluteX, absoluteY) 
  
    if (source == PlayStop) then 
    if sound == true then 
    local URL = guiGetText ( URLE ) 
  
         sp = playSound(URL) 
         outputChatBox ( "Sound loading maybe take time ...", getLocalPlayer(), 255, 0, 0, true ) 
         outputChatBox ( "Sound starting !", getLocalPlayer, 255, 0, 0, true ) 
  
guiSetText(PlayStop,"Stop") 
sound = false 
else 
        stopSound(sp) 
guiSetText(PlayStop,"Play") 
outputChatBox ( "Sound stopped !", getLocalPlayer(), 255, 0, 0, true ) 
guiSetText(sn,"1") 
guiSetText(sv,"1") 
sound = true 
  
end 
end 
end 
  
  
addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) 
  
  
function GuiClick (button, state, absoluteX, absoluteY) 
if (source == sup) then 
local ss = getSoundSpeed(sp)+1 
  
while not setSoundSpeed ( sp, ss ) do ss = ss + 1 end 
guiSetText(sn,""..ss.."") 
elseif (source == sdown) then 
  
local ss = getSoundSpeed(sp)-1 
while not setSoundSpeed ( sp, ss ) do ss = ss - 1 end 
guiSetText(sn,""..ss.."") 
elseif (source == vup) then 
  
local svol = getSoundVolume(sp)+1 
while not setSoundVolume ( sp, svol ) do svol = svol + 1 end 
guiSetText(sv,""..svol.."") 
  
elseif (source == vdown) then 
  
local svol = getSoundVolume(sp)-1 
  
 while not setSoundVolume ( sp, svol ) do svol = svol -1 
end 
  
 guiSetText(sv,""..svol.."") 
end 
end 
addEventHandler ("onClientGUIClick", getRootElement(), GuiClick) 
  
  
function show() 
    if guiGetVisible(GUIEditor_Window[1]) == true then 
        guiSetVisible(GUIEditor_Window[1],false) 
        showCursor(false) 
    else 
        guiSetVisible(GUIEditor_Window[1],true) 
        showCursor(true) 
    end 
end 
addCommandHandler("su",show) 
  

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