Jump to content

Custom sirens problem


Recommended Posts

Hey guys, today I made custom sirens for police cars, but my problem is that I don't know how to attach it to all police cars, not a specified one. I made something like that (I think), but it's not working. Heres my code:

function policeSirens( ) 
    local occveh = getPedOccupiedVehicle ( localPlayer ) 
    local id = getElementModel ( theVehicle ) 
    if id == 596 or id == 597 then 
        setVehicleSirens ( occveh, 7, -0.800, -2.849, 0.050, 60, 118, 224, 255, 255 ) 
        addVehicleSirens ( occveh, 7, 3, true, false, true, false )  
    end 
end 

So how can I attach these sirens to all police cars with id 596 and 597? I hope someone could help me in this, I would be grateful. Thank you!

Link to comment
  • Moderators

client

-- client -- 
function policeSirens( ) 
    local occveh = getPedOccupiedVehicle ( localPlayer ) 
    if occveh then 
        local id = getElementModel ( occveh ) -- theVehicle 
        if id == 596 or id == 597 then 
            triggerServerEvent("vehicleSirens",occveh) 
        end 
    end 
end 
  

server

-- server -- 
addEvent("vehicleSirens",true) 
addEventHandler("vehicleSirens",root, 
function () 
    if isElement(source) then 
        setVehicleSirens ( source, 7, -0.800, -2.849, 0.050, 60, 118, 224, 255, 255 ) 
        addVehicleSirens ( source, 7, 3, true, false, true, false )  
    end 
end) 

@Dzsozi

There are warnings. /debugscript 3 to see them.

And next time put them at your post.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...