• Print

Author Topic: Change sv_gravity  (Read 5766 times)

0 Members and 1 Guest are viewing this topic.

Offline simpleee

  • Newbie
  • *
  • Posts: 13
  • Karma: 1
Change sv_gravity
« on: December 21, 2013, 08:16:54 am »
Hello,
How can i change the world gravity with lua?

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Change sv_gravity
« Reply #1 on: December 21, 2013, 08:41:55 am »
I believe you would use something like RunConsoleCommand
Something like this:
Code: Lua
  1. RunConsoleCommand( "sv_gravity", 600 )
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Change sv_gravity
« Reply #2 on: December 21, 2013, 04:48:45 pm »
http://wiki.garrysmod.com/page/Global/RunConsoleCommand
Though the mauritis site in this case was correct, it hosts the mostly Gmod lua commands prior to Gmod13.
Gmod 13 changed A LOT of G-Lua, so I'd recommend searching it before using the mauritis commands.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Change sv_gravity
« Reply #3 on: December 21, 2013, 05:58:46 pm »
http://wiki.garrysmod.com/page/Global/RunConsoleCommand
Though the mauritis site in this case was correct, it hosts the mostly Gmod lua commands prior to Gmod13.
Gmod 13 changed A LOT of G-Lua, so I'd recommend searching it before using the mauritis commands.

I know, JamminR. I double-checked with the official wiki. It's just in this case I like Maurits' layout better, and since I knew it worked as it should then I linked it.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline TheAndroid1

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Change sv_gravity
« Reply #4 on: December 22, 2013, 05:54:32 am »
I believe you would use something like RunConsoleCommand
Something like this:
Code: Lua
  1. RunConsoleCommand( "sv_gravity", 600 )
That is right, except the 600 needs to be a string.

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Change sv_gravity
« Reply #5 on: December 22, 2013, 06:07:49 am »
That is right, except the 600 needs to be a string.

Pretty sure numbers aren't restricted to that. I just tested without the quotes (aka not as a string), and it works fine.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

  • Print