Jump to content

ChatBox message don t show!


Recommended Posts

Hello guys , i am new in this section of scripting and i have a problem . 

i want when the player press the button to join and quit , i want a message in chat like "you join the voice chat" and " you quit the voice chat" on my owl server . i tryed to do it but i can t

Can someone help me?  

https://imgur.com/TXvgASI hear is the script to join and quit button.

THX👏

 

and hear you have the script

addEventHandler("onPlayerJoin", root,
    function () -- client has just joined and the proximity voice resource isn't yet running on the client (thus they'd be able to hear everything without limitations on distance)
        setPlayerVoiceIgnoreFrom(source, root)
        setPlayerVoiceBroadcastTo(source, nil)
    end
)
 
addEventHandler("onPlayerQuit", root,
    function ()
        local ConnectedStation = getElementData(source, "Voice:ConnectedStation")
        if ConnectedStation then
            ConnectedStation = tonumber(ConnectedStation)
            if Stations['' .. ConnectedStation] then
                local Found = false
                for i = 1, #Stations['' .. ConnectedStation] do
                    if Stations['' .. ConnectedStation][i] == source then
                        Found = i
                        break
                    end
                end
 
                if not Found then return "Player not found in Station" end
                table.remove(Stations['' .. ConnectedStation], Found)
                setElementData(source, "Voice:ConnectedStation", false, "broadcast")
 
                triggerClientEvent(Stations['' .. FactionID], "Voice:BroadcastReset", Player, Stations['' .. FactionID])
                return true
            end
        end
    end
)
addEventHandler("onPlayerJoin", root,
    function () -- client has just joined and the proximity voice resource isn't yet running on the client (thus they'd be able to hear everything without limitations on distance)
        setPlayerVoiceIgnoreFrom(source, root)
        setPlayerVoiceBroadcastTo(source, nil)
    end
)

addEventHandler("onPlayerQuit", root,
    function ()
        local ConnectedStation = getElementData(source, "Voice:ConnectedStation")
        if ConnectedStation then
            ConnectedStation = tonumber(ConnectedStation)
            if Stations['' .. ConnectedStation] then
                local Found = false
                for i = 1, #Stations['' .. ConnectedStation] do
                    if Stations['' .. ConnectedStation][i] == source then
                        Found = i
                        break
                    end
                end

                if not Found then return "Player not found in Station" end
                table.remove(Stations['' .. ConnectedStation], Found)
                setElementData(source, "Voice:ConnectedStation", false, "broadcast")

                triggerClientEvent(Stations['' .. FactionID], "Voice:BroadcastReset", Player, Stations['' .. FactionID])
                return true
            end
        end
    end
)

 

Link to comment
addEventHandler("onPlayerJoin", root,
    function () -- client has just joined and the proximity voice resource isn't yet running on the client (thus they'd be able to hear everything without limitations on distance)
        setPlayerVoiceIgnoreFrom(source, root)
        setPlayerVoiceBroadcastTo(source, nil)
	outputChatBox("Join", source)
    end
)

addEventHandler("onPlayerQuit", root,
    function ()
	outputChatBox("Quit", source)
        local ConnectedStation = getElementData(source, "Voice:ConnectedStation")
        if ConnectedStation then
            ConnectedStation = tonumber(ConnectedStation)
            if Stations['' .. ConnectedStation] then
                local Found = false
                for i = 1, #Stations['' .. ConnectedStation] do
                    if Stations['' .. ConnectedStation][i] == source then
                        Found = i
                        break
                    end
                end

                if not Found then return "Player not found in Station" end
                table.remove(Stations['' .. ConnectedStation], Found)
                setElementData(source, "Voice:ConnectedStation", false, "broadcast")

                triggerClientEvent(Stations['' .. FactionID], "Voice:BroadcastReset", Player, Stations['' .. FactionID])
                return true
            end
        end
    end
)

 

Edited by Nico834
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...