Hi, I am working on a script where an admin can do /servermeeting, it will announce in chat at 60 seconds there is about to be a server meeting, at 15 seconds I will execute command /dv on all the clients side, and I want to then mute everyones microphone that doesn’t have an ACE permission I specify. How can I go about the disabling clients microphone part?
I would suggest to take a look at some voice scrips. I think you might bounce on it somewhere there.
That’d be a great idea!
Right now I’m just starting the script. This is what I have:
--AddEventHandler('chatMessage', function(source, name, msg)
RegisterCommand('servermeeting', function(source, args, rawCommand)
if IsPlayerAceAllowed(source, "clark.startmeeting") then
ExecuteCommand("delveh")
TriggerClientEvent('chatMessage', -1, '\n\n\n\n\n\n\n\n\n\n\n ^1 Server Meeting in 60 SECONDS. Finish your RPs!')
SetMapName("-- SERVER MEETING IN PROGRESS --")
Citizen.Wait(30000)
TriggerClientEvent('chatMessage', -1, ' ^1 Server Meeting in 30 SECONDS. Finish your RPs!')
ExecuteCommand("dv")
Citizen.Wait(15000)
TriggerClientEvent('chatMessage', -1, ' ^1 Server Meeting in 15 SECONDS. You will soon be teleported.')
else
TriggerClientEvent('chatMessage', -1, '', {255, 255, 255}, '^7You have tried to enter an admin only command. This action has been logged.')
end
end)
It says “unknown command delveh” even though it is a command?
/delveh is not a default command, and if it’s not properly registered with RegisterCommand, then it won’t work.
Ah. Let me check the resource used to delete cars. It might be detecting a chat message rather than register command to execute?
Yeah, its using if ( msg == “/dv” or msg == “/delveh” ) then
should I change that to:
RegisterCommand(‘delveh’, function(source, args, rawCommand)
at the top and leave the rest since I don’t care about it?
Hrmmmm…
It fixed the issue but doesn’t actually delete the car…
Updated server.lua for the delete vehicle script:
-- Add an event handler for the 'chatMessage' event
AddEventHandler( 'chatMessage', function( source, n, msg )
msg = string.lower( msg )
-- Check to see if a client typed in /dv
RegisterCommand('delveh', function(source, args, rawCommand)
TriggerClientEvent( 'wk:deleteVehicle', source )
end)
if ( msg == "/dv" or msg == "/delveh" ) then
-- Cancel the chat message event (stop the server from posting the message)
CancelEvent()
-- Trigger the client event
TriggerClientEvent( 'wk:deleteVehicle', source )
end
end)
Server.Lua for my script:
--AddEventHandler('chatMessage', function(source, name, msg)
local meetingActive = false
RegisterCommand('servermeeting', function(source, args, rawCommand)
if IsPlayerAceAllowed(source, "clark.startmeeting") then
local meetingActive = true
TriggerClientEvent('chatMessage', -1, '\n\n\n\n\n\n\n\n\n\n\n ^1 Server Meeting in 60 SECONDS. Finish your RPs!')
SetMapName("-- SERVER MEETING IN PROGRESS --")
Citizen.Wait(30000)
TriggerClientEvent('chatMessage', -1, ' ^1 Server Meeting in 30 SECONDS. Finish your RPs!')
Citizen.Wait(15000)
TriggerClientEvent('chatMessage', -1, ' ^1 Server Meeting in 15 SECONDS. You will soon be teleported.')
ExecuteCommand("delveh")
else
TriggerClientEvent('chatMessage', -1, '', {255, 255, 255}, '^7You have tried to enter an admin only command. This action has been logged.')
end
end)
EDIT:
I think I found the issue. /Delveh doesn’t actually work. I thought it was because I didn’t disable the check chat message version. Any clue how to fix this?
EDIT 2: /delveh now works as a register command function, however, the script still doesn’t delete the car. No error is output.
Fixed. Now I need to figure out how to disable the voice chat… Maybe the godly @Vespura can help?
I need to disable the voice chat INPUT for anyone who doesn’t have an ACE permission.
Well, if everyone uses push to talk, I guess you can just disable the push to talk control. However I haven’t tested this and it won’t work if someone is using an open mic/voice activation.
I don’t think that will be a viable solution unfortunately.
I have no idea how you could disable a microphone itself then.
Thanks! (20characters)