Jump to content

a onClientGUIClick for DxText ?


iFoReX

Recommended Posts

how I can use onClientGUIClick for dxText ?

--------------------------- 
---RadioByElMota----------- 
  
addEventHandler("onClientRender",root, 
    function() 
        dxDrawText("Estacion Bachata 1",785.0,317.0,910.0,353.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) 
        dxDrawText("Radios Bachata",780.0,272.0,909.0,311.0,tocolor(255,255,255,255),1.5,"default-bold","left","top",false,false,false) 
        dxDrawText("Estacion Electronica 1",785.0,234.0,910.0,270.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) 
        dxDrawText("Radios Electronicas",780.0,197.0,909.0,236.0,tocolor(255,255,255,255),1.5,"default-bold","left","top",false,false,false) 
        dxDrawText("Estacion En Ingles 1",785.0,166.0,910.0,202.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) 
        dxDrawText("Radios En Ingles",780.0,127.0,909.0,166.0,tocolor(255,255,255,255),1.5,"default-bold","left","top",false,false,false) 
        dxDrawText("Estacion Rap 1",782.0,101.0,970.0,143.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) 
        dxDrawText("Radios Rap",780.0,62.0,954.0,101.0,tocolor(255,255,255,255),1.5,"sans","left","top",false,false,false) 
        dxDrawText("Radio DX By ElMota",779.0,18.0,1014.0,53.0,tocolor(255,255,255,255),1.0,"pricedown","left","top",false,false,false) 
        dxDrawRectangle(762.0,0.0,261.0,767.0,tocolor(0,0,0,80),false) 
    end 
) 

:P thank in advanced

Link to comment

now when I press a Radio appear 2 text :c :c

--------------------------- 
---RadioByElMota----------- 
  
Radio = {} 
Estacion = {} 
  
    function dxRadio() 
    Radio[1] = dxDrawText("Radios Bachata",780.0,272.0,909.0,311.0,tocolor(255,255,255,255),1.5,"default-bold","left","top",false,false,false) 
    Radio[2] = dxDrawText("Radios Electronicas",780.0,197.0,909.0,236.0,tocolor(255,255,255,255),1.5,"default-bold","left","top",false,false,false) 
    Estacion[3] = dxDrawText("Estacion En Ingles 1",785.0,166.0,910.0,202.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) 
    Radio[3] = dxDrawText("Radios En Ingles",780.0,127.0,909.0,166.0,tocolor(255,255,255,255),1.5,"default-bold","left","top",false,false,false) 
    Estacion[4] = dxDrawText("Estacion Rap 1",782.0,101.0,970.0,143.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) 
    Radio[4] = dxDrawText("Radios Rap",780.0,62.0,954.0,101.0,tocolor(255,255,255,255),1.5,"sans","left","top",false,false,false) 
        dxDrawText("Radio DX By ElMota",779.0,18.0,1014.0,53.0,tocolor(255,255,255,255),1.0,"pricedown","left","top",false,false,false) 
        dxDrawRectangle(762.0,0.0,261.0,767.0,tocolor(0,0,0,80),false) 
    showCursor(true) 
    end 
  
  
addEventHandler("onClientClick", root,  
function( absoluteX, absoluteY, worldX, worldY, worldZ ) 
if Radio[1] then 
addEventHandler("onClientRender", root, RBachata) 
removeEventHandler("onClientRender", root, RElectro) 
end 
end 
) 
  
addEventHandler("onClientClick", Radio[2],  
function( absoluteX, absoluteY, worldX, worldY, worldZ ) 
addEventHandler("onClientRender", root, RElectro) 
removeEventHandler("onClientRender", root, RBachata) 
end, false) 
  
  
function RBachata() 
    Estacion[1] = dxDrawText("Estacion Bachata 1",785.0,317.0,910.0,353.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) 
end 
  
function RElectro() 
    Estacion[2] = dxDrawText("Estacion Electronica 1",785.0,234.0,910.0,270.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) 
end 
  
function dxOpen() 
addEventHandler("onClientRender",root, dxRadio) 
if addEventHandler("onClientRender",root, dxRadio) then 
removeEventHandler("onClientRender",root, dxRadio) 
end 
end 
addCommandHandler("radio", dxOpen) 

?

Link to comment

Ok :D I done it :

--------------------------- 
---RadioByElMota----------- 
  
Radio = {} 
RadioB = {} 
Estacion = {} 
EstacionB = {} 
  
-------------------------- 
---ButtonsR---------------- 
RadioB[1] = guiCreateButton(780.0,272.0,200.0,30.0,"Radios Bachata",false) 
guiSetVisible(RadioB[1],false) 
guiSetAlpha(RadioB[1],0) 
RadioB[2] = guiCreateButton(780.0,197.0,200.0,30.0,"RadiosElectro",false) 
guiSetVisible(RadioB[2],false) 
guiSetAlpha(RadioB[2],0) 
RadioB[3] = guiCreateButton(780.0,127.0,200.0,30.0,"RadiosIngles",false) 
guiSetVisible(RadioB[3],false) 
guiSetAlpha(RadioB[3],0) 
RadioB[4] = guiCreateButton(780.0,62.0,200.0,30.0,"Rap",false) 
guiSetVisible(RadioB[4],false) 
guiSetAlpha(RadioB[4],0) 
CancelButton = guiCreateButton(765.0,420.0,200.0,30.0,"Cancelar",false) 
guiSetVisible(CancelButton,false) 
guiSetAlpha(CancelButton,0) 
stopMusicB = guiCreateButton(765.0,474.0,200.0,30.0,"stopTheMusic",false) 
guiSetVisible(stopMusicB,false) 
guiSetAlpha(stopMusicB,0) 
--------------------------- 
------ButtonsE------------- 
EstacionB[1] = guiCreateButton(785.0,317.0,200.0,30.0,"Bachata",false) 
guiSetVisible(EstacionB[1],false) 
guiSetAlpha(EstacionB[1],0) 
-------------------------- 
    function dxRadio() 
    Radio[1] = dxDrawText("Radios Bachata",780.0,272.0,909.0,311.0,tocolor(255,255,255,255),1.5,"default-bold","left","top",false,false,true) 
    Radio[2] = dxDrawText("Radios Electronicas",780.0,197.0,909.0,236.0,tocolor(255,255,255,255),1.5,"default-bold","left","top",false,false,true) 
    Radio[3] = dxDrawText("Radios En Ingles",780.0,127.0,909.0,166.0,tocolor(255,255,255,255),1.5,"default-bold","left","top",false,false,true) 
    Radio[4] = dxDrawText("Radios Rap",780.0,62.0,954.0,101.0,tocolor(255,255,255,255),1.5,"sans","left","top",false,false,true) 
        dxDrawText("Radio DX By ElMota",779.0,18.0,1014.0,53.0,tocolor(255,255,255,255),1.0,"pricedown","left","top",false,false,false) 
        dxDrawRectangle(762.0,0.0,261.0,767.0,tocolor(0,0,0,80),false) 
    stopMusicT = dxDrawText("Detener Musica",765.0,474.0,869.0,501.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
    CancelText = dxDrawText("Cancelar",765.0,420.0,869.0,447.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
    showCursor(true) 
    end 
  
  
addEventHandler("onClientGUIClick", root,  
function() 
if source == RadioB[1] then 
addEventHandler("onClientRender", root, RBachata) 
guiSetVisible(EstacionB[1],true) 
elseif source == RadioB[2] then 
addEventHandler("onClientRender", root, RElectro) 
elseif source == RadioB[3] then 
addEventHandler("onClientRender", root, RIngles) 
elseif source == RadioB[4] then 
addEventHandler("onClientRender", root, RRap) 
elseif source == CancelButton then 
removeEventHandler("onClientRender", root, dxRadio) 
removeEventHandler("onClientRender", root, RBachata) 
removeEventHandler("onClientRender", root, RElectro) 
removeEventHandler("onClientRender", root, RIngles) 
removeEventHandler("onClientRender", root, RRap) 
showCursor(false) 
elseif source == EstacionB[1] then 
local sound = playSound("http://yp.shoutcast.com/sbin/tunein-station.pls?id=200145") 
elseif source == stopMusicB then 
if isElement(sound) then 
destroyElement(sound) 
end 
end 
end 
) 
  
--------------------- 
---TheStations------- 
  
function RBachata() 
    Estacion[1] = dxDrawText("Estacion Bachata 1",785.0,317.0,910.0,353.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) 
end 
  
function RElectro() 
    Estacion[2] = dxDrawText("Estacion Electronica 1",785.0,234.0,910.0,270.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) 
end 
  
function RIngles() 
    Estacion[3] = dxDrawText("Estacion En Ingles 1",785.0,166.0,910.0,202.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) 
end 
  
function RRap() 
    Estacion[4] = dxDrawText("Estacion Rap 1",782.0,101.0,970.0,143.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) 
end 
  
function dxOpen() 
addEventHandler("onClientRender",root, dxRadio) 
guiSetVisible(RadioB[1],true) 
guiSetVisible(RadioB[2],true) 
guiSetVisible(RadioB[3],true) 
guiSetVisible(RadioB[4],true) 
guiSetVisible(CancelButton,true) 
guiSetVisible(stopMusicB,true) 
end 
addCommandHandler("radio", dxOpen) 

but the music doesnt stop :c

Link to comment
--------------------------- 
---RadioByElMota----------- 
  
Radio = {} 
RadioB = {} 
Estacion = {} 
EstacionB = {} 
  
-------------------------- 
---ButtonsR---------------- 
RadioB[1] = guiCreateButton(780.0,272.0,200.0,30.0,"Radios Bachata",false) 
guiSetVisible(RadioB[1],false) 
guiSetAlpha(RadioB[1],0) 
RadioB[2] = guiCreateButton(780.0,197.0,200.0,30.0,"RadiosElectro",false) 
guiSetVisible(RadioB[2],false) 
guiSetAlpha(RadioB[2],0) 
RadioB[3] = guiCreateButton(780.0,127.0,200.0,30.0,"RadiosIngles",false) 
guiSetVisible(RadioB[3],false) 
guiSetAlpha(RadioB[3],0) 
RadioB[4] = guiCreateButton(780.0,62.0,200.0,30.0,"Rap",false) 
guiSetVisible(RadioB[4],false) 
guiSetAlpha(RadioB[4],0) 
CancelButton = guiCreateButton(765.0,420.0,200.0,30.0,"Cancelar",false) 
guiSetVisible(CancelButton,false) 
guiSetAlpha(CancelButton,0) 
stopMusicB = guiCreateButton(765.0,474.0,200.0,30.0,"stopTheMusic",false) 
guiSetVisible(stopMusicB,false) 
guiSetAlpha(stopMusicB,0) 
--------------------------- 
------ButtonsE------------- 
EstacionB[1] = guiCreateButton(785.0,317.0,200.0,30.0,"Bachata",false) 
guiSetVisible(EstacionB[1],false) 
guiSetAlpha(EstacionB[1],0) 
-------------------------- 
    function dxRadio() 
    Radio[1] = dxDrawText("Radios Bachata",780.0,272.0,909.0,311.0,tocolor(255,255,255,255),1.5,"default-bold","left","top",false,false,true) 
    Radio[2] = dxDrawText("Radios Electronicas",780.0,197.0,909.0,236.0,tocolor(255,255,255,255),1.5,"default-bold","left","top",false,false,true) 
    Radio[3] = dxDrawText("Radios En Ingles",780.0,127.0,909.0,166.0,tocolor(255,255,255,255),1.5,"default-bold","left","top",false,false,true) 
    Radio[4] = dxDrawText("Radios Rap",780.0,62.0,954.0,101.0,tocolor(255,255,255,255),1.5,"sans","left","top",false,false,true) 
        dxDrawText("Radio DX By ElMota",779.0,18.0,1014.0,53.0,tocolor(255,255,255,255),1.0,"pricedown","left","top",false,false,false) 
        dxDrawRectangle(762.0,0.0,261.0,767.0,tocolor(0,0,0,80),false) 
    stopMusicT = dxDrawText("Detener Musica",765.0,474.0,869.0,501.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
    CancelText = dxDrawText("Cancelar",765.0,420.0,869.0,447.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
    showCursor(true) 
    end 
  
  
addEventHandler("onClientGUIClick", root,  
function() 
if source == RadioB[1] then 
addEventHandler("onClientRender", root, RBachata) 
guiSetVisible(EstacionB[1],true) 
elseif source == RadioB[2] then 
addEventHandler("onClientRender", root, RElectro) 
elseif source == RadioB[3] then 
addEventHandler("onClientRender", root, RIngles) 
elseif source == RadioB[4] then 
addEventHandler("onClientRender", root, RRap) 
elseif source == CancelButton then 
removeEventHandler("onClientRender", root, dxRadio) 
removeEventHandler("onClientRender", root, RBachata) 
removeEventHandler("onClientRender", root, RElectro) 
removeEventHandler("onClientRender", root, RIngles) 
removeEventHandler("onClientRender", root, RRap) 
showCursor(false) 
elseif source == EstacionB[1] then 
sound = playSound("http://yp.shoutcast.com/sbin/tunein-station.pls?id=200145") 
elseif source == stopMusicB then 
stsound = stopSound (sound) 
end 
end 
end 
) 
  
--------------------- 
---TheStations------- 
  
function RBachata() 
    Estacion[1] = dxDrawText("Estacion Bachata 1",785.0,317.0,910.0,353.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) 
end 
  
function RElectro() 
    Estacion[2] = dxDrawText("Estacion Electronica 1",785.0,234.0,910.0,270.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) 
end 
  
function RIngles() 
    Estacion[3] = dxDrawText("Estacion En Ingles 1",785.0,166.0,910.0,202.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) 
end 
  
function RRap() 
    Estacion[4] = dxDrawText("Estacion Rap 1",782.0,101.0,970.0,143.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) 
end 
  
function dxOpen() 
addEventHandler("onClientRender",root, dxRadio) 
guiSetVisible(RadioB[1],true) 
guiSetVisible(RadioB[2],true) 
guiSetVisible(RadioB[3],true) 
guiSetVisible(RadioB[4],true) 
guiSetVisible(CancelButton,true) 
guiSetVisible(stopMusicB,true) 
end 
addCommandHandler("radio", dxOpen) 

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