Added it so that you can make it so you can select steamids and ips that can use the command
Fixed bugs that stupid me created while tired
Fixed rotation issues
Have fun! PM me if you want something made and I’ll see what I can do (I’m still new to scripting). If you need any help or want to know about any functions of my scripts, ask me!
Extra
This would work great in with my delete object gun script! You can delete what you spawn :3 (tazers work well with it)
The small barrier can’t be run over however the other 2 can. I’m looking into a way to fix it. It’s late and I just wanted to push this out for the guy who requested it. I’ll do my best to have it in the next update as I’m still a newb. Heheh. Stay tuned!
Edit: Nevermind, I’m stupid (+ tired). It does stop AI from running it over. Have fun! (The reason I said what I said before was because in testing I had the object set as non-dynamic which caused the AI to run it over but after setting it as dynamic they stopped running it over. I forgot I did this however. Lolz)
So, the cone spawning works perfectly! I love this script. I have encountered one minor bug and something that might be a neat feature for the future.
The bug is that both barriers spawn offset from where your character is facing. I.E if I am facing the lane I want to block, the barrier will spawn offset from where I am looking by about 45 degrees. Also, the cone and blue police barriers do not stop traffic, however I’m not sure if they were intended to.
A feature (That I’m not sure is possible to create or not) is a pick-up or delete command, so that you can easily get rid of the barriers once your scene is clear.
Thanks again for making this script, I absolutely love it and think that the roleplay opportunities are endless.
I made a script like this aswell, i fixed it by putting this:
-- Created by Murtaza
-- Requested by @Dillon_Dobusz on forum.fivem.net
-- Clientside
RegisterNetEvent('murtaza:cone')
RegisterNetEvent('murtaza:sbarrier')
RegisterNetEvent('murtaza:barrier')
AddEventHandler('murtaza:cone', function()
local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
RequestModel('prop_mp_cone_01')
while not HasModelLoaded('prop_mp_cone_01') do
Citizen.Wait(1)
end
local cone = CreateObject('prop_mp_cone_01', x, y, z-1, true, true, true)
PlaceObjectOnGroundProperly(object)
notification('~g~The cone has been placed!')
end)
AddEventHandler('murtaza:sbarrier', function()
local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
local heading = GetEntityHeading(GetPlayerPed(-1))
RequestModel('prop_mp_barrier_02b')
while not HasModelLoaded('prop_mp_barrier_02b') do
Citizen.Wait(1)
end
local cone = CreateObject('prop_mp_barrier_02b', x, y, z-1, true, true, true)
PlaceObjectOnGroundProperly(object)
SetEntityHeading(object, heading)
notification('~g~The small barrier has been placed!')
end)
AddEventHandler('murtaza:barrier', function()
local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
local heading = GetEntityHeading(GetPlayerPed(-1))
RequestModel('prop_barrier_work05')
while not HasModelLoaded('prop_barrier_work05') do
Citizen.Wait(1)
end
local cone = CreateObject('prop_barrier_work05', x, y, z-1, true, true, true)
PlaceObjectOnGroundProperly(object)
notification('~g~The barrier has been placed!')
SetEntityHeading(object, heading)
end)
function notification(msg)
SetNotificationTextEntry("STRING")
AddTextComponentString(msg)
DrawNotification(false, false)
end
That should work as i copy pasted the heading stuff from my personal script that i made
-- Created by Murtaza
-- Requested by @Dillon_Dobusz on forum.fivem.net
-- Serverside
identifiers = {
"steam:01010101010101010",
}
AddEventHandler('chatMessage', function(source, n, msg)
local msg = string.lower(msg)
if msg == '/cone' then
CancelEvent()
for i = 1, #identifers do
if GetPlayerIdentifiers(source)[1] == identifiers[i] then
TriggerClientEvent('murtaza:cone', source)
end
end
elseif msg == '/sbarrier' then
CancelEvent()
for i = 1, #identifers do
if GetPlayerIdentifiers(source)[1] == identifiers[i] then
TriggerClientEvent('murtaza:sbarrier', source)
end
end
elseif msg == '/barrier' then
CancelEvent()
for i = 1, #identifers do
if GetPlayerIdentifiers(source)[1] == identifiers[i] then
TriggerClientEvent('murtaza:barrier', source)
end
end
end
end)
RegisterNetEvent('murtaza:cone')
RegisterNetEvent('murtaza:sbarrier')
RegisterNetEvent('murtaza:barrier')
AddEventHandler('murtaza:cone', function()
local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
RequestModel('prop_mp_cone_01')
while not HasModelLoaded('prop_mp_cone_01') do
Citizen.Wait(1)
end
local cone = CreateObject('prop_mp_cone_01', x, y, z-1, true, true, true)
PlaceObjectOnGroundProperly(object)
notification('~g~The cone has been placed!')
end)
AddEventHandler('murtaza:sbarrier', function()
local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
local heading = GetEntityHeading(GetPlayerPed(-1))
RequestModel('prop_mp_barrier_02b')
while not HasModelLoaded('prop_mp_barrier_02b') do
Citizen.Wait(1)
end
local cone = CreateObject('prop_mp_barrier_02b', x, y, z-1, true, true, true)
local heading = GetEntityHeading(GetPlayerPed(-1))
SetEntityHeading(cone, heading)
PlaceObjectOnGroundProperly(cone)
notification('~g~The small barrier has been placed!')
end)
AddEventHandler('murtaza:barrier', function()
local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
local heading = GetEntityHeading(GetPlayerPed(-1))
RequestModel('prop_barrier_work05')
while not HasModelLoaded('prop_barrier_work05') do
Citizen.Wait(1)
end
local cone = CreateObject('prop_barrier_work05', x, y, z-1, true, true, true)
PlaceObjectOnGroundProperly(cone)
SetEntityHeading(cone, heading)
notification('~g~The barrier has been placed!')
end)
function notification(msg)
SetNotificationTextEntry("STRING")
AddTextComponentString(msg)
DrawNotification(false, false)
end