[Solved] Keybinding to Chat Command

help

#1

Since we aren’t able to use any Key on the Keyboard I am trying to change some Keybindings to chat commands.

Looks like I might have to change some “IsControlJustPressed” to “RegisterCommand(’****’, function(source, args, rawCommand)” if that is possible.
But how exactly do I have to do this?
I haven’t found anything on the Forums, so I’m not even sure it’s possible.

Can anyone a bit more experienced help?


#2
Citizen.CreateThread(function()
	while true do
		Wait(0)
		if IsControlJustReleased(0, 47) then
			if GetVehicleDoorLockStatus(vehicle) == 1 then
				SetVehicleDoorsLocked(vehicle, 2)
				exports.pNotify:SendNotification({text = "<font color='#fc5044'>Vehicle Locked"})
			elseif GetVehicleDoorLockStatus(vehicle) == 2 then
				SetVehicleDoorsLocked(vehicle, 1)
				exports.pNotify:SendNotification({text = "<font color='lightgreen'>Vehicle Unlocked"})
			end
		end
	end
end)


RegisterCommand('lock', function(source, args, rawCommand)
	if GetVehicleDoorLockStatus(vehicle) == 1 then
		SetVehicleDoorsLocked(vehicle, 2)
		exports.pNotify:SendNotification({text = "<font color='#fc5044'>Vehicle Locked"})
	elseif GetVehicleDoorLockStatus(vehicle) == 2 then
		SetVehicleDoorsLocked(vehicle, 1)
		exports.pNotify:SendNotification({text = "<font color='lightgreen'>Vehicle Unlocked"})
	end
end)

This is a very basic example on what you would have to do.


#3

You Sir are a ture gentleman!
Works fine!