- tabl = {
- siren = {},
- sirenler = {
- [0] = {}, -- boş
- [1] = { -- ambu
- {562,0, 0, 0.75,0.9, 327},
- {560,0, 0, 0.85,0.9, 327},
- {549, 0, 0, 0.77,1, 327},
- {541, 0, 0, 0.68,0.9, 327},
- {415, 0, -0.3, 0.65,0.8, 327},
- },
- [2] = { -- fbi
- {562, -0.5, 0, 0.8,1, 932},
- {560,-0.5, 0, 0.90,1, 932},
- {549, -0.5, 0, 0.75,1, 932},
- {541, -0.5, 0, 0.7,1, 932},
- {415, -0.3, -0.2, 0.65,1, 932},
- },
- [3] = { -- poli
- {562,0, 0, 0.75,0.9, 328},
- {560,0, 0, 0.85,0.85, 328},
- {549, 0, 0, 0.70,1, 328},
- {541, 0, 0, 0.60,0.8, 328},
- {415, 0, -0.3, 0.60,0.8, 328},
- },
- [4] = { -- poli bar
- {562,0, 0, 0.75,0.9, 1213},
- {560,0, 0, 0.85,0.85, 1213},
- {549, 0, 0, 0.70,1, 1213},
- {541, 0, 0, 0.60,0.8, 1213},
- {415, 0, -0.3, 0.60,0.8, 1213},
- },
- }
- }
- addEvent("setSiren", true)
- addEventHandler("setSiren", root,
- function(siren)
- local acc = getPlayerAccount(source)
- local veh = getPedOccupiedVehicle(source)
- if veh then
- if not isGuestAccount(acc) then
- if siren == 0 then
- if ( isElement ( tabl.siren[source]) ) then
- destroyElement(tabl.siren[source])
- callClientFunction(source,"createNotify","Siren sıfırlandı",255,0,0)
- end
- else
- if siren >= 1 then
- callClientFunction(source,"createNotify",siren..". Siren seçildi",0,255,0)
- setAccountData(acc,"setplayersiren",siren)
- sirenenter ()
- end
- end
- else
- callClientFunction(source,"createNotify","Giriş yapmalısın",255,0,0)
- cancelEvent()
- end
- else
- callClientFunction(source,"createNotify","Araçta değilsin.",255,0,0)
- cancelEvent()
- end
- end
- )
- function sirenenter ( veh, seat, jacked )
- local account = getPlayerAccount(source)
- if getAccountData(account,"setplayersiren_0") then
- setAccountData(account,"setplayersiren_0",true)
- end
- local veh = getPedOccupiedVehicle ( source )
- local id = tonumber(getAccountData(account,"setplayersiren")) or 0
- for i,v in pairs(tabl.sirenler[id]) do
- local vehid,x,y,z,size,sirenid = unpack(v)
- if ( getVehicleID ( veh ) == vehid ) then
- if ( isElement ( tabl.siren[source]) ) then
- destroyElement(tabl.siren[source])
- end
- tabl.siren[source] = createObject ( sirenid, 0,0,0 )
- setObjectScale ( tabl.siren[source],size)
- setElementCollisionsEnabled(tabl.siren[source], false)
- attachElements ( tabl.siren[source], veh, x,y,z )
- end
- end
- end
- addEventHandler ( "onPlayerVehicleEnter", getRootElement(), sirenenter )
- function sirenexit ( veh, seat, jacked )
- local account = getPlayerAccount(source)
- local id = tonumber(getAccountData(account,"setplayersiren")) or 0
- for i,v in pairs(tabl.sirenler[id]) do
- local vehid,x,y,z,sirenid = unpack(v)
- if ( getVehicleID ( veh ) == vehid ) then
- if ( isElement ( tabl.siren[source]) ) then
- destroyElement(tabl.siren[source])
- end
- end
- end
- end
- addEventHandler ( "onPlayerVehicleExit", getRootElement(), sirenexit)
- addEventHandler("onElementDestroy", getRootElement(), function ()
- if getElementType(source) == "vehicle" then
- local nPassengers = getVehicleMaxPassengers(source)
- for i=0,nPassengers-1 do
- local occupant = getVehicleOccupant(source, i)
- if occupant then
- if ( isElement (tabl.siren[source]) ) then
- destroyElement(tabl.siren[source])
- end
- end
- end
- end
- end)
- addEventHandler("onElementModelChange", getRootElement(), function ()
- if getElementType(source) == "vehicle" then
- local nPassengers = getVehicleMaxPassengers(source)
- for i=0,nPassengers-1 do
- local occupant = getVehicleOccupant(source, i)
- if occupant then
- for i,v in pairs(tabl.sirenler[id]) do
- local vehid,x,y,z,size,sirenid = unpack(v)
- if ( getVehicleID ( veh ) == vehid ) then
- if ( isElement ( tabl.siren[source]) ) then
- destroyElement(tabl.siren[source])
- end
- tabl.siren[source] = createObject ( sirenid, 0,0,0 )
- setObjectScale ( tabl.siren[source],size)
- setElementCollisionsEnabled(tabl.siren[source], false)
- attachElements ( tabl.siren[source], veh, x,y,z )
- end
- end
- end
- end
- end
- end)
- addEventHandler("onPlayerQuit",root,function()
- if ( isElement ( tabl.siren[source]) ) then
- destroyElement(tabl.siren[source])
- end
- end)
- function notifyAboutExplosion()
- if ( isElement ( tabl.siren[source]) ) then
- destroyElement(tabl.siren[source])
- end
- end
- addEventHandler("onVehicleExplode", getRootElement(), notifyAboutExplosion)