[RELEASE] Unrack and Rack simple reply script


#29

I will update this so it actually gives you the weapon


#30
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


#31

Class 18 is emergency vehicles right ?


#32

yeah

ahhhhh20charssss


#33

So all you did was to change some lines?


#34

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


#35

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


#36

Hmm okay, but idk what you mean with


#37

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


#38

I just changed the chatmessage for the busy people


#39

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


#40

post line 9 in server.lua


#41

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)
"


#42

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


#43

Did you edit the code?


#44

it works now thank you/


#45

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