• Where are my Manhacks!?
    1 replies, posted
I don't know what's wrong with this code but deployable manhacks aren't able to be used in my server. I got it from the Steam Workshop and made slight modifications. It worked in Sandbox but not TTT? It can't be the gamemode, it has to be something I did to the code but I can't see what is wrong. [QUOTE]if SERVER then AddCSLuaFile( "shared.lua" ) resource.AddFile("materials/VGUI/ttt/weapon_manhack.vmt") end // TTT Convertion Code \\ SWEP.Base = "weapon_tttbase" SWEP.Kind = WEAPON_EQUIP1 SWEP.AutoSpawnable = false SWEP.InLoadoutFor = nil SWEP.AllowDrop = false SWEP.IsSilent = false SWEP.NoSights = false SWEP.LimitedStock = true SWEP.CanBuy = {ROLE_TRAITOR} SWEP.Icon = "VGUI/ttt/weapon_manhack" // TTT Convertion Code \\ SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.DrawCrosshair = false SWEP.ViewModel = "models/weapons/v_manhack.mdl" SWEP.WorldModel = "models/weapons/w_manhack.mdl" SWEP.Primary.ClipSize = 10 SWEP.Primary.DefaultClip = 10 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.Next = 0 SWEP.NextReload = 0 function SWEP:Deploy() if self.Owner:GetAmmoCount(self.Primary.Ammo) > 0 then self:CallOnClient("SetupAmmoIcon","") self.Weapon:SendWeaponAnim(ACT_VM_DRAW) self.Empty = false else self:CallOnClient("ViewModelToggle","true") self.Empty = true end return true end function SWEP:ShootEffects() self:SetPlaybackRate(1) self:SendWeaponAnim( ACT_VM_THROW ) -- View model animation self.Owner:SetAnimation( PLAYER_ATTACK1 ) -- 3rd Person Animation end function SWEP:PrimaryAttack() if self.Next < CurTime() and self.Owner:GetAmmoCount(self.Primary.Ammo) > 0 then if self.Owner:WaterLevel() == 3 then return end self:SetPlaybackRate(2) self:SendWeaponAnim(ACT_VM_PULLBACK_HIGH) self.Primed = true end end function SWEP:SecondaryAttack() if SERVER then self.Owner:SendManHacks() end end function SWEP:Reload() if SERVER then if self.NextReload < CurTime() then self.Owner:KillManHacks() self.NextReload = CurTime() + 2 end end end function SWEP:Think() if self.Next < CurTime() then if self.Empty then if self.Owner:GetAmmoCount(self.Primary.Ammo) > 0 then self:CallOnClient("ViewModelToggle","false") self:SendWeaponAnim(ACT_VM_DRAW) self.Empty = false end elseif self.Primed and !(self.Owner:KeyDown(IN_ATTACK) ) then self:ShootEffects() self.Primed = false self.Next = CurTime() + .3 self.WaitingToThrow = true elseif self.WaitingToThrow then self.Next = CurTime() + 0.5 if SERVER then self.Owner:RemoveAmmo(1, self.Primary.Ammo) self:DeployManhack() end self.WaitingToThrow = false if self.Owner:GetAmmoCount(self.Primary.Ammo) > 0 then self:SendWeaponAnim(ACT_VM_DRAW) else self.Empty = true end end end end[/QUOTE]
Use code tags, not quote tags please. Your primary attack function doesn't call ents.Create, or your custom deploy function.
Sorry, you need to Log In to post a reply to this thread.