[Lua]if( SERVER ) then
end
if( CLIENT ) then
SWEP.PrintName = "Cloaking Device";
SWEP.Slot = 7;
SWEP.DrawAmmo = false;
SWEP.DrawCrosshair = false;
SWEP.EquipMenuData = {
type = "item_weapon",
desc = "Cloak yourself!"
};
end
--- TTT ---
SWEP.HoldType = "normal"
SWEP.Kind = WEAPON_EQUIP2
SWEP.CanBuy = {ROLE_TRAITOR}
SWEP.Base = "weapon_tttbase"
--- TTT END ---
SWEP.Author= "Tenteran | Edited By BobKATT"
SWEP.ViewModelFOV= 60
SWEP.ViewModelFlip= false
SWEP.Spawnable= true
SWEP.AdminSpawnable= true
SWEP.ViewModel = "models/weapons/v_hands.mdl"
SWEP.WorldModel = ""
-------------Primary Fire Attributes----------------------------------------
function SWEP:PrimaryAttack()
self.Weapon:SetNextSecondaryFire( CurTime() + 1 )
self:SetNextPrimaryFire(CurTime()+5)
local result = math.random(1, 2)
if result == 1 then
TauntSound = Sound("npc/stalker/breathing3.wav")
else
TauntSound = Sound("npc/stalker/go_alert2a.wav")
end
self:SetNextPrimaryFire(CurTime()+2)
self.Weapon:EmitSound( TauntSound )
// The rest is only done on the server
if (!SERVER) then return end
self.Weapon:EmitSound( TauntSound )
end
-------------Secondary Fire Attributes-------------------------------------
SWEP.Secondary.Delay= 0.5
SWEP.Secondary.Recoil= 0
SWEP.Secondary.Damage= 0
SWEP.Secondary.NumShots= 1
SWEP.Secondary.Cone= 0
SWEP.Secondary.ClipSize= -1
SWEP.Secondary.DefaultClip= -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
function SWEP:SecondaryAttack() // conceal yourself
if ( !self.conceal ) then
self:Cloak()
else
self:UnCloak()
end
end
function SWEP:Cloak()
self.Owner:SetMaterial("models/effects/vol_light001")
self.Weapon:SetMaterial("models/effects/vol_light001")
self.Owner:PrintMessage( HUD_PRINTCENTER, "Cloak On" )
self.conceal = true
end
function SWEP:UnCloak()
self.Owner:SetMaterial("models/glass")
self.Weapon:SetMaterial("models/glass")
self.Owner:PrintMessage( HUD_PRINTCENTER, "Cloak Off" )
self.conceal = false
end
function SWEP:OnDrop()
self:UnCloak()
end[/lua]
Players stay cloaked if they die.. could someone help me?? I think I use a ifthen line, but I don't know where to put it.
Create a new file called "deathuncloaker.lua" and put it in Lua/autorun.
Put this in it:
[CODE]
hook.Add("PlayerSpawn", "uncloaker", function(ply)
ply:SetMaterial("models/glass")
end)
[/CODE]
There's probably a more efficient way of doing it, but that was off the top of my head.
You do realize alts aren't allowed here right?
[QUOTE=vegasx;41819462]Create a new file called "deathuncloaker.lua" and put it in Lua/autorun.
Put this in it:
[CODE]
hook.Add("PlayerSpawn", "uncloaker", function(ply)
ply:SetMaterial("models/glass")
end)
[/CODE]
There's probably a more efficient way of doing it, but that was off the top of my head.[/QUOTE]
put it in what /lua/autorun?? what comes before lua
[highlight](User was permabanned for this post ("alt of Noon" - postal))[/highlight]
[QUOTE=Nooon;41819536]put it in what /lua/autorun?? what comes before lua[/QUOTE]
garrysmod
Garrysmod/garrysmod/Lua/autorun I believe. This is all from my phone so I have no solid idea
Shit I got ninja'd
Sorry, you need to Log In to post a reply to this thread.