Jump to content

few problems


Recommended Posts

client side

mywindow1 = guiCreateWindow(168,286,725,375,"<|6arh|>  ~<| chat window |>~",false) 
  
guiSetAlpha(mywindow1,1) 
  
guiWindowSetSizable(mywindow1,false) 
  
tarahImage = guiCreateStaticImage(9,23,707,343,"images/6arh.png",false,mywindow1) 
  
mytappanel = guiCreateTabPanel(29,18,643,191,false,tarahImage) 
  
exitbutton = guiCreateButton(0,321,188,19,"EXIT",false,tarahImage) 
  
guiSetFont(exitbutton,"default-bold-small") 
  
tap1 = guiCreateTab("Support",mytappanel) 
  
theedit = guiCreateEdit(16,133,545,24,"",false,tap1) 
  
sendbutton = guiCreateButton(564,132,68,28,"send",false,tap1) 
  
mymemo = guiCreateMemo(16,7,615,117,"",false,tap1) 
  
guiMemoSetReadOnly(mymemo,true) 
  
------------------------------------------------------------------------------------------------------------| 
  
tap2 = guiCreateTab("Request",mytappanel) 
  
theedit2 = guiCreateEdit(16,133,545,24,"",false,tap2) 
  
sendbutton2 = guiCreateButton(564,132,68,28,"send",false,tap2) 
  
mymemo2 = guiCreateMemo(16,7,615,117,"",false,tap2) 
  
guiMemoSetReadOnly(mymemo2,true) 
--------------------------------------------------------------------------------------------------------------| 
  
tap3 = guiCreateTab("Main",mytappanel) 
  
theedit3 = guiCreateEdit(16,133,545,24,"",false,tap3) 
  
sendbutton3 = guiCreateButton(564,132,68,28,"send",false,tap3) 
  
mymemo3 = guiCreateMemo(16,7,615,117,"",false,tap3) 
  
guiMemoSetReadOnly(mymemo3,true) 
  
guiSetVisible(mywindow1,false) 
-----------------------------------------------------------------------------------------------------------------| 
  
-- set window with bindkey 
function showMyWindow() 
    if ( guiGetVisible ( mywindow1 ) == false ) then 
     guiSetVisible ( mywindow1 ,true ) 
     showCursor (false ) 
     guiSetInputEnabled(true) 
      
    elseif ( guiGetVisible ( mywindow1 ) == true ) then 
     guiSetVisible ( mywindow1 ,false ) 
     showCursor (false ) 
     guiSetInputEnabled(false) 
             
    end 
end 
     bindKey("N","down", showMyWindow) 
  
-- the exit button 
function exitthechat() 
    if ( source == exitbutton ) then 
          guiSetVisible(mywindow1,false) 
                  showCursor(false) 
                      guiSetInputEnabled(false) 
    end 
end 
addEventHandler(" onClientGUIClick", root, exitthechat) 
  
-- tap 1 
function wonderful(state,thePlayer) 
    if state == "left" then 
        if ( source == sendbutton ) then 
            local Player = getLocalPlayer() 
            local mytext = guiGetText(theedit) 
            local mytext2 = guiGetText(mymemo) 
                if mytext ~= "" then 
                if not mytext2 then mytext2 = "" end 
                mytext2 = mytext2 .. getPlayerName(getLocalPlayer()) ..": "..mytext.."\n" 
                guiSetText(mymemo, mytext2) 
                guiMemoSetCaretIndex(mymemo, string.len(mytext2)) 
                    triggerServerEvent("Soundsgood", getLocalPlayer(), Player, mytext) 
                    guiSetText(theedit, "") 
                end 
                end 
        end 
    end 
addEventHandler( "onClientGUIClick", getRootElement(), wonderful) 
addEventHandler( "onClientGUIAccepted", theedit) 
  
-- tap 2 
function wonderful(state,thePlayer) 
    if state == "left" then 
        if ( source == sendbutton2 ) then 
            local Player = getLocalPlayer() 
            local mytext = guiGetText(theedit2) 
            local mytext2 = guiGetText(mymemo2) 
                if mytext ~= "" then 
                if not mytext2 then mytext2 = "" end 
                mytext2 = mytext2 .. getPlayerName(getLocalPlayer()) ..": "..mytext.."\n" 
                guiSetText(mymemo2, mytext2) 
                guiMemoSetCaretIndex(mymemo, string.len(mytext2)) 
                    triggerServerEvent("Soundsgood2", getLocalPlayer(), Player, mytext) 
                    guiSetText(theedit2, "") 
                end 
                end 
        end 
    end 
addEventHandler(" onClientGUIClick", getRootElement(), wonderful) 
addEventHandler(" onClientGUIAccepted", theedit2) 
  
-- tab 3 
function wonderful(state,thePlayer) 
    if state == "left" then 
        if ( source == sendbutton3 ) then 
            local Player = getLocalPlayer() 
            local mytext = guiGetText(theedit3) 
            local mytext2 = guiGetText(mymemo3) 
                if mytext ~= "" then 
                if not mytext2 then mytext2 = "" end 
                mytext2 = mytext2 .. getPlayerName(getLocalPlayer()) ..": "..mytext.."\n" 
                guiSetText(mymemo3, mytext2) 
                guiMemoSetCaretIndex(mymemo, string.len(mytext2)) 
                    triggerServerEvent("Soundsgood3", getLocalPlayer(), Player, mytext) 
                    guiSetText(theedit3, "") 
                end 
                end 
        end 
    end 
addEventHandler(" onClientGUIClick", getRootElement(), wonderful) 
addEventHandler(" onClientGUIAccepted", theedit3) 

onClientGUIAccepted doesn't work ?

server side

addEvent("Soundsgood", true) 
function Soundsgood(Player,mytext) 
local name = getPlayerName(Player) 
outputChatBox("* < Support >  "..name..": #ffffff"..mytext, getRootElement(),255,0,0,true) 
end 
addEventHandler("Soundsgood", getRootElement(), Soundsgood) 
  
addEvent("Soundsgood2", true) 
function Soundsgood2(Player,mytext) 
local name = getPlayerName(Player) 
outputChatBox("* < Request >  "..name..": #ffffff"..mytext, getRootElement(),255,0,0,true) 
end 
addEventHandler("Soundsgood2", getRootElement(), Soundsgood2) 
  
addEvent("Soundsgood3", true) 
function Soundsgood3(Player,mytext) 
local name = getPlayerName(Player) 
outputChatBox(name..": #ffffff"..mytext, getRootElement(),0,0,0,true) 
end 
addEventHandler("Soundsgood3", getRootElement(), Soundsgood3) 

the text and the player name into the memo only show up for me and the other players don't see anything of mytext !

this is not a stolen script by the way " solid "

Link to comment
addEventHandler(" onClientGUIClick", getRootElement(), wonderful) 
addEventHandler(" onClientGUIAccepted", theedit3) 

It's wrong. You can't use spaces in event name. You should use original event name. Read wiki before post something.

Also you don't use function in this handlers

  
addEventHandler( "onClientGUIAccepted", theedit) 
addEventHandler(" onClientGUIAccepted", theedit2) 
addEventHandler(" onClientGUIAccepted", theedit3) 

Edited by Guest
Link to comment
addEventHandler(" onClientGUIClick", getRootElement(), wonderful) 
addEventHandler(" onClientGUIAccepted", theedit3) 

It's wrong. You can't use spaces in event name. You should use original event name. Read wiki before post something.

Also you don't use attach element in this handlers

  
addEventHandler( "onClientGUIAccepted", theedit) 
addEventHandler(" onClientGUIAccepted", theedit2) 
addEventHandler(" onClientGUIAccepted", theedit3) 

he attach it to element but he didn't attach it to function.

Edit:

about this

the text and the player name into the memo only show up for me and the other players don't see anything of mytext !

you will need to trigger to server side and then trigger to client side for all players in the server.

Edited by Guest
Link to comment
addEventHandler(" onClientGUIClick", getRootElement(), wonderful) 
addEventHandler(" onClientGUIAccepted", theedit3) 

It's wrong. You can't use spaces in event name. You should use original event name. Read wiki before post something.

Also you don't use attach element in this handlers

  
addEventHandler( "onClientGUIAccepted", theedit) 
addEventHandler(" onClientGUIAccepted", theedit2) 
addEventHandler(" onClientGUIAccepted", theedit3) 

he attach it to element but he didn't attach it to function.

Even though

  
addEventHandler("onClientGUIAccepted", theedit, wonderful) 
addEventHandler("onClientGUIAccepted", theedit2, wonderful) 
addEventHandler("onClientGUIAccepted", theedit3, wonderful) 

it doesn't send by ENTER key

but have i to change the functions names for the event handlers ?

Link to comment
Guest Guest4401
Even though
  
addEventHandler("onClientGUIAccepted", theedit, wonderful) 
addEventHandler("onClientGUIAccepted", theedit2, wonderful) 
addEventHandler("onClientGUIAccepted", theedit3, wonderful) 

it doesn't send by ENTER key

but have i to change the functions names for the event handlers ?

onClientGUIClick and onClientGUIAccepted, both have different parametres. Hence, these two conditions fail:

function wonderful(state,thePlayer) 
    if state == "left" then 
        if ( source == sendbutton3 ) then 
         
        end 
    end 
end 

Link to comment
Even though
  
addEventHandler("onClientGUIAccepted", theedit, wonderful) 
addEventHandler("onClientGUIAccepted", theedit2, wonderful) 
addEventHandler("onClientGUIAccepted", theedit3, wonderful) 

it doesn't send by ENTER key

but have i to change the functions names for the event handlers ?

onClientGUIClick and onClientGUIAccepted, both have different parametres. Hence, these two conditions fail:

function wonderful(state,thePlayer) 
    if state == "left" then 
        if ( source == sendbutton3 ) then 
         
        end 
    end 
end 

i guess

function wonderful(button,thePlayer) 
    if button == "left" then 
        if ( source == sendbutton3 ) then 

is better

Link to comment
Even though
  
addEventHandler("onClientGUIAccepted", theedit, wonderful) 
addEventHandler("onClientGUIAccepted", theedit2, wonderful) 
addEventHandler("onClientGUIAccepted", theedit3, wonderful) 

it doesn't send by ENTER key

but have i to change the functions names for the event handlers ?

onClientGUIClick and onClientGUIAccepted, both have different parametres. Hence, these two conditions fail:

function wonderful(state,thePlayer) 
    if state == "left" then 
        if ( source == sendbutton3 ) then 
         
        end 
    end 
end 

i guess

function wonderful(button,thePlayer) 
    if button == "left" then 
        if ( source == sendbutton3 ) then 

is better

It's same.

Link to comment
@teteomar@ you have mess with the parameters.

I advise you to read wiki, also you have functions with same name it's may make a problems.

https://wiki.multitheftauto.com/wiki/OnClientGUIClick

https://wiki.multitheftauto.com/wiki/OnClientGUIAccepted

well i had enough

that's the one

-- make send messages with ENTER tab1 
function letsmakeitwithenter ( element ) 
                    local mytext = guiGetText ( theedit ) 
                    local mytext2 = guiGetText(mymemo) 
                    local Player = getLocalPlayer( ) 
                         if ( ( mytext ) and ( mytext ~= "" ) ) then 
                         mytext2 = mytext2 .. getPlayerName(getLocalPlayer( )) ..": "..mytext.."\n" 
                         guiSetText(mymemo, mytext2) 
                        guiMemoSetCaretIndex(mymemo, string.len(mytext2)) 
                            triggerServerEvent("Soundsgood", getLocalPlayer( ), Player, mytext) 
                                guiSetText(theedit, "") 
                end 
end 
addEventHandler ( "onClientGUIAccepted", theedit, letsmakeitwithenter) 
  
-- make send messages with ENTER tab2 
function letsmakeitwithenter ( element ) 
                    local mytext = guiGetText ( theedit2 ) 
                    local mytext2 = guiGetText( mymemo2 ) 
                    local Player = getLocalPlayer( ) 
                         if ( ( mytext ) and ( mytext ~= "" ) ) then 
                         mytext2 = mytext2 .. getPlayerName(getLocalPlayer( )) ..": "..mytext .."\n" 
                         guiSetText(mymemo2, mytext2) 
                        guiMemoSetCaretIndex(mymemo2, string.len(mytext2)) 
                            triggerServerEvent("Soundsgood2", getLocalPlayer( ), Player, mytext ) 
                                guiSetText(theedit2, "") 
                end 
end 
addEventHandler ( "onClientGUIAccepted", theedit2, letsmakeitwithenter) 
  
-- make send messages with ENTER tab3 
function letsmakeitwithenter ( element ) 
                    local mytext = guiGetText ( theedit3 ) 
                    local mytext2 = guiGetText( mymemo3 ) 
                    local Player = getLocalPlayer( ) 
                         if ( ( mytext ) and ( mytext ~= "" ) ) then 
                         mytext2 = mytext2 .. getPlayerName(getLocalPlayer( )) ..": "..mytext .."\n" 
                         guiSetText(mymemo3, mytext2) 
                        guiMemoSetCaretIndex(mymemo3, string.len(mytext2)) 
                            triggerServerEvent("Soundsgood3", getLocalPlayer( ), Player, mytext ) 
                                guiSetText(theedit3, "") 
                end 
end 
addEventHandler ( "onClientGUIAccepted", theedit3, letsmakeitwithenter) 

server side

i will not show it

but my problem is here

the text and the player name into the memo only show up for me and the other players don't see anything of mytext !

Link to comment
Guest Guest4401

Because when you edit memo clientside, only that client sees the modification. You must send the memo text, from client to server and finally to everyone.

Link to comment
@teteomar@ you have mess with the parameters.

I advise you to read wiki, also you have functions with same name it's may make a problems.

https://wiki.multitheftauto.com/wiki/OnClientGUIClick

https://wiki.multitheftauto.com/wiki/OnClientGUIAccepted

well i had enough

that's the one

-- make send messages with ENTER tab1 
function letsmakeitwithenter ( element ) 
                    local mytext = guiGetText ( theedit ) 
                    local mytext2 = guiGetText(mymemo) 
                    local Player = getLocalPlayer( ) 
                         if ( ( mytext ) and ( mytext ~= "" ) ) then 
                         mytext2 = mytext2 .. getPlayerName(getLocalPlayer( )) ..": "..mytext.."\n" 
                         guiSetText(mymemo, mytext2) 
                        guiMemoSetCaretIndex(mymemo, string.len(mytext2)) 
                            triggerServerEvent("Soundsgood", getLocalPlayer( ), Player, mytext) 
                                guiSetText(theedit, "") 
                end 
end 
addEventHandler ( "onClientGUIAccepted", theedit, letsmakeitwithenter) 
  
-- make send messages with ENTER tab2 
function letsmakeitwithenter ( element ) 
                    local mytext = guiGetText ( theedit2 ) 
                    local mytext2 = guiGetText( mymemo2 ) 
                    local Player = getLocalPlayer( ) 
                         if ( ( mytext ) and ( mytext ~= "" ) ) then 
                         mytext2 = mytext2 .. getPlayerName(getLocalPlayer( )) ..": "..mytext .."\n" 
                         guiSetText(mymemo2, mytext2) 
                        guiMemoSetCaretIndex(mymemo2, string.len(mytext2)) 
                            triggerServerEvent("Soundsgood2", getLocalPlayer( ), Player, mytext ) 
                                guiSetText(theedit2, "") 
                end 
end 
addEventHandler ( "onClientGUIAccepted", theedit2, letsmakeitwithenter) 
  
-- make send messages with ENTER tab3 
function letsmakeitwithenter ( element ) 
                    local mytext = guiGetText ( theedit3 ) 
                    local mytext2 = guiGetText( mymemo3 ) 
                    local Player = getLocalPlayer( ) 
                         if ( ( mytext ) and ( mytext ~= "" ) ) then 
                         mytext2 = mytext2 .. getPlayerName(getLocalPlayer( )) ..": "..mytext .."\n" 
                         guiSetText(mymemo3, mytext2) 
                        guiMemoSetCaretIndex(mymemo3, string.len(mytext2)) 
                            triggerServerEvent("Soundsgood3", getLocalPlayer( ), Player, mytext ) 
                                guiSetText(theedit3, "") 
                end 
end 
addEventHandler ( "onClientGUIAccepted", theedit3, letsmakeitwithenter) 

server side

i will not show it

but my problem is here

the text and the player name into the memo only show up for me and the other players don't see anything of mytext !

Read my post again, i've told you that function with same name will make problems and you didn't change the function name.

and about your problem i've already told you what you need in my previous post, also karthik_184 told you too.

Because when you edit memo clientside, only that client sees the modification. You must send the memo text, from client to server and finally to everyone.
Link to comment
Read my post again, i've told you that function with same name will make problems and you didn't change the function name.

i already changed the functions names. sigh but i still looking for the solve which makes the texts are public for all ..

Link to comment
Read my post again, i've told you that function with same name will make problems and you didn't change the function name.

i already changed the functions names. sigh but i still looking for the solve which makes the texts are public for all ..

We already given you the solution.

Read the previous post, if you want ignore the solution then it your problem, I'm not going make the code for you.

Link to comment
Read my post again, i've told you that function with same name will make problems and you didn't change the function name.

i already changed the functions names. sigh but i still looking for the solve which makes the texts are public for all ..

We already given you the solution.

Read the previous post, if you want ignore the solution then it your problem, I'm not going make the code for you.

listen, i didn't asked you to make this code for me. but i just want the codes

like

you can use this

 ... 

and this

 ... 

etc .. that's all and i will fix it with my self and thanks all for help.

Link to comment

you can use this

triggerServerEvent("sendToServer", localPlayer, text) 

and this

triggerClientEvent(root, "sendToClient", root, text) 

and this

addEvent 
addEventHandler 

and this

guiSetText(memo, text) 

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