Hi there everyone!
I’m trying to setup a peacetime toggle, when enabled make everyone invincible to everything and when disabled, reverts back to normal PVP. I’ve got most of it ironed out but the players seem to remain invincible to vehicle damage. My commented natives were causing issues with people tripping over curbs and stuff, which is why they’re in brackets. Does someone see a reason why vehicle damage would remain disabled in this loop?
if disablePVP then
-- Disable pvp
NetworkSetFriendlyFireOption(false)
SetCanAttackFriendly(playerPed, false, false)
if IsControlPressed(0, 106) then
TriggerEvent('esx:showNotification', "~r~Peacetime is enabled. ~n~~s~You can not shoot.")
end
SetPlayerCanDoDriveBy(playerPed, false)
DisablePlayerFiring(playerPed, true)
DisableControlAction(0,24,true) -- disable attack
DisableControlAction(0,25,true) -- disable aim
DisableControlAction(0,47,true) -- disable weapon
DisableControlAction(0,58,true) -- disable weapon
DisableControlAction(0,263,true) -- disable melee
DisableControlAction(0,264,true) -- disable melee
DisableControlAction(0,257,true) -- disable melee
DisableControlAction(0,140,true) -- disable melee
DisableControlAction(0,141,true) -- disable melee
DisableControlAction(0,142,true) -- disable melee
DisableControlAction(0,143,true) -- disable melee
ClearPedBloodDamage(GetPlayerPed(-1))
ClearPedLastWeaponDamage(GetPlayerPed(-1))
ResetPedVisibleDamage(GetPlayerPed(-1))
SetEntityCanBeDamaged(GetPlayerPed(-1), false)
SetEntityInvincible(GetPlayerPed(-1), true)
SetEntityOnlyDamagedByPlayer(GetPlayerPed(-1), false)
SetEntityProofs(GetPlayerPed(-1), true, true, true, true, true, true, true, true)
SetPedCanBeDraggedOut(playerPed, false)
SetPedCanBeKnockedOffVehicle(playerPed, false)
SetPedCanRagdoll(GetPlayerPed(-1), false)
SetPedCanRagdollFromPlayerImpact(playerPed, false)
SetPedConfigFlag(playerPed, 32, false)
SetPedRagdollOnCollision(playerPed, false)
SetPlayerInvincible(PlayerId(), true)
if eraser then
ClearAreaOfEverything(x, y, z, 100.00, false, false, false, false)
end
elseif not disablePVP then
-- Enable pvp
NetworkSetFriendlyFireOption(true)
SetCanAttackFriendly(playerPed, true, true)
SetPlayerCanDoDriveBy(playerPed, true)
SetEntityCanBeDamaged(GetPlayerPed(-1), true)
SetEntityInvincible(GetPlayerPed(-1), false)
SetPlayerInvincible(PlayerId(), false)
SetEntityProofs(GetPlayerPed(-1), false, false, false, false, false, false, false, false)
SetPedCanBeDraggedOut(playerPed, true)
SetPedCanBeKnockedOffVehicle(playerPed, true)
SetPedConfigFlag(playerPed, 32, true)
--[[
SetPedCanRagdoll(GetPlayerPed(-1), true)
SetPedCanRagdollFromPlayerImpact(playerPed, true)
SetEntityOnlyDamagedByPlayer(GetPlayerPed(-1), true)
SetPedRagdollOnCollision(playerPed, true)
]]
end