• SWEP help, Unknown ENT.
    3 replies, posted
Console says it's an unknown ent. [lua] if (SERVER) then AddCSLuaFile("shared.lua") end SWEP.PrintName = "Tag Gun" SWEP.Author = "Clark" SWEP.Slot = 4 SWEP.SlotPos = 4 SWEP.Description = "Tag your it." SWEP.Contact = "" SWEP.Purpose = "" SWEP.Instructions = "Left Click to tag a player." SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.ViewModel = "models/weapons/v_pist_glock18.mdl" SWEP.WorldModel = "models/weapons/w_pist_glock18.mdl" SWEP.Primary.Recoil = 0 SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = 1 SWEP.Primary.Automatic = false SWEP.Primary.Delay = 2 SWEP.Primary.Ammo = "none" SWEP.Secondary.Recoil = 0 SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = 1 SWEP.Secondary.Automatic = true SWEP.Secondary.Delay = 0.3 SWEP.Secondary.Ammo = "none" function SWEP:PrimaryAttack() self.Weapon:SetNextPrimaryFire(CurTime() + self.Primary.Delay) trace = {} trace.start = self.Owner:GetShootPos() trace.endpos = trace.start + (self.Owner:GetAimVector() * 85) trace.filter = { self.Owner, self.Weapon } tr = util.TraceLine(trace) if (tr.HitNonWorld) then local enthit = tr.Entity if enthit:IsPlayer() then enthitGive("weapon_tag") enthitSetColor(255, 0, 0, 255) enthit:SetHealth( tr.Entity:Health - 10 ) enthit:SetModel("models/player/police.mdl") self.Owner:StripWeapon("weapon_tag") self.Owner:SetModel( "models/player/group01/male_0".. math.random(1,4) ..".mdl" ) self.Owner:SetColor(0, 255, 0, 255) end end end [/lua]
You again? I've seen you post the same thing yesterday in the wrong section, couldn't find the error since then? [lua] enthitGive("weapon_tag") enthitSetColor(255, 0, 0, 255) enthit:SetHealth( tr.Entity:Health - 10 ) [/lua] You're missing a : on those first two lines. On the third line, you need a pair of parentheses after tr.Entity:Health. [lua] enthit:Give("weapon_tag") enthit:SetColor(255, 0, 0, 255) enthit:SetHealth( tr.Entity:Health() - 10 ) [/lua] Check the console for Lua errors before posting here next time.
[QUOTE=_Kilburn;22872384]You again? I've seen you post the same thing yesterday in the wrong section, couldn't find the error since then? [lua] enthitGive("weapon_tag") enthitSetColor(255, 0, 0, 255) enthit:SetHealth( tr.Entity:Health - 10 ) [/lua] You're missing a : on those first two lines. On the third line, you need a pair of parentheses after tr.Entity:Health. [lua] enthit:Give("weapon_tag") enthit:SetColor(255, 0, 0, 255) enthit:SetHealth( tr.Entity:Health() - 10 ) [/lua] Check the console for Lua errors before posting here next time.[/QUOTE] Console commands didn't show up for him I just talked to him. Because it's not a lan server....
[QUOTE=Aide;22875146]Console commands didn't show up for him I just talked to him. Because it's not a lan server....[/QUOTE] And why wouldn't he try his stuff offline first?
Sorry, you need to Log In to post a reply to this thread.