daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Jan 29th, 2018 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local Keys = {
  2.     ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
  3.     ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
  4.     ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
  5.     ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
  6.     ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
  7.     ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
  8.     ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
  9.     ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
  10.     ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
  11. }
  12.  
  13. local lang = 'en'
  14.  
  15. local txt = {
  16.   ['fr'] = {
  17.         ['inComa'] = '~r~Vous êtes dans le coma',
  18.         ['accident'] = 'Un accident s\'est produit',
  19.         ['murder'] = 'Tentative de meurtre',
  20.         ['ambIsComming'] = 'Une ~b~ambulance~s~ est en route !',
  21.         ['res'] = 'Vous avez été réanimé',
  22.         ['ko'] = 'Vous êtes KO !',
  23.         ['callAmb'] = 'Appuyez sur ~g~E~s~ pour appeler une ambulance',
  24.         ['respawn'] = 'Appuyez sur ~r~X~s~ pour respawn',
  25.         ['youCallAmb'] = 'Vous avez appelé une ~b~ambulance~s~'
  26.   },
  27.  
  28.     ['en'] = {
  29.         ['inComa'] = '~r~Jste v komatu',
  30.         ['accident'] = 'Doslo k nehode',
  31.         ['murder'] = 'Pokus o vrazdu.',
  32.         ['ko'] = 'Dostal jsi KO !'
  33.     }
  34. }
  35.  
  36. local isDead = false
  37. local isKO = false
  38. local emergencyComes = false
  39.  
  40. --[[
  41. ################################
  42.             THREADS
  43. ################################
  44. --]]
  45.  
  46. Citizen.CreateThread(function()
  47.   while true do
  48.     Citizen.Wait(1)
  49.     --NetworkResurrectLocalPlayer(357.757, -597.202, 28.6314, true, true, false)
  50.     local playerPed = GetPlayerPed(-1)
  51.     local playerID = PlayerId()
  52.     local currentPos = GetEntityCoords(playerPed, true)
  53.     local previousPos
  54.  
  55.     isDead = IsEntityDead(playerPed)
  56.  
  57.     if isKO and previousPos ~= currentPos then
  58.       isKO = false
  59.     end
  60.  
  61.     if (GetEntityHealth(playerPed) < 120 and not isDead and not isKO) then
  62.       if (IsPedInMeleeCombat(playerPed)) then
  63.         SetPlayerKO(playerID, playerPed)
  64.       end
  65.     end
  66.  
  67.     previousPos = currentPos
  68.   end
  69. end)
  70.  
  71. Citizen.CreateThread(function()
  72.     while true do
  73.         Citizen.Wait(0)
  74.     if IsEntityDead(PlayerPedId()) then
  75.             StartScreenEffect("DeathFailOut", 0, 0)
  76.         ShakeGameplayCam("DEATH_FAIL_IN_EFFECT_SHAKE", 1.0)
  77.         local scaleform = RequestScaleformMovie("MP_BIG_MESSAGE_FREEMODE")
  78.         while not(HasScaleformMovieLoaded(scaleform)) do
  79.             Citizen.Wait(0)
  80.         end
  81.         PushScaleformMovieFunction(scaleform, "SHOW_SHARD_WASTED_MP_MESSAGE")
  82.         BeginTextComponent("STRING")
  83.         AddTextComponentString(txt[lang]['inComa'])
  84.         EndTextComponent()
  85.         PopScaleformMovieFunctionVoid()
  86.         Citizen.Wait(500)
  87.         while IsEntityDead(PlayerPedId()) do
  88.             Citizen.Wait(0)
  89.             DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255)
  90.         end
  91.         StopScreenEffect("DeathFailOut")
  92.     end
  93. end)
  94.  
  95. --[[
  96. ################################
  97.             EVENTS
  98. ################################
  99. --]]
  100.  
  101. -- Triggered when player died by environment
  102. AddEventHandler('baseevents:onPlayerDied',
  103.   function(playerId, reasonID)
  104.     local reason = txt[lang]['accident']
  105.         return
  106.     end
  107. )
  108.  
  109. -- Triggered when player died by an another player
  110. AddEventHandler('baseevents:onPlayerKilled',
  111.   function(playerId, playerKill, reasonID)
  112.     local reason = txt[lang]['murder']
  113.         return
  114.     end
  115. )
  116.  
  117.  
  118. --[[
  119. ################################
  120.         BUSINESS METHODS
  121. ################################
  122. --]]
  123.  
  124. function SetPlayerKO(playerID, playerPed)
  125.   isKO = true
  126.   SendNotification(txt[lang]['ko'])
  127.   SetPedToRagdoll(playerPed, 6000, 6000, 0, 0, 0, 0)
  128. end
  129.  
  130. function SendNotification(message)
  131.   SetNotificationTextEntry('STRING')
  132.   AddTextComponentString(message)
  133.   DrawNotification(false, false)
  134. end
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top