Introduces PvP toggle: ft command

This commit is contained in:
Mitroxs
2021-12-02 23:02:30 +01:00
parent ca4ede1f67
commit 6ee16d2262
2 changed files with 11 additions and 0 deletions
+4
View File
@@ -14,6 +14,10 @@ RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
LocalPlayer.state:set('isLoggedIn', false, false)
end)
RegisterNetEvent('QBCore:Client:PvpHasToggled', function(pvp_state)
SetCanAttackFriendly(PlayerPedId(), pvp_state, pvp_state)
NetworkSetFriendlyFireOption(pvp_state)
end)
-- Teleport Commands
RegisterNetEvent('QBCore:Command:TeleportToPlayer', function(coords)
+7
View File
@@ -73,6 +73,13 @@ QBCore.Commands.Add('tpm', 'TP To Marker (Admin Only)', {}, false, function(sour
TriggerClientEvent('QBCore:Command:GoToMarker', src)
end, 'admin')
QBCore.Commands.Add('togglepvp', 'Toggle PVP on the server (Admin Only)', {}, false, function(source)
local src = source
local pvp_state = QBConfig.Server.pvp
QBConfig.Server.pvp = not pvp_state
TriggerClientEvent('QBCore:Client:PvpHasToggled', -1, QBConfig.Server.pvp)
end, 'admin')
-- Permissions
QBCore.Commands.Add('addpermission', 'Give Player Permissions (God Only)', { { name = 'id', help = 'ID of player' }, { name = 'permission', help = 'Permission level' } }, true, function(source, args)