[Release] Simple Unrack Script

@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

because there is no message, i am currently working on an updated version of this which will have a progress bar @NebulaInsomniac

Don’t listen to that guy. You didn’t steal anyone script. It may be similar but its coding. Gotta look up to someone.

Thanks It works really well!

The script is nice, however it seems like when I put a gun in, and take out it, it refills the ammo to full.

https://streamable.com/gbpdb
In case it doesnt load

Sorry @Agony099There isn’t really anything i can do about it, you cxan look into it yourself.

you can deadass do a lot about it