Advertisement
Guest User

Untitled

a guest
May 27th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.84 KB | None | 0 0
  1. local isRadarExtended = false
  2.  
  3. Citizen.CreateThread(function()
  4.  
  5.     while true do
  6.  
  7.         Wait( 1 )
  8.  
  9.         if IsControlJustPressed( 0, 20 ) then
  10.  
  11.             if not isRadarExtended then
  12.  
  13.                 SetRadarBigmapEnabled( true, false )
  14.                 isRadarExtended = true
  15.  
  16.                 Citizen.CreateThread(function()
  17.  
  18.                     run = true
  19.  
  20.                     while run do
  21.  
  22.                         for i = 0, 500 do
  23.  
  24.                             Wait(1)
  25.  
  26.                             if not isRadarExtended then
  27.  
  28.                                 run = false
  29.                                 break
  30.  
  31.                             end
  32.  
  33.                         end
  34.  
  35.                         SetRadarBigmapEnabled( false, false )
  36.                         isRadarExtended = false
  37.  
  38.                     end
  39.  
  40.                 end)
  41.  
  42.             else
  43.  
  44.                 SetRadarBigmapEnabled( false, false )
  45.                 isRadarExtended = false
  46.  
  47.             end
  48.  
  49.         end
  50.  
  51.         for id = 0, 64 do
  52.  
  53.             if NetworkIsPlayerActive( id ) and GetPlayerPed( id ) ~= GetPlayerPed( -1 ) then
  54.  
  55.                 ped = GetPlayerPed( id )
  56.                 blip = GetBlipFromEntity( ped )
  57.  
  58.  
  59.  
  60.                 headId = Citizen.InvokeNative( 0xBFEFE3321A3F5015, ped, GetPlayerName( id ), false, false, "", false )
  61.                 wantedLvl = GetPlayerWantedLevel( id )
  62.  
  63.    
  64.                 if wantedLvl then
  65.  
  66.                     Citizen.InvokeNative( 0x63BB75ABEDC1F6A0, headId, 7, true )
  67.                     Citizen.InvokeNative( 0xCF228E2AA03099C3, headId, wantedLvl )
  68.  
  69.                 else
  70.  
  71.                     Citizen.InvokeNative( 0x63BB75ABEDC1F6A0, headId, 7, false )
  72.  
  73.                 end
  74.  
  75.                 -- Speaking display
  76.                 if NetworkIsPlayerTalking( id ) then
  77.  
  78.                     Citizen.InvokeNative( 0x63BB75ABEDC1F6A0, headId, 9, true )
  79.  
  80.                 else
  81.  
  82.                     Citizen.InvokeNative( 0x63BB75ABEDC1F6A0, headId, 9, false )
  83.  
  84.                 end
  85.  
  86.                 -- BLIP STUFF --
  87.  
  88.                 if not DoesBlipExist( blip ) then
  89.  
  90.                     blip = AddBlipForEntity( ped )
  91.                     SetBlipSprite( blip, 1 )
  92.                     Citizen.InvokeNative( 0x5FBCA48327B914DF, blip, true )
  93.  
  94.                 else -- update blip
  95.  
  96.                     veh = GetVehiclePedIsIn( ped, false )
  97.                     blipSprite = GetBlipSprite( blip )
  98.  
  99.                     if not GetEntityHealth( ped ) then
  100.  
  101.                         if blipSprite ~= 274 then
  102.  
  103.                             SetBlipSprite( blip, 274 )
  104.                             Citizen.InvokeNative( 0x5FBCA48327B914DF, blip, false ) --
  105.  
  106.                         end
  107.  
  108.                     elseif veh then
  109.  
  110.                         vehClass = GetVehicleClass( veh )
  111.                         vehModel = GetEntityModel( veh )
  112.                        
  113.                         if vehClass == 15 then -- jet
  114.  
  115.                             if blipSprite ~= 422 then
  116.  
  117.                                 SetBlipSprite( blip, 422 )
  118.                                 Citizen.InvokeNative( 0x5FBCA48327B914DF, blip, false ) --
  119.  
  120.                             end
  121.  
  122.                         elseif vehClass == 16 then -- plane
  123.  
  124.                             if vehModel == GetHashKey( "besra" ) or vehModel == GetHashKey( "hydra" )
  125.                                 or vehModel == GetHashKey( "lazer" ) then -- jet
  126.  
  127.                                 if blipSprite ~= 424 then
  128.  
  129.                                     SetBlipSprite( blip, 424 )
  130.                                     Citizen.InvokeNative( 0x5FBCA48327B914DF, blip, false )
  131.  
  132.                                 end
  133.  
  134.                             elseif blipSprite ~= 423 then
  135.  
  136.                                 SetBlipSprite( blip, 423 )
  137.                                 Citizen.InvokeNative (0x5FBCA48327B914DF, blip, false )
  138.  
  139.                             end
  140.  
  141.                         elseif vehClass == 14 then -- boat
  142.  
  143.                             if blipSprite ~= 427 then
  144.  
  145.                                 SetBlipSprite( blip, 427 )
  146.                                 Citizen.InvokeNative( 0x5FBCA48327B914DF, blip, false )
  147.  
  148.                             end
  149.  
  150.                         elseif vehModel == GetHashKey( "insurgent" ) or vehModel == GetHashKey( "insurgent2" )
  151.                         or vehModel == GetHashKey( "limo2" ) then
  152.  
  153.                             if blipSprite ~= 426 then
  154.  
  155.                                 SetBlipSprite( blip, 426 )
  156.                                 Citizen.InvokeNative( 0x5FBCA48327B914DF, blip, false )
  157.  
  158.                             end
  159.  
  160.                         elseif vehModel == GetHashKey( "rhino" ) then
  161.  
  162.                             if blipSprite ~= 421 then
  163.  
  164.                                 SetBlipSprite( blip, 421 )
  165.                                 Citizen.InvokeNative( 0x5FBCA48327B914DF, blip, false )
  166.  
  167.                             end
  168.  
  169.                         elseif blipSprite ~= 1 then
  170.  
  171.                             SetBlipSprite( blip, 1 )
  172.                             Citizen.InvokeNative( 0x5FBCA48327B914DF, blip, true )
  173.  
  174.                         end
  175.  
  176.                    
  177.                         passengers = GetVehicleNumberOfPassengers( veh )
  178.  
  179.                         if passengers then
  180.  
  181.                             if not IsVehicleSeatFree( veh, -1 ) then
  182.  
  183.                                 passengers = passengers + 1
  184.  
  185.                             end
  186.  
  187.                             ShowNumberOnBlip( blip, passengers )
  188.  
  189.                         else
  190.  
  191.                             HideNumberOnBlip( blip )
  192.  
  193.                         end
  194.  
  195.                     else
  196.  
  197.                        
  198.                         HideNumberOnBlip( blip )
  199.  
  200.                         if blipSprite ~= 1 then
  201.  
  202.                             SetBlipSprite( blip, 1 )
  203.                             Citizen.InvokeNative( 0x5FBCA48327B914DF, blip, true )
  204.  
  205.                         end
  206.  
  207.                     end
  208.  
  209.                     SetBlipRotation( blip, math.ceil( GetEntityHeading( veh ) ) )
  210.                     SetBlipNameToPlayerName( blip, id )
  211.                     SetBlipScale( blip,  0.85 )
  212.                
  213.                     if IsPauseMenuActive() then
  214.  
  215.                         SetBlipAlpha( blip, 255 )
  216.  
  217.                     else
  218.  
  219.                         x1, y1 = table.unpack( GetEntityCoords( GetPlayerPed( -1 ), true ) )
  220.                         x2, y2 = table.unpack( GetEntityCoords( GetPlayerPed( id ), true ) )
  221.                         distance = ( math.floor( math.abs( math.sqrt( ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) ) ) / -1 ) ) + 900
  222.                        
  223.  
  224.                         if distance < 0 then
  225.  
  226.                             distance = 0
  227.  
  228.                         elseif distance > 255 then
  229.  
  230.                             distance = 255
  231.  
  232.                         end
  233.  
  234.                         SetBlipAlpha( blip, distance )
  235.  
  236.                     end
  237.  
  238.                 end
  239.  
  240.             end
  241.  
  242.         end
  243.  
  244.     end
  245.  
  246. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement