Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SWEP.DrawWeaponInfoBox = true
- SWEP.Author = "Sethxi"
- SWEP.Contact = "Steam Profile"
- SWEP.Purpose = "Do console commands to players you look at!"
- SWEP.Instructions = "'godstick' in console\nMouse1: Do action on player you're looking at\nMouse2: Do action on yourself\nReload: Open command menu"
- SWEP.Category = "Sethxi"
- SWEP.Spawnable = true
- SWEP.AdminSpawnable = true
- SWEP.AnimPrefix = "stunstick"
- SWEP.NextStrike = 0
- SWEP.HoldType = "ar2"
- SWEP.IconLetter = "C"
- SWEP.Primary.Recoil = 0
- SWEP.Primary.Damage = 0
- SWEP.Primary.NumShots = -1
- SWEP.Primary.Delay = 3
- SWEP.Primary.Distance = 75
- SWEP.Primary.ClipSize = -1
- SWEP.Primary.DefaultClip = -1
- SWEP.Primary.Automatic = false
- SWEP.Primary.Ammo = "none"
- SWEP.Secondary.ClipSize = -1
- SWEP.Secondary.DefaultClip = -1
- SWEP.Secondary.Automatic = false
- SWEP.Secondary.Ammo = "none"
- SWEP.Secondary.Delay = 3
- SWEP.ViewModel = Model("models/weapons/v_stunstick.mdl")
- SWEP.WorldModel = Model("models/weapons/w_stunbaton.mdl")
- local InProgress = false
- SWEP.PRIMARYPW = "fly"
- SWEP.SoundDelay = 1.5
- /*---------------------------------------------------------
- ---------------------------------------------------------*/
- function SWEP:Initialize()
- self:SetWeaponHoldType("melee")
- end
- function SWEP:DrawWorldModel()
- end
- /*---------------------------------------------------------
- Reload does nothing
- ---------------------------------------------------------*/
- function SWEP:Reload()
- if CLIENT then
- if DermaOpened == 1 then return end
- local DermaPanel = vgui.Create( "DFrame" )
- DermaPanel:SetPos( 250,250 )
- DermaPanel:SetSize( 500, 50 )
- DermaPanel:SetTitle( "God Stick Command (use <name> for player's name)" )
- DermaPanel:ShowCloseButton( false )
- DermaPanel:SetVisible( true )
- DermaPanel:SetSkin("DarkRP")
- DermaOpened = 1
- DermaPanel:MakePopup()
- local DermaText = vgui.Create( "DTextEntry", DermaPanel )
- DermaText:SetPos( 10,25 )
- DermaText:SetTall( 20 )
- DermaText:SetWide( 450 )
- DermaText:SetEnterAllowed( false )
- DermaText.OnEnter = function()
- self.Owner:ConCommand('gstick "'..DermaText:GetValue()..'"') -- What happens when you press enter
- DermaPanel:SetVisible( false )
- end
- local DermaButton = vgui.Create( "DButton" )
- DermaButton:SetParent( DermaPanel ) -- Set parent to our "DermaPanel"
- DermaButton:SetText( "OK" )
- DermaButton:SetPos( 475, 25 )
- DermaButton:SetSize( 20, 20 )
- DermaButton.DoClick = function ()
- DermaOpened = 0
- DermaPanel:SetVisible( false )
- end
- end
- end
- /*---------------------------------------------------------
- Think
- ---------------------------------------------------------*/
- function SWEP:Think()
- end
- /*---------------------------------------------------------
- PrimaryAttack
- ---------------------------------------------------------*/
- function SWEP:PrimaryAttack()
- self.Owner:SetAnimation(PLAYER_ATTACK1)
- --self.Weapon:EmitSound(self.Sound)
- self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER)
- local tracedata = {}
- tracedata.start = self.Owner:GetShootPos()
- tracedata.endpos = tracedata.start + self.Owner:GetAimVector() * 9999
- tracedata.filter = self.Owner
- tr = util.TraceLine(tracedata).Entity
- if(tr:IsValid() and tr:IsPlayer()) then
- if SERVER then
- if(self.Owner.godsticksays==nil or self.Owner.godsticksays=="") then
- if SERVER then self.Owner:SendLua("GAMEMODE:AddNotify(\"Tell the god stick to do something!\", NOTIFY_GENERIC, 5)") end
- return
- end
- local cmdToRun
- cmdToRun = string.gsub(self.Owner.godsticksays, "<name>", '"'..tr:Nick()..'"')
- cmdToRun = string.gsub(self.Owner.godsticksays, "<steamid>", '"'..tr:SteamID()..'"')
- self.Owner:ConCommand(cmdToRun)
- if SERVER then self.Owner:SendLua("print(\""..string.gsub(cmdToRun, '"', '').."\")") end
- end
- end
- end
- SWEP.NextSecondaryAttack = 0
- /*---------------------------------------------------------
- SecondaryAttack
- ---------------------------------------------------------*/
- function SWEP:SecondaryAttack()
- if SERVER then
- if(self.Owner.godsticksays==nil or self.Owner.godsticksays=="") then
- if SERVER then self.Owner:SendLua("GAMEMODE:AddNotify(\"Tell the god stick to do something!\", NOTIFY_GENERIC, 5)") end
- return
- end
- local cmdToRun
- cmdToRun = string.gsub(self.Owner.godsticksays, "<name>", '"'..self.Owner:Nick()..'"')
- cmdToRun = string.gsub(self.Owner.godsticksays, "<steamid>", '"'..self.Owner:SteamID()..'"')
- self.Owner:ConCommand(cmdToRun)
- if SERVER then self.Owner:SendLua("print(\""..string.gsub(cmdToRun, '"', '').."\")") end
- end
- end
- /*---------------------------------------------------------
- Checks the objects before any action is taken
- This is to make sure that the entities haven't been removed
- ---------------------------------------------------------
- function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha )
- draw.SimpleText( self.IconLetter, "CSSelectIcons", x + wide/2, y + tall*0.2, Color( 255, 210, 0, 255 ), TEXT_ALIGN_CENTER )
- // try to fool them into thinking they're playing a Tony Hawks game
- 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 )
- 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 )
- end*/
- /*---------------------------------------------------------
- DrawHUD
- Just a rough mock up showing how to draw your own crosshair.
- ---------------------------------------------------------*/
- function SWEP:DrawHUD()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement