• Print

Author Topic: Kill by an Alt Fire  (Read 8877 times)

0 Members and 1 Guest are viewing this topic.

Offline WispySkies

  • Full Member
  • ***
  • Posts: 144
  • Karma: 0
  • I make random commands and Lua errors.
Re: Kill by an Alt Fire
« Reply #15 on: November 12, 2015, 04:14:27 pm »
I added an invisibility system to hide you for 5 seconds to make it look like you did "die" so you can sneak away.

Code: Lua
  1. local CATEGORY_NAME = "Admin Suite"
  2.  
  3. function ulx.dissolve( ply )
  4.     if not ply:IsValid() then
  5.         Msg( "The console can only see the logs of the powerful world!\n" )
  6.         return
  7.     end
  8.  
  9.     if not ply:Alive() then
  10.         ULib.tsayError( ply, "You can't dissolve if you're dead!" )
  11.         return
  12.     end
  13.  
  14.     if ply:InVehicle() then
  15.         ply:ExitVehicle()
  16.     end
  17.  
  18.     ply:CreateRagdoll()
  19.     ply:GetRagdollEntity():SetKeyValue( "targetname", "cleanser_dissolve" )
  20.  
  21.     -- Dissolve ragdoll
  22.     local dissolver = ents.Create( "env_entity_dissolver" )
  23.     dissolver:Spawn()
  24.     dissolver:Activate()
  25.     dissolver:SetKeyValue( "target", "cleanser_dissolve" )
  26.     dissolver:SetKeyValue( "magnitude", 100 )
  27.     dissolver:SetKeyValue( "dissolvetype", 0 )
  28.     dissolver:Fire( "Dissolve" )
  29.     timer.Simple( 0.1, function() dissolver:Remove() end )
  30.  
  31.     ply:SetPos( ply:GetEyeTrace().HitPos + Vector( 0, 0, 32 ) )
  32.  
  33.     -- Evade being seen after dissolving.
  34.     ULib.invisible( ply, true )
  35.     timer.Simple( 5, function() ULib.invisible( ply, false ) end )
  36.  
  37.     ply:ChatPrint( "You have dissolved and jumped to your crosshair!" )
  38. end
  39. local dissolve = ulx.command( CATEGORY_NAME, "ulx dissolve", ulx.dissolve, "!dissolve" )
  40. dissolve:defaultAccess( ULib.ACCESS_SUPERADMIN )
  41. dissolve:help( "Jumps to your crosshair." )
  42.  
EDIT: Changed the color code to hide to ULib.invisible.
« Last Edit: November 13, 2015, 11:02:12 am by WispySkies »

Offline WispySkies

  • Full Member
  • ***
  • Posts: 144
  • Karma: 0
  • I make random commands and Lua errors.
Re: Kill by an Alt Fire
« Reply #16 on: November 13, 2015, 02:46:15 pm »
Odd, it doesn't look like I'm missing anything?
[ERROR] addons/ulx/lua/ulx/modules/sh/tpdissolve.lua:31: function arguments expected near '.'
  1. unknown - addons/ulx/lua/ulx/modules/sh/tpdissolve.lua:0


Code: Lua
  1. local CATEGORY_NAME = "Admin Suite"
  2.  
  3. function ulx.dissolve( ply )
  4.     if not ply:IsValid() then
  5.         Msg( "The console can only see the logs of the powerful world!\n" )
  6.         return
  7.     end
  8.  
  9.     if not ply:Alive() then
  10.         ULib.tsayError( ply, "You can't dissolve if you're dead!" )
  11.         return
  12.     end
  13.  
  14.     if ply:InVehicle() then
  15.         ply:ExitVehicle()
  16.     end
  17.  
  18.     ply:CreateRagdoll()
  19.     ply:GetRagdollEntity():SetKeyValue( "targetname", "cleanser_dissolve" )
  20.  
  21.     -- Dissolve ragdoll
  22.     local dissolver = ents.Create( "env_entity_dissolver" )
  23.     dissolver:Spawn()
  24.     dissolver:Activate()
  25.     dissolver:SetKeyValue( "target", "cleanser_dissolve" )
  26.     dissolver:SetKeyValue( "magnitude", 100 )
  27.     dissolver:SetKeyValue( "dissolvetype", 0 )
  28.     dissolver:Fire( "Dissolve" )
  29.     timer.Simple( 0.1, function() dissolver:Remove() end )
  30.  
  31.     ply:SetPos( ply:GetEyeTrace.HitPos + Vector( 0, 0, 32 ) )
  32.  
  33.     -- Evade being seen after dissolving.
  34.     ULib.invisible( ply, true )
  35.     timer.Simple( 5, function() ULib.invisible( ply, false ) end )
  36.  
  37.     ply:ChatPrint( "You have dissolved and jumped to your crosshair!" )
  38. end
  39. local dissolve = ulx.command( CATEGORY_NAME, "ulx dissolve", ulx.dissolve, "!dissolve" )
  40. dissolve:defaultAccess( ULib.ACCESS_SUPERADMIN )
  41. dissolve:help( "Jumps to your crosshair." )
  42.  
  43.  
Edit: Whoops! Forgot a (), ply:SetPos( ply:GetEyeTrace().HitPos + Vector( 0, 0, 32 ) )
« Last Edit: November 13, 2015, 02:48:20 pm by WispySkies »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Kill by an Alt Fire
« Reply #17 on: November 13, 2015, 02:52:03 pm »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline WispySkies

  • Full Member
  • ***
  • Posts: 144
  • Karma: 0
  • I make random commands and Lua errors.
Re: Kill by an Alt Fire
« Reply #18 on: November 13, 2015, 02:52:21 pm »
About the edit, the ragdoll is generated at the player and the ULib.invisible affects it even if its before the code for the invisibility?



Edit:
Quack Quack
Alright let me find one :D

  • Print