Jump to content

support chat window problem


Recommended Posts

client side

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
GUIEditor_Window[1] = guiCreateWindow(313,364,552,165,"support",false) 
guiSetAlpha(GUIEditor_Window[1],1) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Edit[1] = guiCreateEdit(22,60,443,29,"t",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(472,60,69,30,"Send",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[1],"default-bold-small") 
GUIEditor_Label[1] = guiCreateLabel(24,23,511,27,"Support window",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[1],255,0,0) 
guiSetFont(GUIEditor_Label[1],"default-bold-small") 
GUIEditor_Button[2] = guiCreateButton(144,137,230,19,"ignore this button",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[2],"default-bold-small") 
GUIEditor_Button[3] = guiCreateButton(459,136,84,20,"exit",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[3],"default-bold-small") 
guiSetVisible(GUIEditor_Window[1], false) 
  
  
    function showWindow() 
    if ( guiGetVisible ( GUIEditor_Window[1] ) == true ) then 
     guiSetVisible ( GUIEditor_Window[1] ,false ) 
     showCursor (false ) 
     guiSetInputEnabled(false) 
      
    elseif ( guiGetVisible ( GUIEditor_Window[1] ) == false ) then 
     guiSetVisible ( GUIEditor_Window[1] ,true ) 
     showCursor (false ) 
     guiSetInputEnabled(true) 
    end 
end 
bindKey('f2','down', showWindow) 
addCommandHandler("support", showWindow) 
  
addEventHandler("onClientGuiGlick", getRootElement(), 
function (state) 
    if state == "left" then 
       if ( source == GUIEditor_Button[2] ) then 
           local Player = getLocalPlayer() 
           local thetext = guiGetText(GUIEditor_Edit[1]) 
           if thetext ~= "" then 
           triggerServerEvent("SendTexetes", getLocalPlayer(), Player, thetext) 
           guiSetText(GUIEditor_Edit[1], "") 
           else 
           outputChatBox("You typed invalid text", 255, 0, 0 ) 
             
                end 
            end 
        end 
    end 
end) 

server side

addEvent("SendTexetes", true) 
function SendTexetes (Player, thetext) 
    local name = getPlayerName(Player) 
    outputChatBox(name..': '..thetext, getRootElement(), 255,255,255) 
end 
addEventHandler("SendTexetes", getRootElement(), SendTexetes) 

debugscript says : nothing

:(

Link to comment

line 36; client side

addEventHandler("onClientGuiGlick", getRootElement(), 

event name is wrong, it's should be

addEventHandler("onClientGUIClick", getRootElement(), 

also you have extra 'end'

Edit:

about debugscript, it's should notice you about the extra 'end

if you are using the black console windows it's debug only for server side, this can't help as much as /debugscript 3 in game debug for client and server.

Edited by Guest
Link to comment
addEventHandler("onClientGUIClick", getRootElement(), 
function (state) 
    if state == "left" then 
       if ( source == GUIEditor_Button[2] ) then 
           local Player = getLocalPlayer() 
           local thetext = guiGetText(GUIEditor_Edit[1]) 
           if thetext ~= "" then 
           triggerServerEvent("SendTexetes", getLocalPlayer(), Player, thetext) 
           guiSetText(GUIEditor_Edit[1], "") 
           else 
           outputChatBox("You typed invalid text", 255, 0, 0 ) 
             
                end 
            end 
        end 
    end 
    ) 

it's the same

debugscript says: nothing

" send button " doesn't do anything

Link to comment
addEventHandler("onClientGUIClick", getRootElement(), 
function (state) 
    if state == "left" then 
       if ( source == GUIEditor_Button[2] ) then 
           local Player = getLocalPlayer() 
           local thetext = guiGetText(GUIEditor_Edit[1]) 
           if thetext ~= "" then 
           triggerServerEvent("SendTexetes", getLocalPlayer(), Player, thetext) 
           guiSetText(GUIEditor_Edit[1], "") 
           else 
           outputChatBox("You typed invalid text", 255, 0, 0 ) 
             
                end 
            end 
        end 
    end 
    ) 

it's the same

debugscript says: nothing

" send button " doesn't do anything

since you haven't add 'send button' at the event function, of course it wouldn't do anything

look you have add this

if ( source == GUIEditor_Button[2] ) then 

and this button aren't send button, i think you mixed it

GUIEditor_Button[2] = guiCreateButton(144,137,230,19,"ignore this button",false,GUIEditor_Window[1]) 

and send button is this

GUIEditor_Button[1] = guiCreateButton(472,60,69,30,"Send",false,GUIEditor_Window[1]) 

so this

if ( source == GUIEditor_Button[2] ) then 

should be

if ( source == GUIEditor_Button[1] ) then 

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