[Release] Simple Unrack Script

This is a basic script for unracking ar’s and Shotguns from your vehicle.
This script currently does not have vehicle checking so anyone can do it.

I will not be providing support for this.

To Do:

  1. Animations
  2. Add 3d test display when Unracking
  3. Add vehicle checks

UPDATE 1.0
Added Progress Bar using: [RELEASE] Progress Bars 1.0 [STANDALONE]

Doing everything now takes 3 seconds

Requires: [RELEASE] Progress Bars 1.0 [STANDALONE]

Just Simply drag and drop both files into your server directory and add
“start unrack”
“start progressBars”
To your server config

Commands

For unracking

Ar - /unrack
Shotgun - /unrack1


For Racking

Ar - /rack
Shotgun - /rack1

Old version

New Version

2 Likes

Made a PR.

Thanks for the help, i’m real bad with indentaion and stuffs

very nice :slight_smile: i got a question. how easy is it to disable weapon wheel and weapons switch. so you are forced to use the AR or shoutgun until it get racked again ? just a idea

@Peter To be 100% Honest i wouldn’t do that

A. what if someone came up to you and said drop your Ar/Shotgun then you couldn’t
B. What if they need to switch to a tazer,

Good i dea, but i don’t think it would work very well

What is the functionality of this within the game and how would it work?

@sy20

This is a basic script for unracking ar’s and Shotguns from your vehicle.
Refer to the Description

Yes, but what would “unrack” a weapon? Is that English is not my native language so I do not understand how that would work, in the translator the translation comes out something like ‘unfolding’.

Yes, but what would “unrack” a weapon? Is that English is not my native language so I do not understand how that would work, in the translator the translation comes out something like ‘unfolding’.

could you show me some screenshots ?

@sy20 Do you mean like command-wise?

@KatoThere is really no point, It’s just a matter of /unrack and /rack

cool
(20 Chars)

better, record a video or take screenshots

Yeah Will do

This is an exact copy from my latest update on this script.

Please dont try to steal from me, thanks

i did not steal this from anyone, I just code and i thought this would be useful for some people.

@Lukepollie

As far as I am concerned if you spent 5 minutes in your day looking at what someone releases and the code you would find that it is not the same, and quite far from the same. Thanks for going around making false accusations

RegisterCommand("unrack", function(source, args, rawCommand)       
        GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), 1000, false)
        GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("COMPONENT_AT_AR_FLSH"))
        GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("COMPONENT_AT_AR_AFGRIP"))
        GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("COMPONENT_AT_SCOPE_MEDIUM"))
end)


RegisterCommand("rack", function(source, args, rawCommand)
	RemoveWeaponFromPed(GetPlayerPed(-1), "WEAPON_CARBINERIFLE")
end)

--------------------------------------------------

RegisterCommand("unrack1", function(source, args, rawCommand) 
        GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_PUMPSHOTGUN"), 1000, false)
    	GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_PUMPSHOTGUN"), GetHashKey("COMPONENT_AT_AR_FLSH"))
end)


RegisterCommand("rack1", function(source, args. rawCommand)
	RemoveWeaponFromPed(GetPlayerPed(-1), "WEAPON_PUMPSHOTGUN")
end)
RegisterNetEvent('proxUnrack')
AddEventHandler('proxUnrack', function(id, name)
  local ID = PlayerId()
  local plyID = GetPlayerFromServerId(id)
    if plyID == ID then
      TriggerEvent('chatMessage', "^4OFFICER", {255, 255, 255}, " ^*".. name .. " UNRACKS ^8RIFLE ^7FROM CRUISER ! ")
      GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), 1000, false) -- Change weapon hash here <--
    elseif GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(ID)), GetEntityCoords(GetPlayerPed(plyID)), true) < 49.999 then
      TriggerEvent('chatMessage', "^4OFFICER", {255, 255, 255}, " ^*".. name .. " UNRACKS ^8RIFLE ^7FROM CRUISER ! ")
      GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), 1000, false) -- Change weapon hash here <--)
    end
end)

RegisterNetEvent('proxRack')
AddEventHandler('proxRack', function(id, name)
  local ID = PlayerId()
  local plyID = GetPlayerFromServerId(id)
    if plyID == ID then
      TriggerEvent('chatMessage', "^4OFFICER", {255, 255, 255}, "^*".. name .. " RACKS ^8RIFLE ^7BACK INTO CRUISER ! ")
      RemoveAllPedWeapons(GetPlayerPed(-1))
    elseif GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(ID)), GetEntityCoords(GetPlayerPed(plyID)), true) < 49.999 then
      TriggerEvent('chatMessage', "^4OFFICER", {255, 255, 255}, " ^*".. name .. " RACKS ^8RIFLE ^7BACK INTO CRUISER ! ")
      RemoveAllPedWeapons(GetPlayerPed(-1))
    end
end)

Completely different client.lua do not even need to check the other files

@Lukepollie You also claim it to be “your” script when I read your post and it says “Credits for requesting the script :
@Woopi” so really you have no way of saying “This is all mine and I came up with the idea blah blah”
Let new developers on this platform release what they want and spent some of your time reading their code instead of making an accusation with nothing to back it up!

Hey, I just downloaded this script to our fivem server and it does not work. When I do /unrack nothing happens. I don’t see a message in the text chat saying I’ve un-racked my rifle