peacemaker
10.07.2009, 18:05
Aloha.
Ich hab ne kleine DosenSpawner Swep geschrieben,Die mit Linksklick ne Dose and nem Prop Weldet. Mit rechtsklick spawnt die einfach so.
Aber das ist ja nebensache.^^
Als erstes hab ich versucht es mit ner Toolgun zu machen das ich aber nicht Schaffte.
So. Was ich nun machen will ist Kompliziert, dass weiss ich gut ^^
Ich möchte das automatisch nen Trail auf die Dosen gemacht wird.
Klappt auch relativ gut.
Mit ner "if" sollte dann überprüft werden ob die Concommand "Can_Trail" 1 ist.
Wenn dann soll halt nen Trail miterstellt werden.
Nur wenn ich als Standart 0 hab und ich in die console ne 1 mache, ändert es sich nicht. Wenn ich aber 1 als Standart hab, schon.
Wie Schaffe ich das?
Ich hab es mit
function GetClientInfo( property )
local mode = self:GetMode()
return self:GetOwner():GetInfo("Can_Trail")
end
Versucht. Ein Codesnippet aus gmod.com
aber das gibt nur Lua Fehler.
Hier mal meine Epische shared.lua
//Contact and SpawnSettings.. blabla
SWEP.Author = "Flo / Peacemaker"
SWEP.Contact = "Garrysmod.de - User peacemaker"
SWEP.Instructions = "Rightclick to Spawn a Can / Leftclick To Spawn and Wekd a Can to a Prop"
SWEP.Spawnable = "True"
SWEP.AdminSpawnable = "True"
local Can_Trail = CreateClientConVar("Can_Trail",10,true,true)
local myint = Can_Trail:GetInt()
function GetClientInfo( property )
local mode = self:GetMode()
return self:GetOwner():GetInfo("Can_Trail")
end
//Model Setting or somethin'
SWEP.ViewModel = "models/weapons/v_pistol.mdl"
SWEP.WorldModel = "models/weapons/w_pistol.mdl"
// Primary Settings. Like Garrys-Manhack gun.
SWEP.Primary.Clipsize = "-1"
SWEP.Primary.DefaultClip= "-1"
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
// Secondary. Like Garrys-Manhack gun.
SWEP.Secondary.Clipsize = "-1"
SWEP.Secondary.DefaultClip= "-1"
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
//Primary Attack
function SWEP:PrimaryAttack(tr)
local tr = self.Owner:GetEyeTrace()
if (!SERVER) then return end
Msg (myint)
//Spawn the Can. Yay
local ent = ents.Create ("prop_physics")
ent:SetModel ("models/props_junk/PopCan01a.mdl")
ent:SetPos( tr.HitPos + self.Owner:GetAimVector() * -3 )
ent:SetAngles( tr.HitNormal:Angle() )
ent:Spawn()
//Weld the Can. Yay Again!
local weld = constraint.Weld( tr.Entity, ent, tr.PhysicsBone, 0, 0 )
// Let's Undo It. Again the 3rd. Time
undo.Create( "OMFG CAN!" )
undo.AddEntity( weld )
undo.AddEntity( ent )
undo.SetPlayer( self.Owner )
undo.Finish()
if (myint == 1) then
local trail = util.SpriteTrail(ent, 0, Color(255,0,0), false, 15, 1, 4, 1/(15+1)*0.5, "trails/plasma.vmt")
else
return false
end
end
function SWEP:SecondaryAttack()
local tr = self.Owner:GetEyeTrace()
if (!SERVER) then return end
//Spawn the Can. Yay
local ent = ents.Create ("prop_physics")
ent:SetModel ("models/props_junk/PopCan01a.mdl")
ent:SetPos( tr.HitPos + self.Owner:GetAimVector() * -3 )
ent:SetAngles( tr.HitNormal:Angle() )
ent:Spawn()
// Let's Undo It. Again the 3rd. Time
undo.Create( "OMFG CAN!" )
undo.AddEntity( ent )
undo.SetPlayer( self.Owner )
undo.Finish()
end
//Kill other Keys. OBEY
function SWEP:Think()
end
function SWEP:Reload()
end
Bitte Helft mir :D
Ich hab ne kleine DosenSpawner Swep geschrieben,Die mit Linksklick ne Dose and nem Prop Weldet. Mit rechtsklick spawnt die einfach so.
Aber das ist ja nebensache.^^
Als erstes hab ich versucht es mit ner Toolgun zu machen das ich aber nicht Schaffte.
So. Was ich nun machen will ist Kompliziert, dass weiss ich gut ^^
Ich möchte das automatisch nen Trail auf die Dosen gemacht wird.
Klappt auch relativ gut.
Mit ner "if" sollte dann überprüft werden ob die Concommand "Can_Trail" 1 ist.
Wenn dann soll halt nen Trail miterstellt werden.
Nur wenn ich als Standart 0 hab und ich in die console ne 1 mache, ändert es sich nicht. Wenn ich aber 1 als Standart hab, schon.
Wie Schaffe ich das?
Ich hab es mit
function GetClientInfo( property )
local mode = self:GetMode()
return self:GetOwner():GetInfo("Can_Trail")
end
Versucht. Ein Codesnippet aus gmod.com
aber das gibt nur Lua Fehler.
Hier mal meine Epische shared.lua
//Contact and SpawnSettings.. blabla
SWEP.Author = "Flo / Peacemaker"
SWEP.Contact = "Garrysmod.de - User peacemaker"
SWEP.Instructions = "Rightclick to Spawn a Can / Leftclick To Spawn and Wekd a Can to a Prop"
SWEP.Spawnable = "True"
SWEP.AdminSpawnable = "True"
local Can_Trail = CreateClientConVar("Can_Trail",10,true,true)
local myint = Can_Trail:GetInt()
function GetClientInfo( property )
local mode = self:GetMode()
return self:GetOwner():GetInfo("Can_Trail")
end
//Model Setting or somethin'
SWEP.ViewModel = "models/weapons/v_pistol.mdl"
SWEP.WorldModel = "models/weapons/w_pistol.mdl"
// Primary Settings. Like Garrys-Manhack gun.
SWEP.Primary.Clipsize = "-1"
SWEP.Primary.DefaultClip= "-1"
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
// Secondary. Like Garrys-Manhack gun.
SWEP.Secondary.Clipsize = "-1"
SWEP.Secondary.DefaultClip= "-1"
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
//Primary Attack
function SWEP:PrimaryAttack(tr)
local tr = self.Owner:GetEyeTrace()
if (!SERVER) then return end
Msg (myint)
//Spawn the Can. Yay
local ent = ents.Create ("prop_physics")
ent:SetModel ("models/props_junk/PopCan01a.mdl")
ent:SetPos( tr.HitPos + self.Owner:GetAimVector() * -3 )
ent:SetAngles( tr.HitNormal:Angle() )
ent:Spawn()
//Weld the Can. Yay Again!
local weld = constraint.Weld( tr.Entity, ent, tr.PhysicsBone, 0, 0 )
// Let's Undo It. Again the 3rd. Time
undo.Create( "OMFG CAN!" )
undo.AddEntity( weld )
undo.AddEntity( ent )
undo.SetPlayer( self.Owner )
undo.Finish()
if (myint == 1) then
local trail = util.SpriteTrail(ent, 0, Color(255,0,0), false, 15, 1, 4, 1/(15+1)*0.5, "trails/plasma.vmt")
else
return false
end
end
function SWEP:SecondaryAttack()
local tr = self.Owner:GetEyeTrace()
if (!SERVER) then return end
//Spawn the Can. Yay
local ent = ents.Create ("prop_physics")
ent:SetModel ("models/props_junk/PopCan01a.mdl")
ent:SetPos( tr.HitPos + self.Owner:GetAimVector() * -3 )
ent:SetAngles( tr.HitNormal:Angle() )
ent:Spawn()
// Let's Undo It. Again the 3rd. Time
undo.Create( "OMFG CAN!" )
undo.AddEntity( ent )
undo.SetPlayer( self.Owner )
undo.Finish()
end
//Kill other Keys. OBEY
function SWEP:Think()
end
function SWEP:Reload()
end
Bitte Helft mir :D