• Custom TTT Weapon
    3 replies, posted
I am going to apologize in advance because there are probably a few threads out there that would answer my question, but I am stating to want to burn my computer because this LUA will not work! What I want to do is have a re-skinned .357 magnum called the golden gun to be given to all players when they spawn (like the crowbar). This gun would have a 50% chance of killing you when fired and a 50% chance of a one hit kill (if you hit your target). I have gotten the kill down just getting anything that would make it so there was a 50/50 chance is not working at all. Please post any further questions below and thank you for any help you can provide. [CODE]resource.AddFile("materials/models/weapons/357_sheet.vdf") if SERVER then AddCSLuaFile( "shared.lua" ) end SWEP.HoldType = "pistol" if CLIENT then SWEP.PrintName = "Golden Gun" SWEP.Author = "Dr.Gusta" SWEP.Slot = 10 SWEP.Icon = "VGUI/ttt/icon_deagle" end SWEP.Base = "weapon_tttbase" SWEP.Spawnable = false SWEP.AdminSpawnable = true SWEP.Kind = WEAPON_PISTOL SWEP.WeaponID = AMMO_DEAGLE SWEP.Primary.Ammo = "" -- hijack an ammo type we don't use otherwise SWEP.Primary.Recoil = 0 SWEP.Primary.Damage = 0 SWEP.Primary.Delay = 0.6 SWEP.Primary.Cone = 0 SWEP.Primary.ClipSize = 1 SWEP.Primary.ClipMax = 1 SWEP.Primary.DefaultClip = 1 SWEP.Primary.Automatic = false SWEP.DrawCrosshair = true SWEP.HeadshotMultiplier = 1 SWEP.AutoSpawnable = false SWEP.AmmoEnt = "" SWEP.Primary.Sound = Sound( "Weapon_Elite.Single" ) SWEP.UseHands = true SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 54 SWEP.ViewModel = "models/weapons/c_357.mdl" SWEP.WorldModel = "models/weapons/w_357.mdl" SWEP.IronSightsPos = Vector(-6.361, -3.701, 2.15) SWEP.IronSightsAng = Vector(0, 0, 0) function SWEP:Initialize() if ( SERVER ) then self:SetWeaponHoldType( "pistol" ) end if ( CLIENT ) then self.Owner:GetViewModel( ):SetMaterial("materials/models/weapons/357_sheet.vdf") end end function SWEP:Reload() end function SWEP:Think() end function SWEP:PrimaryAttack() if not self:CanPrimaryAttack() then return end x = math.random(1,100) if x < 50 then self.Owner:Kill(1) else --code here that would equal a one hit kill end [/CODE]
[url]http://facepunch.com/forumdisplay.php?f=65[/url]
Sorry I just now joined the forums just to post this. Sorry I put it in the wrong category.
[QUOTE=Dr.Gusta;41778308]Sorry I just now joined the forums just to post this. Sorry I put it in the wrong category.[/QUOTE] THAT's the correct way to use facepunch.
Sorry, you need to Log In to post a reply to this thread.