Advertisement
Guest User

Wasted Script (from Multiplayer in LUA)

a guest
Jun 1st, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.53 KB | None | 0 0
  1. AddEventHandler('onClientMapStart', function()
  2.     exports.spawnmanager:spawnPlayer()
  3.     Wait(5000)
  4.     exports.spawnmanager:setAutoSpawn(false)
  5. end)
  6.  
  7. CreateThread(function()
  8.     local scaleform, X, Y, W; H = 0.0125
  9.     local CheckPoint
  10.    
  11.     RequestScriptAudioBank('MP_WASTED', 0)
  12.    
  13.     while true do
  14.         Wait(0)
  15.        
  16.         if not HasNamedScaleformMovieLoaded('MP_BIG_MESSAGE_FREEMODE') then
  17.             scaleform = RequestScaleformMovie('MP_BIG_MESSAGE_FREEMODE')
  18.             while not HasNamedScaleformMovieLoaded('MP_BIG_MESSAGE_FREEMODE') do
  19.                 Wait(0)
  20.             end
  21.         end
  22.        
  23.         if not HasStreamedTextureDictLoaded('timerbars') then
  24.             RequestStreamedTextureDict('timerbars')
  25.             while not HasStreamedTextureDictLoaded('timerbars') do
  26.                 Wait(0)
  27.             end
  28.         end
  29.        
  30.         if IsPlayerDead(PlayerId()) then
  31.             ClearHelp(1)
  32.            
  33.             local PedKiller = GetPedSourceOfDeath(PlayerPedId()); DeathCauseHash = GetPedCauseOfDeath(PlayerPedId()); Hidden = false
  34.             local Killer, DeathReasonVictim, DeathReasonOthers, DeathReasonKiller, INT
  35.  
  36.             if IsEntityAPed(PedKiller) and IsPedAPlayer(PedKiller) then
  37.                 Killer = NetworkGetPlayerIndexFromPed(PedKiller)
  38.             elseif IsEntityAVehicle(PedKiller) and IsEntityAPed(GetPedInVehicleSeat(PedKiller, -1)) and IsPedAPlayer(GetPedInVehicleSeat(PedKiller, -1)) then
  39.                 Killer = NetworkGetPlayerIndexFromPed(GetPedInVehicleSeat(PedKiller, -1))
  40.             end
  41.            
  42.             if (Killer == PlayerId()) then
  43.                 DeathReasonVictim = 'DM_U_SUIC'
  44.                 DeathReasonOthers = 'DM_O_SUIC'
  45.             elseif (Killer == nil) then
  46.                 DeathReasonVictim = 'DM_TK_YD1'
  47.                 DeathReasonOthers = 'TICK_DIED'
  48.             else
  49.                 DeathReasonKiller, DeathReasonVictim, DeathReasonOthers = GetReason()
  50.             end
  51.            
  52.             if N_0x35fb78dc42b7bd21() then
  53.                 StartScreenEffect('DeathFailMPDark', 0, 0)
  54.             else
  55.                 StartScreenEffect('DeathFailMPIn', 0, 0)
  56.             end
  57.             SetCamEffect(1)
  58.            
  59.             TriggerServerEvent(GetCurrentResourceName() .. ':SendDeathMessage', PlayerId(), Killer, DeathReasonVictim, DeathReasonOthers, DeathReasonKiller)
  60.            
  61.             Wait(750)
  62.            
  63.             PlaySoundFrontend(-1, 'MP_Flash', 'WastedSounds', 1)
  64.  
  65.             PushScaleformMovieFunction(scaleform, 'SHOW_SHARD_WASTED_MP_MESSAGE')
  66.             PushScaleformMovieFunctionParameterString(GetLabelText('RESPAWN_W'))
  67.             if DeathReasonVictim ~= 'DM_TK_YD1' then
  68.                 PushScaleformMovieFunctionParameterString(GetLabelText(DeathReasonVictim):gsub('~a~', '~bold~' .. GetPlayerName(Killer) .. '~bold~'))
  69.             end
  70.             PopScaleformMovieFunctionVoid()
  71.            
  72.             local timer = GetGameTimer()
  73.                
  74.             while IsPlayerDead(PlayerId()) do
  75.                 Wait(0)
  76.  
  77.                 DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255)
  78.                
  79.                 if Killer and Killer ~= PlayerId() then
  80.                     local ScaleformMovie = RequestScaleformMovie('instructional_buttons')
  81.                     DrawScaleformMovieFullscreen(ScaleformMovie, 255, 255, 255, 0)
  82.                     PushScaleformMovieFunction(ScaleformMovie, 'CLEAR_ALL')
  83.                     PopScaleformMovieFunctionVoid()
  84.                     PushScaleformMovieFunction(ScaleformMovie, 'SET_CLEAR_SPACE')
  85.                     PushScaleformMovieFunctionParameterInt(200)
  86.                     PopScaleformMovieFunctionVoid()
  87.                    
  88.                     PushScaleformMovieFunction(ScaleformMovie, 'SET_DATA_SLOT')
  89.                     PushScaleformMovieFunctionParameterInt(0)
  90.                     if GetLastInputMethod(2) then
  91.                         PushScaleformMovieFunctionParameterInt(100)
  92.                     else
  93.                         PushScaleformMovieFunctionParameterInt(30)
  94.                     end
  95.                     BeginTextCommandScaleformString('STRING')
  96.                     AddTextComponentScaleform(GetLabelText('HUD_INPUT97'))
  97.                     EndTextCommandScaleformString()
  98.                     PopScaleformMovieFunctionVoid()
  99.  
  100.                     PushScaleformMovieFunction(ScaleformMovie, 'DRAW_INSTRUCTIONAL_BUTTONS')
  101.                     PopScaleformMovieFunctionVoid()
  102.                     PushScaleformMovieFunction(ScaleformMovie, 'SET_BACKGROUND_COLOUR')
  103.                     PushScaleformMovieFunctionParameterInt(0)
  104.                     PushScaleformMovieFunctionParameterInt(0)
  105.                     PushScaleformMovieFunctionParameterInt(0)
  106.                     PushScaleformMovieFunctionParameterInt(60)
  107.                     PopScaleformMovieFunctionVoid()
  108.  
  109.                     if ((GetLastInputMethod(2) and (IsControlJustPressed(1, 24) or IsDisabledControlJustPressed(1, 24))) or (not GetLastInputMethod(2) and
  110.                        (IsControlJustPressed(1, 21) or IsDisabledControlJustPressed(1, 21)))) and GetTimeDifference(GetGameTimer(), timer) < 9500 then
  111.                         PlaySoundFrontend(-1, 'Faster_Click', 'RESPAWN_ONLINE_SOUNDSET', 1)
  112.                         timer = GetTimeDifference(timer, 500)
  113.                     end
  114.  
  115.                     if GetTimeDifference(GetGameTimer(), timer) < 10000 then
  116.                         W = (GetTimeDifference(GetGameTimer(), timer) * (0.085 / 10000))
  117.                     end
  118.                    
  119.                     local correction = ((1.0 - round(GetSafeZoneSize(), 2)) * 100) * 0.005
  120.                     X, Y = 0.9155 - correction, 0.94 - correction
  121.                    
  122.                     Set_2dLayer(0)
  123.                     DrawSprite('timerbars', 'all_black_bg', X, Y, 0.15, 0.030, 0.0, 255, 255, 255, 180)
  124.                    
  125.                     Set_2dLayer(1)
  126.                     DrawRect(X + 0.0275, Y, 0.085, 0.012, 100, 0, 0, 180)
  127.                    
  128.                     Set_2dLayer(2)
  129.                     DrawRect(X - 0.015 + (W / 2), Y, W, H, 150, 0, 0, 180)
  130.                    
  131.                     SetTextColour(255, 255, 255, 180)
  132.                     SetTextFont(0)
  133.                     SetTextScale(0.3, 0.3)
  134.                     SetTextCentre(true)
  135.                     SetTextEntry('STRING')
  136.                     AddTextComponentString(GetLabelText('KS_RESPAWN_B'))
  137.                     Set_2dLayer(3)
  138.                     DrawText(X - 0.06, Y - 0.012)
  139.                    
  140.                     if GetTimeDifference(GetGameTimer(), timer) >= 1000 then
  141.                         if IsEntityAPed(PedKiller) and IsPedAPlayer(PedKiller) then
  142.                             local RaycastToKiller = StartShapeTestRay(GetEntityCoords(PlayerPedId(), false), GetEntityCoords(PedKiller, false), -1, PlayerPedId(), 0)
  143.                             local Int, Hit, EndCoords, SurfaceNormal, EntityHit = GetShapeTestResult(RaycastToKiller)
  144.                             if not Hidden and (not Hit or (Hit and EntityHit == PedKiller)) then
  145.                                 if NetworkIsInSpectatorMode() then
  146.                                     for i = 0, 31 do
  147.                                         EnableAllControlActions(i)
  148.                                     end
  149.                                     SetCamEffect(0)
  150.                                     NetworkSetOverrideSpectatorMode(false)
  151.                                     NetworkSetInSpectatorMode(false, PedKiller)
  152.                                     SetCinematicModeActive(false)
  153.                                     SetFocusEntity(PlayerPedId())
  154.                                 end
  155.                                 if IsPedInAnyVehicle(PedKiller) then
  156.                                     SetGameplayPedHint(GetVehiclePedIsIn(PedKiller, false), 0.0, 0.0, 0.0, true, -1, 2000, 2000)
  157.                                 else
  158.                                     SetGameplayPedHint(PedKiller, 0.0, 0.0, 0.0, true, -1, 2000, 2000)
  159.                                 end
  160.                             else
  161.                                 Hidden = true
  162.                                 if IsGameplayHintActive() then
  163.                                     DoScreenFadeOut(500)
  164.                                     StopGameplayHint(0)
  165.                                     DoScreenFadeIn(500)
  166.                                 end
  167.                                 for i = 0, 31 do
  168.                                     DisableAllControlActions(i)
  169.                                 end
  170.                                 SetCamEffect(2)
  171.                                 NetworkSetOverrideSpectatorMode(true)
  172.                                 NetworkSetInSpectatorMode(true, PedKiller)
  173.                                 SetCinematicModeActive(true)
  174.                                 SetFocusEntity(PedKiller)
  175.                             end
  176.                         end
  177.                     end
  178.                    
  179.  
  180.                     if GetTimeDifference(GetGameTimer(), timer) >= 10000 then
  181.                         exports.spawnmanager:spawnPlayer()
  182.                         PlaySoundFrontend(-1, 'Faster_Bar_Full', 'RESPAWN_ONLINE_SOUNDSET', 1)
  183.                     end
  184.                 else
  185.                     if GetTimeDifference(GetGameTimer(), timer) >= 3500 then
  186.                         exports.spawnmanager:spawnPlayer()
  187.                     end
  188.                 end
  189.             end
  190.            
  191.             if GetScreenEffectIsActive('DeathFailMPDark') then
  192.                 StopScreenEffect('DeathFailMPDark')
  193.             elseif GetScreenEffectIsActive('DeathFailMPIn') then
  194.                 StopScreenEffect('DeathFailMPIn')
  195.             end
  196.             if IsGameplayCamShaking() then
  197.                 StopGameplayCamShaking(true)
  198.             end
  199.             if NetworkIsInSpectatorMode() then
  200.                 for i = 0, 31 do
  201.                     EnableAllControlActions(i)
  202.                 end
  203.                 NetworkSetOverrideSpectatorMode(false)
  204.                 NetworkSetInSpectatorMode(false, PedKiller)
  205.                 SetCinematicModeActive(false)
  206.             end
  207.             if IsGameplayHintActive() then
  208.                 StopGameplayHint(0)
  209.             end
  210.         end
  211.     end
  212. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement