Jump to content

Problem With Gui Bottons


AHSS

Recommended Posts

Posted

i made a simple window and a simple botton the problem is that the bottong function happens when i press anywhere in the window(parent)

code

  
local guiadminwindow 
local SlapB 
  
function AdminPanel(key, keyState) 
    guiadminwindow = guiCreateWindow(336,76,824,721,"Admin Panel",false) 
    guiadminlabel = guiCreateLabel(424,28,344,60,"Admin Commands",false,guiadminwindow) 
    SlapB = guiCreateButton(433,98,91,20,"Slap",false,guiadminwindow) 
    addEventHandler("onClientGUIClick", SlapB, Slap) 
end 
  
  

i binded it in a key and when i click on the botton or anywhere on the windo(botton parent) it makes the same function

why?? please help

Posted
local guiadminwindow 
local SlapB 
  
function AdminPanel(key, keyState) 
    guiadminwindow = guiCreateWindow(336,76,824,721,"Admin Panel",false) 
    guiadminlabel = guiCreateLabel(424,28,344,60,"Admin Commands",false,guiadminwindow) 
    SlapB = guiCreateButton(433,98,91,20,"Slap",false,guiadminwindow) 
    addEventHandler("onClientGUIClick", SlapB, Slap, false) 
end 

Posted

it worked ty

i got another problem

i made this script:

  
local guiRandomMSG 
  
local gResRoot = getResourceRootElement(getThisResource()) 
  
function createrandomgui() 
    local sx, sy = guiGetScreenSize() 
    guiRandomMSG = guiCreateWindow((2/1440) * sx,(880/900) * sy,(1437/1440) * sx,(48/900) * sy,"",false) 
end 
addEventHandler("onClientPlayerJoin", getRootElement(), createrandomgui) 
  

but it doesnt work

i tried the same script with a command handler it worked but didnt work like that

whats is the problem?

Posted
local guiRandomMSG 
  
local gResRoot = getResourceRootElement(getThisResource()) 
  
function createrandomgui() 
    local sx, sy = guiGetScreenSize() 
    guiRandomMSG = guiCreateWindow((2/1440) * sx,(880/900) * sy,(1437/1440) * sx,(48/900) * sy,"",false) 
end 
addEventHandler("onClientResourceStart", gResRoot, createrandomgui) 

onClientPlayerJoin is triggered for any player BUT the player who just joined (THE CLIENT)

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