[RELEASE] Unrack and Rack simple reply script

RegisterCommand("unrack", function(source, args, rawCommand)

local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false)
local class = GetVehicleClass(vehicle)

   if( class == 18) then
 
      GiveWeaponToPed(GetPlayerPed(-1), "WEAPON_CARBINERIFLE", 1000, false, false)

   end
end)

RegisterCommand("rack", function(source, args, rawCommand)

local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false)
local class = GetVehicleClass(vehicle)

   if( class == 18) then
 
      GiveWeaponToPed(GetPlayerPed(-1), "WEAPON_CARBINERIFLE", 1000, false, false)
      

   end
end)

Havnt tested this but something like this should work, just replace the server file with this

Class 18 is emergency vehicles right ?

yeah

ahhhhh20charssss

1 Like

So all you did was to change some lines?

The thing woopi did is so you cancan only pull out a weapon with the command in an emergency vehicle.
I will update this and credit him

I’m talking about you, and his code will return nil.

Hmm okay, but idk what you mean with

From your other script, grab and put away or whatever its called.

I just changed the chatmessage for the busy people

Hello i get this error whenever i put the script in.
stack traceback:
[C]: in upvalue ‘_in’
citizen:/scripting/lua/natives_server.lua:273: in function ‘RegisterCommand’
server/main.lua:9: in main chunk

post line 9 in server.lua

its been happening with multiple resources so i know have a clear verison no extra resources.

“RegisterCommand(“grab”, function(source)
TriggerClientEvent(“chatMessage”, -1, tostring(GetPlayerName(source) … " ^1 Unracks Rifle From Their Car!”))
end)

RegisterCommand(“away”, function(source)
TriggerClientEvent(“chatMessage”, -1, tostring(GetPlayerName(source) … " ^1 Racks Rifle Back Into Their Car!"))
end)
"

i restarted the server and then it gave this
stack traceback:
[c]: in upvalue ‘_in’
citizen:/scripting/lua/natives_server.lua:273: in function ‘RegisterCommand’
server.lua:1: in main chunk
failed to load script server.lua

Did you edit the code?

it works now thank you/

1 Like

Bump.
Spoiler alert
Update incoming, not gonna say what yet

@Woopi This did not work, i tried to correct it but it just spewed out errors,

show me your code? @macj45

20charrr

RegisterCommand("grab", function(source, args, rawCommand)
    TriggerClientEvent("chatMessage", -1, GetPlayerName(source) .. " ^1Unracks Rifle From Their vehicle!")
end)

RegisterCommand("away", function(source, args, rawCommand)
    TriggerClientEvent("chatMessage", -1, GetPlayerName(source) .. " ^1Racks Rifle Back Into Their vehicle!")
end) 

this should work, try it

If you tried changing the code i wont help you. I gave all possible directions. Aswell as try to install it again