Radbug
29
so…
client:
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
-- if player hits 'LCTRL + 2' - set police car to code 2
if IsControlPressed(0, Keys['LEFTCTRL']) and IsControlJustPressed(0, Keys['2']) then
local ped = PlayerPedId()
local vehicle = GetVehiclePedIsIn(ped, false)
local class = GetVehicleClass(vehicle)
if vehicle ~= 0 then
if class == 18 then
TriggerServerEvent('codeTwo', vehicle)
ShowNotification("You've entered ~y~code two~w~.")
end
end
end
end
end)
-- code two --
RegisterNetEvent('codeTwo')
AddEventHandler('codeTwo', function(vehicle)
SetVehicleSiren(vehicle, true)
DisableVehicleImpactExplosionActivation(vehicle, true)
end)
--------------
server:
RegisterServerEvent('codeTwo')
AddEventHandler('codeTwo', function(vehicle)
local players = GetPlayers()
for _,player in pairs(players) do
TriggerClientEvent('codeTwo', player, vehicle)
--print("sent to player: " .. player)
end
end)
(edited to move notification to just the client who presses the key)