• Print

Author Topic: Request for a Rebuilt CMD  (Read 6692 times)

0 Members and 1 Guest are viewing this topic.

Offline JelloMoto

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Request for a Rebuilt CMD
« on: September 20, 2013, 09:46:30 pm »
It's an old one, one called Train****. I've gathered some codes, but couldn't get it to run.
Code: Lua
  1. function SpawnTrain( Pos, Direction )
  2.         local train = ents.Create( "prop_physics" )
  3.         train:SetModel("models/props_vehicles/train_boxcar.mdl")
  4.         train:SetAngles( Direction:Angle() )
  5.         train:SetPos( Pos )
  6.         train:Spawn()
  7.         train:Activate()
  8.         train:EmitSound( "ambient/alarms/train_horn2.wav", 100, 100 )
  9.         train:GetPhysicsObject():SetVelocity( Direction * 100000 )
  10.        
  11.         timer.Create( "TrainRemove_"..CurTime(), 5, 1, function() if not IsValid(train) then return end train:Remove() end)
  12. end
  13.  
  14. function ulx.trainfuck( calling_ply, target_plys )
  15.         for _, pl in ipairs( target_plys, calling_ply ) do
  16.                
  17.                 local Hp = pl:Health()
  18.                 local Dif = Hp - 20
  19.                 local HpOut = Hp - Dif
  20.                 local HpSur = Hp + Dif
  21.                
  22.                 pl:SetMoveType( MOVETYPE_WALK )
  23.                 pl:GodDisable()
  24.                 pl:SetHealth(HpOut)
  25.                 SpawnTrain( pl:GetPos() + pl:GetForward() * 1000 + Vector(0,0,50), pl:GetForward() * -1 )
  26.                 pl:GodDisable()
  27.                 pl:SetMoveType( MOVETYPE_WALK )
  28.                
  29.                 timer.Create( "trainKillNot_", 6.5, 1, function( target_plys )
  30.                         if pl:Alive() then pl:SetHealth(HpSur) else end
  31.                 end )
  32.                
  33.         end
  34.  
  35.         ulx.fancyLogAdmin( calling_ply, "#A trainfucked #T", target_plys )
  36. end
  37.  
  38. local trainfuck = ulx.command( "Fun", "ulx trainfuck", ulx.trainfuck, "!trainfuck" )
  39. trainfuck:addParam{ type=ULib.cmds.PlayersArg }
  40. trainfuck:defaultAccess( ULib.ACCESS_ADMIN )
  41. trainfuck:help( "<censor> a player with a train." )

Here is one, but the timer created didn't remove the train.
Tryed making it a timer.Simple, but couldn't get it to work


Code: Lua
  1. ------------------------------ TrainFuck ------------------------------
  2. function ulx.trainfuck( calling_ply, target_plys, amount )
  3.         if target_plys:IsValid() then
  4.         local train = ents.Create( "prop_physics" )
  5.     train:SetModel( "models/props_vehicles/train_boxcar.mdl" )
  6.     train:SetAngles( Angle( 0, 90,0 ) )
  7.     train:SetPos( target_plys:GetPos() )
  8.     train:Spawn()
  9.     train:EmitSound( "ambient/alarms/train_horn2.wav", 100, 100 )
  10.     train:GetPhysicsObject():SetVelocity( v:GetForward() / 50000 - Vector( 0, 10000, 0 ) )
  11.                      
  12.                        timer.Simple( 5, function() train:Remove() end )
  13. end
  14.        
  15.        
  16.         ulx.fancyLogAdmin( calling_ply, "trainfuck", target_plys, amount )
  17. end
  18. local <censor> = ulx.command( CATEGORY_NAME, "ulx trainfuck", ulx.trainfuck, "!trainfuck" )
  19. <censor>:addParam{ type=ULib.cmds.PlayersArg }
  20. <censor>:addParam{ type=ULib.cmds.NumArg, min=0, max=255, hint="<censor>", ULib.cmds.round }
  21. <censor>:defaultAccess( ULib.ACCESS_ADMIN )
  22. <censor>:help( "<censor> a player with a train." )



« Last Edit: September 30, 2013, 07:38:00 am by jay209015 »

Offline iSnipeu

  • Jr. Member
  • **
  • Posts: 83
  • Karma: 12
Re: Request for a Rebuilt CMD
« Reply #1 on: September 21, 2013, 05:00:27 am »
"<censor>"

lol what?

Oh I see, the forum filters the F word and the C word (for guys).
« Last Edit: September 21, 2013, 05:03:33 am by iSnipeu »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Request for a Rebuilt CMD
« Reply #2 on: September 21, 2013, 05:43:26 am »
Given the age of many Gmod users, we try to keep the forums appropriate for them.

Besides horrible indentation, your code seems like it should work; do you get any errors from the timer?
Experiencing God's grace one day at a time.

Offline JelloMoto

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: Request for a Rebuilt CMD
« Reply #3 on: September 21, 2013, 09:31:12 am »
With the first code, I
Quote
Here is one, but the timer created didn't remove the train.
and the train didnt move, it was frozen..                      In the second one, the Train didn't spawn


This code bugged alot of things, Ill try it again, and ill tell you the errors.
« Last Edit: September 21, 2013, 10:27:34 am by JelloMoto »

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Re: Request for a Rebuilt CMD
« Reply #4 on: September 28, 2013, 08:01:22 pm »
What this command is supposed to do is spawn a train and launch it at a player.

The error that happens is that the train spawns fine and emits sound but it seems to not actually have any physics attached to it, so players can walk through it and stuff like that.

I would suggest trying... " train:PhysicsInit( SOLID_BBOX ) ", and seeing if that works.
I cry every time I see that I am not a respected member of this community.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Request for a Rebuilt CMD
« Reply #5 on: September 29, 2013, 04:16:40 pm »
I'm extremely novice any any of the train code effects/physics, but from my memory from years ago, the train would purposely pass through everything/anyone 'but' the player it was launched at.
This allowed it to spawn mid-building, and not injure 'innocent' players.
No idea how that was done. I imagine if you tied physics to it, you'd have to make it intelligent to noclip through everything except for the player, and maybe world underneath it.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Re: Request for a Rebuilt CMD
« Reply #6 on: October 01, 2013, 09:41:20 pm »
I'm extremely novice any any of the train code effects/physics, but from my memory from years ago, the train would purposely pass through everything/anyone 'but' the player it was launched at.
This allowed it to spawn mid-building, and not injure 'innocent' players.
No idea how that was done. I imagine if you tied physics to it, you'd have to make it intelligent to noclip through everything except for the player, and maybe world underneath it.

I guess then constantly setting the trains position to make it look like its flying at a player instead of actually flinging it would work.
I cry every time I see that I am not a respected member of this community.

Offline PatPeter

  • Newbie
  • *
  • Posts: 14
  • Karma: -1
Re: Request for a Rebuilt CMD
« Reply #7 on: December 24, 2014, 02:31:45 pm »
This !train**** command does not work either. Does anyone have a working version?

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Request for a Rebuilt CMD
« Reply #8 on: December 26, 2014, 09:31:59 pm »
The original does work. It just doesn't remove the train.
Out of the Garry's Mod business.

Offline BobTheDuck69

  • Newbie
  • *
  • Posts: 33
  • Karma: 1
Re: Request for a Rebuilt CMD
« Reply #9 on: March 12, 2015, 11:56:01 am »
Me and a few buds are redoing the command ill see if i can help c:
~The friendly neighborhood duckie~

  • Print