Facebook
From Botched Kangaroo, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 47
  1. tabl = {
  2. siren = {},
  3. sirenler = {
  4.  
  5.         [0] = {}, -- boş
  6.                        
  7.         [1] = { -- ambu
  8.                                
  9.                                 {562,0, 0, 0.75,0.9, 327},
  10.                                 {560,0, 0, 0.85,0.9, 327},
  11.                                 {549, 0, 0, 0.77,1, 327},
  12.                                 {541, 0, 0, 0.68,0.9, 327},
  13.                                 {415, 0, -0.3, 0.65,0.8, 327},
  14.  
  15.                         },
  16.         [2] = { -- fbi
  17.                                 {562, -0.5, 0, 0.8,1, 932},
  18.                                 {560,-0.5, 0, 0.90,1, 932},
  19.                                 {549, -0.5, 0, 0.75,1, 932},
  20.                                 {541, -0.5, 0, 0.7,1, 932},
  21.                                 {415, -0.3, -0.2, 0.65,1, 932},
  22.                         },
  23.         [3] = { -- poli
  24.                                 {562,0, 0, 0.75,0.9, 328},
  25.                                 {560,0, 0, 0.85,0.85, 328},
  26.                                 {549, 0, 0, 0.70,1, 328},
  27.                                 {541, 0, 0, 0.60,0.8, 328},
  28.                                 {415, 0, -0.3, 0.60,0.8, 328},
  29.                         },
  30.         [4] = { -- poli bar
  31.                                 {562,0, 0, 0.75,0.9, 1213},
  32.                                 {560,0, 0, 0.85,0.85, 1213},
  33.                                 {549, 0, 0, 0.70,1, 1213},
  34.                                 {541, 0, 0, 0.60,0.8, 1213},
  35.                                 {415, 0, -0.3, 0.60,0.8, 1213},
  36.                         },
  37.  
  38. }
  39. }
  40.  
  41. addEvent("setSiren", true)
  42. addEventHandler("setSiren", root,
  43. function(siren)
  44.         local acc = getPlayerAccount(source)
  45.         local veh = getPedOccupiedVehicle(source)
  46.         if veh then
  47.         if not isGuestAccount(acc) then
  48.         if siren == 0 then
  49.         if ( isElement ( tabl.siren[source]) ) then
  50.                 destroyElement(tabl.siren[source])
  51.                 callClientFunction(source,"createNotify","Siren sıfırlandı",255,0,0)
  52.         end
  53.         else
  54.         if siren >= 1 then                                                
  55.         callClientFunction(source,"createNotify",siren..". Siren seçildi",0,255,0)
  56.         setAccountData(acc,"setplayersiren",siren)
  57.         sirenenter ()
  58.         end
  59.         end
  60.         else
  61.         callClientFunction(source,"createNotify","Giriş yapmalısın",255,0,0)
  62.         cancelEvent()
  63.         end
  64.         else
  65.         callClientFunction(source,"createNotify","Araçta değilsin.",255,0,0)
  66.         cancelEvent()
  67.         end
  68. end
  69. )
  70.  
  71. function sirenenter ( veh, seat, jacked )
  72.         local account = getPlayerAccount(source)
  73.         if getAccountData(account,"setplayersiren_0") then
  74.         setAccountData(account,"setplayersiren_0",true)
  75.         end
  76.         local veh = getPedOccupiedVehicle ( source )
  77.         local id = tonumber(getAccountData(account,"setplayersiren")) or 0
  78.         for i,v in pairs(tabl.sirenler[id]) do
  79.         local vehid,x,y,z,size,sirenid = unpack(v)
  80.         if ( getVehicleID ( veh ) == vehid ) then
  81.         if ( isElement ( tabl.siren[source]) ) then
  82.         destroyElement(tabl.siren[source])
  83.         end
  84.     tabl.siren[source] = createObject ( sirenid, 0,0,0 )
  85.         setObjectScale ( tabl.siren[source],size)
  86.         setElementCollisionsEnabled(tabl.siren[source], false)
  87.     attachElements ( tabl.siren[source], veh, x,y,z )
  88.         end
  89. end
  90. end
  91. addEventHandler ( "onPlayerVehicleEnter", getRootElement(), sirenenter )
  92.  
  93. function sirenexit ( veh, seat, jacked )
  94.         local account = getPlayerAccount(source)
  95.         local id = tonumber(getAccountData(account,"setplayersiren")) or 0
  96.         for i,v in pairs(tabl.sirenler[id]) do
  97.         local vehid,x,y,z,sirenid = unpack(v)
  98.         if ( getVehicleID ( veh ) == vehid ) then
  99.         if ( isElement ( tabl.siren[source]) ) then
  100.         destroyElement(tabl.siren[source])
  101.         end
  102.         end
  103. end
  104. end
  105. addEventHandler ( "onPlayerVehicleExit", getRootElement(), sirenexit)
  106.  
  107. addEventHandler("onElementDestroy", getRootElement(), function ()
  108.   if getElementType(source) == "vehicle" then
  109.     local nPassengers = getVehicleMaxPassengers(source)
  110.     for i=0,nPassengers-1 do
  111.       local occupant = getVehicleOccupant(source, i)
  112.       if occupant then
  113.                 if ( isElement (tabl.siren[source]) ) then
  114.                 destroyElement(tabl.siren[source])
  115.                 end    
  116.       end
  117.     end
  118.   end
  119. end)
  120.  
  121. addEventHandler("onElementModelChange", getRootElement(), function ()
  122.   if getElementType(source) == "vehicle" then
  123.     local nPassengers = getVehicleMaxPassengers(source)
  124.     for i=0,nPassengers-1 do
  125.       local occupant = getVehicleOccupant(source, i)
  126.       if occupant then
  127.                 for i,v in pairs(tabl.sirenler[id]) do
  128.                         local vehid,x,y,z,size,sirenid = unpack(v)
  129.        
  130.                         if ( getVehicleID ( veh ) == vehid ) then
  131.                         if ( isElement ( tabl.siren[source]) ) then
  132.                         destroyElement(tabl.siren[source])
  133.                         end
  134.                         tabl.siren[source] = createObject ( sirenid, 0,0,0 )
  135.                         setObjectScale ( tabl.siren[source],size)
  136.                         setElementCollisionsEnabled(tabl.siren[source], false)
  137.                         attachElements ( tabl.siren[source], veh, x,y,z )
  138.                         end
  139.                 end
  140.       end
  141.     end
  142.   end
  143. end)
  144.  
  145. addEventHandler("onPlayerQuit",root,function()
  146.         if ( isElement ( tabl.siren[source]) ) then
  147.                 destroyElement(tabl.siren[source])
  148.         end    
  149. end)
  150.  
  151. function notifyAboutExplosion()
  152.         if ( isElement ( tabl.siren[source]) ) then
  153.                 destroyElement(tabl.siren[source])
  154.         end    
  155. end
  156. addEventHandler("onVehicleExplode", getRootElement(), notifyAboutExplosion)