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
)