Welcome, Guest. Please login or register.
Did you miss your activation email?
November 23, 2024, 11:07:09 AM
Home Help Login Register
News: Zombie Master 2 discussion

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: duel pistols
Pages: [1]
Author Topic: duel pistols  (Read 4800 times)
simmerdown
Poster

Posts: 70

www.ms3dguns.com


« on: October 10, 2010, 10:34:40 AM »

hello sorry but uhm,
how can i make duel pistols in ttt shoot with the left/ right mouse button handling?

because the way i got it now it only shoots on left mouse button, it somethimes switches the weapon which fires on that mouse click, somethimes they shoot both, somethimes the left gun shoots a few rounds, then the right gun shoots a few etc. i want it to be like in cs:s  then left mouse = left gun fired    right mouse = right gun fired, so i copied the file from cs:s but it doesnt work in TTT what code does ttt use for it?


SWEP.Base = "weapon_tttbase"

SWEP.Spawnable = true
SWEP.AdminSpawnable = true

SWEP.ViewModel = "models/weapons/v_pist_elite.mdl"
SWEP.WorldModel = "models/weapons/w_pist_elite.mdl"
SWEP.HoldType = "pistol"

SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false

SWEP.Primary.Sound = Sound("Weapon_ELITE.Single")
SWEP.Primary.Recoil = 2
SWEP.Primary.Unrecoil = 7
SWEP.Primary.Damage = 12
SWEP.Primary.NumShots = 1
SWEP.Primary.Cone = 0
SWEP.Primary.ClipSize = 32
SWEP.Primary.Delay = 0.06 //Don't use this, use the tables below!
SWEP.Primary.DefaultClip = 92 //Always set this 1 higher than what you want.
SWEP.Primary.Automatic = false //Don't use this, use the tables below!
SWEP.Primary.Ammo = "pistol"
SWEP.AmmoEnt = "item_ammo_pistol_ttt"
SWEP.Icon = "VGUI/ttt/icon_FHserver_elites"


SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"

//Firemode configuration

SWEP.IronSightsPos = Vector(0,0,0)
SWEP.IronSightsAng = Vector(0,0,0)

SWEP.data = {}
SWEP.mode = "semi" //The starting firemode
SWEP.data.newclip = false //Do not change this



SWEP.data.semi = {}
SWEP.data.semi.Delay = 0.07
SWEP.data.semi.Cone = 0.021
SWEP.data.semi.ConeZoom = 0.018

//End of configuration

function SWEP:ShootEffects()
if self.left then
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
else
self.Weapon:SendWeaponAnim(ACT_VM_SECONDARYATTACK)
end

self.left = not self.left
self.Owner:MuzzleFlash()
self.Owner:SetAnimation( PLAYER_ATTACK1 )

end

function SWEP:Think()
if SinglePlayer() then self.data.singleplayer(self) end
if self.data.init then
self.Weapon:SetClip1( self.Weapon:Clip1() - 2 )
self.data.init = nil
end
if self.data.newclip then
if self.data.newclip == 0 then
self.data.newclip = false

if self:Ammo1() > self.Primary.ClipSize - 2 then
if self.data.oldclip == 0 then
self.Weapon:SetClip1( self.Weapon:Clip1() - 2 )
if SERVER then
self.Owner:GiveAmmo(2,self.Primary.Ammo,true)
end
elseif self.data.oldclip == 1 then
self.Weapon:SetClip1( self.Weapon:Clip1() - 1 )
if SERVER then
self.Owner:GiveAmmo(1,self.Primary.Ammo,true)
end
end
elseif self:Ammo1() > self.Primary.ClipSize - 1 then
if self.data.oldclip == 0 then
self.Weapon:SetClip1( self.Weapon:Clip1() - 1 )
if SERVER then
self.Owner:GiveAmmo(1,self.Primary.Ammo,true)
end
end
end
else
self.data.newclip = self.data.newclip - 1
end
end
end
Copper :D
Poster

Posts: 22



« Reply #1 on: October 10, 2010, 10:47:03 AM »

Can the secondary fire on weapons have a clip size and reload function?
simmerdown
Poster

Posts: 70

www.ms3dguns.com


« Reply #2 on: October 10, 2010, 10:50:30 AM »

yes but thats not the second gun, its a secondary fire mode like granade launcher etc on one gun, not for the use of a duel gun.
Copper :D
Poster

Posts: 22



« Reply #3 on: October 10, 2010, 11:00:06 AM »

Could you describe the problem specifically?
simmerdown
Poster

Posts: 70

www.ms3dguns.com


« Reply #4 on: October 10, 2010, 11:31:48 AM »

.. you got two pistols  the elites

in game it only fires on the left mouse button instead of :  left mouse button = left gun shooting
right mouse button = right gun shooting

now left mouse button is random gun shooting, so look at the file if u know anything about it. and otherwice i  need help from BKU bcus he made ttt and i need the left / right mouse button code if its differend in ttt
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #5 on: October 10, 2010, 11:42:20 AM »

It's not any different in TTT than in gmod. The code you paste just does not do what you want at all. It specifically makes the guns fire left-right-left-right no matter what. It doesn't even try to do anything with mouse buttons.

There needs to be some stuff involving SWEP:PrimaryAttack() that plays the left gun shooting animation (ACT_VM_PRIMARYATTACK apparently) and SWEP:SecondaryAttack() that plays the other animation.
simmerdown
Poster

Posts: 70

www.ms3dguns.com


« Reply #6 on: October 10, 2010, 01:32:31 PM »

go i should change this

function SWEP:ShootEffects()
if self.left then
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
else
self.Weapon:SendWeaponAnim(ACT_VM_SECONDARYATTACK)
end



to :

function SWEP:ShootEffects()
if self.left then
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
elseif self.right then

self.Weapon:SendWeaponAnim(ACT_VM_SECONDARYATTACK)
end

or what do you mean ?
StormX
Poster

Posts: 69


« Reply #7 on: October 10, 2010, 01:48:11 PM »

Go learn Lua.
simmerdown
Poster

Posts: 70

www.ms3dguns.com


« Reply #8 on: October 10, 2010, 01:51:41 PM »

'how can i learn when no one's here to teach me'
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #9 on: October 10, 2010, 02:39:43 PM »

This is not the place to get Lua lessons, try facepunch.
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: duel pistols « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.01 seconds with 17 queries.