Hey guys,
I want to make the train fuck plugin working in my server..
but when i spawn the train, the train is stuck with the wall
[IMG]http://image.noelshack.com/fichiers/2014/26/1403600294-trainfuck.jpg[/IMG]
[lua]
------------------------------ Train Fuck -----------------------------
function SpawnTrain( Pos, Direction ,Target)
local train = ents.Create( "prop_physics" )
train:SetModel("models/props_trainstation/train001.mdl")
train:SetAngles( Direction:Angle() + Angle(0,270,0) )
train:SetPos( Pos )
train:Spawn()
train:Activate()
train:GetPhysicsObject():EnableGravity( false)
train:EmitSound( "ambient/alarms/train_horn2.wav", 100, 100 )
train:GetPhysicsObject():SetMass(50000)
constraint.NoCollide(train, GetWorldEntity())
train:GetPhysicsObject():SetVelocity( Direction * 10000 )
train.FuckTarget = Target
if(FUCKING_TRAINS == nil)then
FUCKING_TRAINS = {}
end
table.insert(FUCKING_TRAINS,train)
timer.Create( "TrainRemove_"..CurTime(), 5, 1, function() if not IsValid(train) then return end train:Remove() end)
end
hook.Add("Think","ControlTrainsBusyFucking",function()
if(FUCKING_TRAINS != nil)then
for k,v in pairs(FUCKING_TRAINS) do
if(v == nil)then table.remove(FUCKING_TRAINS,k) return end
local dir = (v.FuckTarget:GetPos() - v:GetPos())
v:GetPhysicsObject():ApplyForceOffset(dir:Angle():Forward()*1000,v:GetPos() + v:GetForward()*400)
end
end
end)
function ulx.trainfuck( calling_ply, target_plys )
for _, pl in ipairs( target_plys, calling_ply ) do
local Hp = pl:Health()
local Dif = Hp - 20
local HpOut = Hp - Dif
local HpSur = Hp + Dif
pl:SetMoveType( MOVETYPE_WALK )
pl:GodDisable()
pl:SetHealth(HpOut)
SpawnTrain( pl:GetPos() + pl:GetForward() * 1000 + Vector(0,0,50), pl:GetForward() * -1,pl )
pl:GodDisable()
pl:SetMoveType( MOVETYPE_WALK )
timer.Create( "trainKillNot_", 6.5, 1, function( target_plys )
if pl:Alive() then pl:SetHealth(HpSur) else end
end )
end
ulx.fancyLogAdmin( calling_ply, "#A trainfucked #T", target_plys )
end
local trainfuck = ulx.command( "Fedora's Goodies", "ulx trainfuck", ulx.trainfuck, "!trainfuck" )
trainfuck:addParam{ type=ULib.cmds.PlayersArg }
trainfuck:defaultAccess( ULib.ACCESS_ADMIN )
trainfuck:help( "Fuck a player with a train." )
[/lua]
Why do you need this to help admin your server?
Don't use prop_physics, use an effect that spawns a clientside model that passes through you.
This sounds like a trainfuck.
@BFG9000 can you explain better?
[QUOTE=Anyome;45201950]@BFG9000 can you explain better?[/QUOTE]
Yeah, just make a new effect class. On initialize create the clientside train model and angle it towards the player, which ideally would be passed in EffectData:SetEntity. Then offset the train in the angle it's pointing at a consistent rate under Render() (remember to use FrameTime) until it is done passing through the player. Then slay the player outside of the effect in the midst of it all.
@BFG9000
Can you accept me on steam?
I sent you a request, but you didn't accept me yet.
[url]http://steamcommunity.com/id/bl4cksm1thx[/url]
Thanks you x3
Sorry, you need to Log In to post a reply to this thread.