Not sure if my weapon is not initializing or not working at all, SWEP
1 replies, posted
[CODE]if SERVER then
AddCSLuaFile( "weapon_ttt_duality.lua")
end
if CLIENT then
SWEP.PrintName("duality")
SWEP.Slot(7)
print("totally working man")
end
//SWEP.Base = "weapon_tttbase"
SWEP.HoldType = "normal" -- change to medkit
SWEP.ViewModel = "models/weapons/v_crowbar.mdl"
SWEP.WorldModel = "models/weapons/w_slam.mdl"
SWEP.Spawnable = true
SWEP.Primary.Recoil = 0
SWEP.Primary.Automatic = false
SWEP.Primary.Damage = 0
SWEP.Primary.Ammo = "GaussEnergy"
SWEP.Primary.ClipSize = 1
SWEP.Primary.ClipMax = 1
SWEP.Primary.DefaultClip = 1
SWEP.AllowDrop = false
SWEP.NoSights = true
//SWEP.Kind("WEAPON_EQUIP2")
SWEP.AutoSpawnable = false
SWEP.Category = "Category"
//SWEP.CanBuy{ROLE_TRAITOR}
//SWEP.LimitedStock = true
--[[SWEP.EquipMenuData = {
type = "Weapon",
desc = "The Duality Syringe on primary attack gives you 150% damage but 150% increase in damage taken, on secondary attack gives you 150% health but you do 50% less damage, and reload clears your effects and puts it back into the syringe."
};]]
-- Decreases damage resistance, increases speed, increases damage
function SWEP:PrimaryAttack()
if (!self:CanPrimaryAttack()) then return end
self:changePlayerStats(1.5, 1.5, 1.5)
//self.Weapon:EmitSound("placeholder") --insert yelling noise here
self:TakePrimaryAmmo(1)
end
-- Increases resistance, lowers speed and damage
function SWEP:SecondaryAttack()
if (!self:CanSecondaryAttack()) then return end
self:changePlayerStats(-.5, .5, .75)
//self.Weapon:EmitSound("placeholder") -- insert ahhh noise here
self:TakePrimaryAmmo(1)
end
--Resets Effects
function SWEP:Reload()
self:changePlayerStats(1, 0, 1)
//self.Weapon:EmitSound("placeholder") -- insert suction noise here
self:TakePrimaryAmmo(-1)
end
--Begin the hell that is making the cahnges to the player
local PlyDmgScale = 1
local PlyDmgDoneScale = 0
local PlySpdScale = 1
local ply = self.Owner
function GM:EntityTakeDamge(target, dmginfo)
if(target:IsPlayer()) then
dmginfo:ScaleDamage(PlyDmgScale)
end
end
--Catches when a player takes damage to check how much they should take in response to the scale of the weapon mode
function GM:PlayerHurt(victim, attacker, healthRemaining, damageTaken)
if attacker == ply then
victim:Health() = healthRemaining - (damageTaken * PlyDmgDoneScale)
end
end
--Changes the DMG the player does, the ammount they take, and their walk/crouch speed
function SWEP:changePlayerStats(DMGScale, DMGDoneScale, WalkSpeed)
PlyDmgScale = DMGScale
GM:SetPlayerSpeed(ply, WalkSpeed, WalkSpeed - .25)
PlyDmgDoneScale = DMGDoneScale
end[/CODE]
Any other suggestions would be appreciated
As well as I'm not sure why it wouldn't be working, according to the wiki it should be working
SWEP.PrintName and SWEP.Slot are variables, not functions. You have made this mistake in other points in your code as well. Just make sure you have an equals sign between the variable name and the value. Also, this saves the PlyDmgScale, PlyDmgDkneScale, and PlySpdScale as global variables, instead of per player or per entity instance
Sorry, you need to Log In to post a reply to this thread.