SHARE
TWEET

fiveM delete entity gun

a guest Jun 19th, 2017 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Citizen.CreateThread(function()
  2.  local dude5 = PlayerId()
  3.  local dude6 = IsPlayerFreeAiming(dude5)
  4.  local deleteKey = IsControlJustReleased(0, 214)
  5.  
  6.  local deleteTog = false
  7.  
  8.    while true do
  9.      if dude6 ~=false then
  10.       if dude6 ~=false and deleteKey ~=false then
  11.         deleteTog = true
  12.        countDown = 0
  13.       end
  14.      end
  15.      countDown = countDown+1
  16.       if countDown >=5000 then
  17.           countDown = nil
  18.         deleteTog = false
  19.       end
  20.     end  
  21.  while true do    
  22.     if dude6 ~=false and countDown <=5000 then  
  23.        TriggerEvent("fs_freeroam:displaytext", "DELETE GUN ACTIVATED.", 5000)    
  24.      Wait(0)
  25.      --this native is *BOOL* GET_ENTITY_PLAYER_IS_FREE_AIMING_AT(Player, Entity)
  26.     dude10 = Citizen.InvokeNative(0x2975C866E6713290, dude5, Citizen.PointerValueInt(), Citizen.ResultAsString(dude10))
  27.     dude12 = GetEntityModel(dude10)
  28.     dude16 = GetEntityCoords(dude10)
  29.     --Citizen.Trace("is mission entity: "..tostring(isMission))
  30.     Citizen.Trace("is a ped: "..tostring(isPed))
  31.     Citizen.Trace("is an obj: "..tostring(isAnObj))
  32.     Citizen.Trace("is a veh: "..tostring(isVeh))
  33.     Citizen.Trace("object_to_net: "..tostring(object_to_net))
  34.       isMission = IsEntityAMissionEntity(dude10)
  35.       isPed = IsEntityAPed(dude10)
  36.       isAnObj = IsEntityAnObject(dude10)
  37.       isVeh = IsEntityAVehicle(dude10)
  38.       object_to_net = ObjToNet(dude10)
  39.         if isMission ~=0 then
  40.             SetEntityAsMissionEntity(dude10, true, true)
  41.              --SetEntityAsNoLongerNeeded(dude10)
  42.               if isPed ~=false then
  43.               dude10 = Citizen.InvokeNative(0x2975C866E6713290, dude5, Citizen.PointerValueInt(), Citizen.ResultAsString(dude10))
  44.               isMission = IsEntityAMissionEntity(dude10)
  45.                SetEntityAsMissionEntity(dude10, true, true)
  46.                 --DeletePed(dude10)
  47.                 DeleteEntity(dude10)
  48.                  SetModelAsNoLongerNeeded(dude12)
  49.               end
  50.               if isVeh ~=false then
  51.               dude10 = Citizen.InvokeNative(0x2975C866E6713290, dude5, Citizen.PointerValueInt(), Citizen.ResultAsString(dude10))
  52.               isMission = IsEntityAMissionEntity(dude10)
  53.                SetEntityAsMissionEntity(dude10, true, true)
  54.                 DeleteVehicle(dude10)
  55.                 DeleteEntity(dude10)
  56.                  SetModelAsNoLongerNeeded(dude12)
  57.               end
  58.               if isAnObj ~=false then
  59.               dude10 = Citizen.InvokeNative(0x2975C866E6713290, dude5, Citizen.PointerValueInt(), Citizen.ResultAsString(dude10))
  60.               isMission = IsEntityAMissionEntity(dude10)
  61.                SetEntityAsMissionEntity(dude10, true, true)
  62.                 --DeletePed(dude10)
  63.                 DeleteEntity(dude10)
  64.                  SetModelAsNoLongerNeeded(dude12)
  65.                Citizen.Trace("tv ID: "..tostring(tv))
  66.                Citizen.Trace("is mission entity: "..tostring(isMission))
  67.                Citizen.Trace("get entity player is aiming at: "..dude10)
  68.                 SetModelAsNoLongerNeeded(dude12)
  69.                  SetEntityAsNoLongerNeeded(dude10)
  70.                   SetObjectAsNoLongerNeeded(dude10)
  71.                    Citizen.InvokeNative(0x539E0AE3E6634B9F, Citizen.PointerValueIntInitialized(tv))
  72.                     Citizen.InvokeNative(0x539E0AE3E6634B9F, Citizen.PointerValueIntInitialized(tv))
  73.               end        
  74.         end    
  75.      end
  76. end
  77. end)
RAW Paste Data
Top