Advertisement
sethxi

Untitled

Apr 7th, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.65 KB | None | 0 0
  1.  
  2. SWEP.DrawWeaponInfoBox = true
  3. SWEP.Author         = "Sethxi"
  4. SWEP.Contact        = "Steam Profile"
  5. SWEP.Purpose        = "Do console commands to players you look at!"
  6. SWEP.Instructions   = "'godstick' in console\nMouse1: Do action on player you're looking at\nMouse2: Do action on yourself\nReload: Open command menu"
  7.  
  8. SWEP.Category           = "Sethxi"
  9. SWEP.Spawnable          = true
  10. SWEP.AdminSpawnable     = true
  11.  
  12. SWEP.AnimPrefix = "stunstick"
  13. SWEP.NextStrike = 0
  14. SWEP.HoldType = "ar2"
  15.  
  16. SWEP.IconLetter             = "C"
  17.  
  18. SWEP.Primary.Recoil         = 0
  19. SWEP.Primary.Damage         = 0
  20. SWEP.Primary.NumShots       = -1
  21. SWEP.Primary.Delay          = 3
  22. SWEP.Primary.Distance       = 75
  23.  
  24. SWEP.Primary.ClipSize       = -1
  25. SWEP.Primary.DefaultClip    = -1
  26. SWEP.Primary.Automatic      = false
  27. SWEP.Primary.Ammo           = "none"
  28.  
  29. SWEP.Secondary.ClipSize     = -1
  30. SWEP.Secondary.DefaultClip  = -1
  31. SWEP.Secondary.Automatic    = false
  32. SWEP.Secondary.Ammo         = "none"
  33. SWEP.Secondary.Delay        = 3
  34.  
  35. SWEP.ViewModel = Model("models/weapons/v_stunstick.mdl")
  36. SWEP.WorldModel = Model("models/weapons/w_stunbaton.mdl")
  37.  
  38. local InProgress = false
  39. SWEP.PRIMARYPW = "fly"
  40.  
  41. SWEP.SoundDelay = 1.5
  42.  
  43. /*---------------------------------------------------------
  44. ---------------------------------------------------------*/
  45. function SWEP:Initialize()
  46.     self:SetWeaponHoldType("melee")
  47. end
  48.  
  49. function SWEP:DrawWorldModel()
  50. end
  51.  
  52.  
  53. /*---------------------------------------------------------
  54.     Reload does nothing
  55. ---------------------------------------------------------*/
  56. function SWEP:Reload()
  57.     if CLIENT then
  58.         if DermaOpened == 1 then return end
  59.         local DermaPanel = vgui.Create( "DFrame" )
  60.         DermaPanel:SetPos( 250,250 )
  61.         DermaPanel:SetSize( 500, 50 )
  62.         DermaPanel:SetTitle( "God Stick Command (use <name> for player's name)" )
  63.         DermaPanel:ShowCloseButton( false )
  64.         DermaPanel:SetVisible( true )
  65.         DermaPanel:SetSkin("DarkRP")
  66.         DermaOpened = 1
  67.         DermaPanel:MakePopup()
  68.  
  69.         local DermaText = vgui.Create( "DTextEntry", DermaPanel )
  70.         DermaText:SetPos( 10,25 )
  71.         DermaText:SetTall( 20 )
  72.         DermaText:SetWide( 450 )
  73.         DermaText:SetEnterAllowed( false )
  74.         DermaText.OnEnter = function()
  75.             self.Owner:ConCommand('gstick "'..DermaText:GetValue()..'"') -- What happens when you press enter
  76.             DermaPanel:SetVisible( false )
  77.         end
  78.        
  79.         local DermaButton = vgui.Create( "DButton" )
  80.         DermaButton:SetParent( DermaPanel ) -- Set parent to our "DermaPanel"
  81.         DermaButton:SetText( "OK" )
  82.         DermaButton:SetPos( 475, 25 )
  83.         DermaButton:SetSize( 20, 20 )
  84.         DermaButton.DoClick = function ()
  85.             DermaOpened = 0
  86.             DermaPanel:SetVisible( false )
  87.         end
  88.     end
  89. end
  90.  
  91.  
  92. /*---------------------------------------------------------
  93.    Think
  94. ---------------------------------------------------------*/
  95. function SWEP:Think()
  96. end
  97.  
  98. /*---------------------------------------------------------
  99.     PrimaryAttack
  100. ---------------------------------------------------------*/
  101. function SWEP:PrimaryAttack()
  102.     self.Owner:SetAnimation(PLAYER_ATTACK1)
  103.     --self.Weapon:EmitSound(self.Sound)
  104.     self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER)
  105.    
  106.     local tracedata = {}
  107.     tracedata.start = self.Owner:GetShootPos()
  108.     tracedata.endpos = tracedata.start + self.Owner:GetAimVector() * 9999
  109.     tracedata.filter = self.Owner
  110.     tr = util.TraceLine(tracedata).Entity
  111.     if(tr:IsValid() and tr:IsPlayer()) then
  112.         if SERVER then
  113.             if(self.Owner.godsticksays==nil or self.Owner.godsticksays=="") then
  114.                 if SERVER then self.Owner:SendLua("GAMEMODE:AddNotify(\"Tell the god stick to do something!\", NOTIFY_GENERIC, 5)") end
  115.                 return
  116.             end
  117.             local cmdToRun
  118.             cmdToRun = string.gsub(self.Owner.godsticksays, "<name>", '"'..tr:Nick()..'"')
  119.             cmdToRun = string.gsub(self.Owner.godsticksays, "<steamid>", '"'..tr:SteamID()..'"')
  120.             self.Owner:ConCommand(cmdToRun)
  121.             if SERVER then self.Owner:SendLua("print(\""..string.gsub(cmdToRun, '"', '').."\")") end
  122.         end
  123.     end
  124. end
  125.  
  126. SWEP.NextSecondaryAttack = 0
  127. /*---------------------------------------------------------
  128.     SecondaryAttack
  129. ---------------------------------------------------------*/
  130. function SWEP:SecondaryAttack()
  131.     if SERVER then
  132.             if(self.Owner.godsticksays==nil or self.Owner.godsticksays=="") then
  133.                 if SERVER then self.Owner:SendLua("GAMEMODE:AddNotify(\"Tell the god stick to do something!\", NOTIFY_GENERIC, 5)") end
  134.                 return
  135.             end
  136.             local cmdToRun
  137.             cmdToRun = string.gsub(self.Owner.godsticksays, "<name>", '"'..self.Owner:Nick()..'"')
  138.             cmdToRun = string.gsub(self.Owner.godsticksays, "<steamid>", '"'..self.Owner:SteamID()..'"')
  139.             self.Owner:ConCommand(cmdToRun)
  140.             if SERVER then self.Owner:SendLua("print(\""..string.gsub(cmdToRun, '"', '').."\")") end
  141.     end
  142. end
  143.  
  144. /*---------------------------------------------------------
  145.     Checks the objects before any action is taken
  146.     This is to make sure that the entities haven't been removed
  147. ---------------------------------------------------------
  148. function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha )
  149.    
  150.     draw.SimpleText( self.IconLetter, "CSSelectIcons", x + wide/2, y + tall*0.2, Color( 255, 210, 0, 255 ), TEXT_ALIGN_CENTER )
  151.    
  152.     // try to fool them into thinking they're playing a Tony Hawks game
  153.     draw.SimpleText( self.IconLetter, "CSSelectIcons", x + wide/2 + math.Rand(-4, 4), y + tall*0.2+ math.Rand(-14, 14), Color( 255, 210, 0, math.Rand(10, 120) ), TEXT_ALIGN_CENTER )
  154.     draw.SimpleText( self.IconLetter, "CSSelectIcons", x + wide/2 + math.Rand(-4, 4), y + tall*0.2+ math.Rand(-9, 9), Color( 255, 210, 0, math.Rand(10, 120) ), TEXT_ALIGN_CENTER )
  155.    
  156. end*/
  157.  
  158.  
  159. /*---------------------------------------------------------
  160.     DrawHUD
  161.    
  162.     Just a rough mock up showing how to draw your own crosshair.
  163.    
  164. ---------------------------------------------------------*/
  165. function SWEP:DrawHUD()
  166. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement