Hatte?
Mal schaun.
Ich hab übrigens rausgefunden wie man ne airbrake macht
ReEdit:
Jetzt geht alles, (wireinputs, schwerelos) nur will die airbrake funktion nicht funktionieren.
Und irgendwie überblicke ich den advdupe code nicht.
Keks:Lua Code:
AddCSLuaFile("cl_init.lua"); AddCSLuaFile("shared.lua"); include('entities/base_wire_entity/init.lua'); include("shared.lua"); function ENT:SpawnFunction( ply, tr ) if ( !tr.Hit ) then return end local SpawnPos = tr.HitPos + tr.HitNormal * 16 local ent = ents.Create( "gravtogglecontroller" ) ent:SetPos( SpawnPos ) ent:Spawn() ent:Activate()return ent
end
function ENT:Initialize() self.Entity:SetModel( "models/Combine_Helicopter/helicopter_bomb01.mdl" ); self.Entity:PhysicsInit( SOLID_VPHYSICS ) // Make us work with physics, self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) // after all, gmod is a physics self.Entity:SetSolid( SOLID_VPHYSICS ) // Toolbox local phys = self.Entity:GetPhysicsObject() if (phys:IsValid()) then phys:Wake()end
self.Inputs = Wire_CreateInputs( self.Entity, { "Activate" , "Airbrake" } )end
function ENT:UpdateTransmitState() return TRANSMIT_ALWAYS end; function ENT:TriggerInput(iname, value) local ent = self.Entity if(iname == "Activate") then if((value or 0) >= 1) then ent:GetPhysicsObject():EnableGravity(false)else
ent:GetPhysicsObject():EnableGravity(true)end
end
if(iname == "Airbrake") thenself.passive = value
end
end
function ENT:PhysicsUpdate( physobj ) local vel = physobj:GetVelocity() if self.passive and self.passive > 0 then if self.passive > 100 then self.passive = 100 end vel = vel * ((100.0 - self.passive)/100.0)end
physobj:SetVelocity(vel)end
function ENT:OnRemove() local ent = self.Entity ent:GetPhysicsObject():EnableGravity(true)end
BLARGH
includes/modules/constraint.lua:1625: attempt to index local 'ent' (a function value)
Lua Code:
AddCSLuaFile("cl_init.lua"); AddCSLuaFile("shared.lua"); include('entities/base_wire_entity/init.lua'); include("shared.lua"); function ENT:SpawnFunction( ply, tr ) if ( !tr.Hit ) then return end local SpawnPos = tr.HitPos + tr.HitNormal * 16 local ent = ents.Create( "gravtogglecontroller" ) ent:SetPos( SpawnPos ) ent:Spawn() ent:Activate()return ent
end
function ENT:Initialize() self.Entity:SetModel( "models/Combine_Helicopter/helicopter_bomb01.mdl" ); self.Entity:PhysicsInit( SOLID_VPHYSICS ) // Make us work with physics, self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) // after all, gmod is a physics self.Entity:SetSolid( SOLID_VPHYSICS ) // Toolbox local phys = self.Entity:GetPhysicsObject() if (phys:IsValid()) then phys:Wake()end
self.Inputs = Wire_CreateInputs( self.Entity, { "Activate" , "Airbrake" } )end
function ENT:UpdateTransmitState() return TRANSMIT_ALWAYS end; function ENT:TriggerInput(iname, value) local ConstrainedEntities = constraint.GetAllConstrainedEntities( Entity ) if(iname == "Activate") then for _, ent in pairs( ConstrainedEntities ) do if((value or 0) >= 1) then constr.Entity:GetPhysicsObject():EnableGravity(false)else
constr.Entity:GetPhysicsObject():EnableGravity(true)end
end
end
if(iname == "Airbrake") thenself.passive = value
end
end
function ENT:PhysicsUpdate( physobj ) local vel = physobj:GetVelocity() if self.passive and self.passive > 0 then if self.passive > 100 then self.passive = 100 end vel = vel * ((100.0 - self.passive)/100.0)end
physobj:SetVelocity(vel)end
function ENT:OnRemove() constr.Entity:GetPhysicsObject():EnableGravity(true)end