How can we disable more keys? like R coz R button do the punch.
http://docs.fivem.net/game-references/controls/ Look up the keys you would like to disable. That simple
As anders said:
Add the three DisableControlAction lines below the if statement I have below to stop the melee attacks. This was in the original script but it was thought to be not necessary when using friendlyfire.
if dist <= 50 then
DisableControlAction(0, 140, true)
DisableControlAction(0, 141, true)
DisableControlAction(0, 142, true)
Actually i tried that and didnt work “davewazere” but it was my fault i forgot the " ) " lol im dumb, thank you coz u remind me to read again your answer correct X_X
Hey i have on Question. How can i set that me as a Admin can Shoot inside (Permission) ?
Can i set this with the Steam ID oder License or something else and how looks the Script like?
You could use IsPlayerAceAllowed() in the code and just end instead of affecting said players with the aces.
And add the aces in your server cfg. Other than that I’m not sure how to have it within the file itself. Never really messed with permissions other than vrp.
I think @vespura had a really good explanation in one of his posts. I’ll find it for you
Edit. Here you go
Note that “IsPlayerAceAllowed()” is server side only. So you’ll need to check permissions on the server and then send them to the client.
how to take out the blips? i’ve tried to set it up to 0 but it is still showing…
You need to comment out the whole blip section.
--------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------
------- Creating Blips at the locations. --------------
-------You can comment out this section if you dont want any blips showing the zones on the map.--------------
--------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------
Citizen.CreateThread(function()
while not NetworkIsPlayerActive(PlayerId()) do
Citizen.Wait(0)
end
for i = 1, #zones, 1 do
local szBlip = AddBlipForCoord(zones[i].x, zones[i].y, zones[i].z)
SetBlipAsShortRange(szBlip, true)
SetBlipColour(szBlip, 2) --Change the blip color: https://gtaforums.com/topic/864881-all-blip-color-ids-pictured/
SetBlipSprite(szBlip, 398) -- Change the blip itself: https://marekkraus.sk/gtav/blips/list.html
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("SAFE ZONE") -- What it will say when you hover over the blip on your map.
EndTextCommandSetBlipName(szBlip)
end
end)
Hi bro,
I have a Spanish server of zombies and I have also installed the CorruptSnail, what I need is that when a player is in a safe area, the zombies that enter die instantly or disappear. Here I leave the whole code of the zombiespawner of CorruptSnail
-- CODE --
players = {}
RegisterNetEvent("Z:playerUpdate")
AddEventHandler("Z:playerUpdate", function(mPlayers)
players = mPlayers
end)
peds = {}
Citizen.CreateThread(function()
AddRelationshipGroup("zombeez")
SetRelationshipBetweenGroups(5, GetHashKey("zombeez"), GetHashKey("PLAYER"))
SetRelationshipBetweenGroups(5, GetHashKey("zombeez"), GetHashKey("bandit"))
SetRelationshipBetweenGroups(5, GetHashKey("PLAYER"), GetHashKey("zombeez"))
SetAiMeleeWeaponDamageModifier(2.0)
while true do
Wait(1)
if #peds < 15 then
x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
choosenPed = pedModels[math.random(1, #pedModels)]
choosenPed = string.upper(choosenPed)
RequestModel(GetHashKey(choosenPed))
while not HasModelLoaded(GetHashKey(choosenPed)) or not HasCollisionForModelLoaded(GetHashKey(choosenPed)) do
Wait(1)
end
local newX = x
local newY = y
local newZ = z + 999.0
repeat
Wait(1)
newX = x + math.random(-50, 50)
newY = y + math.random(-50 , 50)
_,newZ = GetGroundZFor_3dCoord(newX+.0,newY+.0,z, 1)
for _, player in pairs(players) do
Wait(1)
playerX, playerY = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
if newX > playerX - 35 and newX < playerX + 35 or newY > playerY - 35 and newY < playerY + 35 then
canSpawn = false
break
else
canSpawn = true
end
end
until canSpawn
ped = CreatePed(4, GetHashKey(choosenPed), newX, newY, newZ, 0.0, true, true)
SetPedArmour(ped, 100)
SetPedAccuracy(ped, 25)
SetPedSeeingRange(ped, 100.0)
SetPedHearingRange(ped, 80.0)
SetPedFleeAttributes(ped, 0, 0)
SetPedCombatAttributes(ped, 16, 1)
SetPedCombatAttributes(ped, 17, 0)
SetPedCombatAttributes(ped, 46, 1)
SetPedCombatAttributes(ped, 1424, 0)
SetPedCombatAttributes(ped, 5, 1)
SetPedCombatRange(ped,2)
SetPedAlertness(ped,3)
SetAmbientVoiceName(ped, "ALIENS")
SetPedEnableWeaponBlocking(ped, true)
SetPedRelationshipGroupHash(ped, GetHashKey("zombeez"))
DisablePedPainAudio(ped, true)
SetPedDiesInWater(ped, false)
SetPedDiesWhenInjured(ped, false)
-- PlaceObjectOnGroundProperly(ped)
SetPedDiesInstantlyInWater(ped,true)
SetPedIsDrunk(ped, true)
SetPedConfigFlag(ped,100,1)
RequestAnimSet("move_m@drunk@verydrunk")
while not HasAnimSetLoaded("move_m@drunk@verydrunk") do
Wait(1)
end
SetPedMovementClipset(ped, "move_m@drunk@verydrunk", 1.0)
ApplyPedDamagePack(ped,"BigHitByVehicle", 0.0, 9.0)
ApplyPedDamagePack(ped,"SCR_Dumpster", 0.0, 9.0)
ApplyPedDamagePack(ped,"SCR_Torture", 0.0, 9.0)
StopPedSpeaking(ped,true)
TaskWanderStandard(ped, 1.0, 10)
local pspeed = math.random(20,70)
local pspeed = pspeed/10
local pspeed = pspeed+0.01
SetEntityMaxSpeed(ped, 5.0)
if not NetworkGetEntityIsNetworked(ped) then
NetworkRegisterEntityAsNetworked(ped)
end
table.insert(peds, ped)
end
for i, ped in pairs(peds) do
if DoesEntityExist(ped) == false then
table.remove(peds, i)
end
pedX, pedY, pedZ = table.unpack(GetEntityCoords(ped, true))
if IsPedDeadOrDying(ped, 1) == 1 then
-- Set ped as no longer needed for despawning
local dropChance = math.random(0,100)
if GetPedSourceOfDeath(ped) == PlayerPedId() then
if dropChance >= 95 then
ForceCreateFoodPickupAtCoord(pedX,pedY,pedZ)
end
zombiekillsthislife = zombiekillsthislife+1
zombiekills = zombiekills+1
end
Citizen.InvokeNative(0xB736A491E64A32CF, Citizen.PointerValueIntInitialized(ped))
table.remove(peds, i)
else
playerX, playerY = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
SetPedArmour(ped, 100)
SetPedAccuracy(ped, 25)
SetPedSeeingRange(ped, 300.0)
SetPedHearingRange(ped, 300.0)
SetPedFleeAttributes(ped, 0, 0)
SetPedCombatAttributes(ped, 16, 1)
SetPedCombatAttributes(ped, 17, 0)
SetPedCombatAttributes(ped, 46, 1)
SetPedCombatAttributes(ped, 1424, 0)
SetPedCombatAttributes(ped, 5, 1)
SetPedCombatRange(ped,2)
SetAmbientVoiceName(ped, "ALIENS")
SetPedEnableWeaponBlocking(ped, true)
SetPedRelationshipGroupHash(ped, GetHashKey("zombeez"))
DisablePedPainAudio(ped, true)
SetPedDiesInWater(ped, false)
SetPedDiesWhenInjured(ped, false)
if pedX < playerX - 70 or pedX > playerX + 70 or pedY < playerY - 70 or pedY > playerY + 70 then
-- Set ped as no longer needed for despawning
local model = GetEntityModel(ped)
SetEntityAsNoLongerNeeded(ped)
SetModelAsNoLongerNeeded(model)
table.remove(peds, i)
end
end
end
end
end)
RegisterNetEvent("Z:cleanup")
AddEventHandler("Z:cleanup", function()
for i, ped in pairs(peds) do
-- Set ped as no longer needed for despawning
local model = GetEntityModel(ped)
SetEntityAsNoLongerNeeded(ped)
SetModelAsNoLongerNeeded(model)
table.remove(peds, i)
end
end)
I’m on my phone atm***
So basically you would have to make it so the zone is also looking for NPCs and when the npc is in the zone you set their health to 0.
My guess would be to use SetEntityHealth
https://runtime.fivem.net/doc/reference.html#_0x6B76DC1F3AE6E6A3
thanks for answering so fast, I’ve been looking at what you said and nothing, I created this code:
if inzone == 1 then
SetEntityHealth(mPlayer(-1), 0)
end
shouldnt you use " ped " ? It looks like ped is your zombies?
You could go something like
local x2,y2,z2 = table.unpack(GetEntityCoords(ped, true))
local dist2 = Vdist(zones[closestZone].x, zones[closestZone].y, zones[closestZone].z, x2, y2, z2)
if dist2 <= 50 then
SetPedToRagdoll(ped, 10000, 0, 0, 0, 0, 0)
Wait(5000)
if IsPedRagdoll(ped) then
DeleteEntity(ped)
end
end
I really have no idea, never messed with npcs lol
It does not work, I do not know how to make it work, since I’m too noob in this and little by little I’m improving.
when you have 30 zombies that kill you with 2 blows … You understand my concern for the safe areas hahaha
If you are just trying to copy paste this somewhere in your code of course its not going to work. You have to mess about with it. You cant just throw it in my code and expect it to realize what a “zombie” is. You have to define it somewhere. And you cant just put this into your code because it doesnt know what a zone is. Youre gonna need to figure out how to identify the zombies in the zone code.
Hmm. Having some weird issues. For some reason people are able to shoot from the outside players inside.
Also, adjusting the radius doesn’t adjust the radius of the blue visual circle.
Can I add a blacklist group like police so police pfficers can point guns at people in safe zones?
So you will still be able to shoot into the zone. I have no idea how youd be able to even work out not being able to shoot at the zone. You wont be able to shoot people though. If they are in their car in the zone. Bullets can hit it. But it wont damage the vehicle. As for the circle. Look in the code, it’s all the way at the bottom, and re read the OP. It tells you exactly how to change the circle. @CakeArmy_Max
As for blacklisting, white listing, whatever, you will have to figure that out on your own till I get back into messing around with this. Havent been coding for a bit. On that rocket league grind
What I was referring to is users can shoot and kill players that are inside the zone. I also did adjust the blue circles to my liking, just was making the OP aware in case they wanted to document scale.
how to add safezone different size at different location
for example
safezone at garage dist <= 50.0 and
safezone at hospital dist <=200.0