Jump to content

Script with no sense help


Recommended Posts

client side

win1 = guiCreateWindow(356,254,683,358,"|~>[Help Panel]<~|",false) 
guiSetAlpha(win1,1) 
guiWindowSetSizable(win1,false) 
mem1 = guiCreateMemo(11,23,663,283,"",false,win1) 
guiMemoSetReadOnly(mem1,true) 
edi1 = guiCreateEdit(109,-421,5,296,"",false,win1) 
butt1 = guiCreateButton(605,310,69,38,"send",false,win1) 
guiSetProperty(butt1,"Alpha","10") 
guiSetProperty(butt1,"Font","3") 
edi2 = guiCreateEdit(9,312,590,31,"",false,win1) 
guiSetVisible ( win1 ,false ) 
     
    function sendmessages() 
    if isElement(win1) then 
        local newText = guiGetText(edi2) 
        if newText and string.len(newText) > 0 then 
            local oldText = guiGetText(mem1) 
            if not oldText then oldText = "" end 
            oldText = oldText .. getPlayerName(getLocalPlayer()) .. ":" .. newText .. "\n" 
            guiSetText(mem1, oldText) 
            guiSetText(edi2, "") 
            guiMemoSetCaretIndex(mem1, string.len(oldText)) 
  
            triggerServerEvent("onSendMessages", getLocalPlayer(), ply,newText) 
        end  
    end 
end 
  
bindKey('f2','down',function() 
    guiSetVisible(mem1,not guiGetVisible(mem1)) 
    showCursor(guiGetVisible(mem1)) 
end) 

server side

addEvent("onSendMessages", true) 
addEventHandler("onSendMessages", getRootElement(),  
    function(noise, text) 
        triggerClientEvent(toplayer, "onSendMessages", source, source, text) 
    end 
) 

mm i see no problem with server side

but,.. i want when i type in edi2 my text show up in mem1 ..

Link to comment

like that ?

    function sendmessages() 
    if isElement(win1) then 
        local newText = guiGetText(edi2) 
        if newText and string.len(newText) > 0 then 
            local oldText = guiGetText(mem1) 
            if not oldText then oldText = "" end 
            oldText = oldText .. getPlayerName(getLocalPlayer()) .. ":" .. newText .. "\n" 
            guiSetText(mem1, oldText) 
            guiSetText(edi2, "") 
            guiMemoSetCaretIndex(mem1, string.len(oldText)) 
  
            triggerServerEvent("onSendMessages", getLocalPlayer(), ply,newText) 
        end  
    end 
end 
addEventHandler("onSendMessages", getRootElement(), sendmessages) 

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