ULX

Author Topic: SuperPowers - Set run speed and jump power of players. Update! (v1.1, SVN only)  (Read 24697 times)

0 Members and 3 Guests are viewing this topic.

Offline RynO-SauruS

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 17
SuperPowers is an addon for ULX that adds two commands, 'ulx runspeed', and 'ulx jumppower'.
'ulx runspeed' sets the run speed of the specified players to the specified number.

Usage:
ulx runspeed <player(s)> <run speed>
('ulx runspeed ^ 2000' would make you run extremely fast.)


'ulx jumppower' sets the jump power of the specified players to the specified number.

Usage:
ulx jumppower <player(s)> <jump power>
('ulx jumppower ^ 2000' would make you jump like The Incredible Hulk.)


I've attached versions for both non-SVN and SVN versions of ULX/ULib.

Installation:
Extract to addons.


Thanks to JamminR for the name.

EDIT:
Update! Version 1.1, added ability to set runspeed/jumppower based on usergroup of players.
This version is for ULX SVN only, because the old 'release' version of ULib is missing a function I need. (This is still being looked into)
I attached the new one and kept the old one incase you don't need this.

To set the runspeed for a certain group, put ulx_runspeed_<groupname> <speed> in your server.cfg file. (Works for custom groups too.  ;))
Do the same for jumppower, only put jumppower instead of runspeed.
Here are examples of how this is done, including all default groups (Zero or less disables auto-set):

ulx_runspeed_superadmin "1000"
ulx_runspeed_admin "1000"
ulx_runspeed_user "0"
ulx_runspeed_operator "0"

ulx_jumppower_superadmin "500"
ulx_jumppower_admin "500"
ulx_jumppower_user "0"
ulx_jumppower_operator "0"

« Last Edit: February 23, 2010, 04:43:27 PM by RynO-SauruS »


YouTube music player by RynO-SauruS

Offline Gmods

  • Newbie
  • *
  • Posts: 43
  • Karma: 2
Re: SuperPowers - Set run speed and jump power of players.
« Reply #1 on: February 02, 2010, 12:46:55 PM »
I really like your releases RynO. Simple ideas but very handy. I'll be adding this to both my servers, thanks!

Offline RynO-SauruS

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 17
Re: SuperPowers - Set run speed and jump power of players.
« Reply #2 on: February 02, 2010, 02:24:10 PM »
Thank you!


YouTube music player by RynO-SauruS

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: SuperPowers - Set run speed and jump power of players.
« Reply #3 on: February 02, 2010, 03:26:28 PM »
Ha! I only gave some suggestions as to the name. No credit necessary. ;P
Ryno-Saurus's releases have been T-rex-iffic
(Sorry, couldn't resist)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline RynO-SauruS

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 17
Re: SuperPowers - Set run speed and jump power of players.
« Reply #4 on: February 02, 2010, 03:56:00 PM »
Thanks!  ;D


YouTube music player by RynO-SauruS

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: SuperPowers - Set run speed and jump power of players.
« Reply #5 on: February 15, 2010, 07:46:52 PM »
Just looked over the SVN version code and have a programmer's tip.
Returning true, or actually using return at all for these specific functions, isn't necessary.
:)

"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline stanlee

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
    • XtremeServerGaming
Re: SuperPowers - Set run speed and jump power of players.
« Reply #6 on: February 20, 2010, 05:32:28 PM »
RynO, could you make this set the values of jump/speed for certain usergroups?
This would really be useful for the premium members of my roleplay server.
I could just set the group "Premium" to a higher jump/speed.
You get what I mean  8)

Anyways, this is a great addon!
ADD ME ON STEAM:   sirusmaximu
I'm always in the need of good lua coders!

Offline RynO-SauruS

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 17
Re: SuperPowers - Set run speed and jump power of players.
« Reply #7 on: February 20, 2010, 07:12:10 PM »
Thanks for the compliment. I think UTeam has the ability to set the run speed based on usergroup, but I don't know if it can set the jump power..
Changing SuperPowers to set them based on usergroups might require code for reading settings from a text table like UTeam does with UTeam.txt, which I've never done before.
I might look into it.


YouTube music player by RynO-SauruS

Offline stanlee

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
    • XtremeServerGaming
Re: SuperPowers - Set run speed and jump power of players.
« Reply #8 on: February 21, 2010, 06:56:28 AM »
Thanks for the compliment. I think UTeam has the ability to set the run speed based on usergroup, but I don't know if it can set the jump power..
Changing SuperPowers to set them based on usergroups might require code for reading settings from a text table like UTeam does with UTeam.txt, which I've never done before.
I might look into it.

Do it do it!!
:D
ADD ME ON STEAM:   sirusmaximu
I'm always in the need of good lua coders!

Offline RynO-SauruS

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 17
Re: SuperPowers - Set run speed and jump power of players.
« Reply #9 on: February 23, 2010, 04:26:46 PM »
Ok, about the 'auto-set runspeed/jumppower by usergroup' thing. I've actually written a working one of the SVN version, it creates CVARs for every group like this (it will create them for custom groups, too.  ;)):

ulx_runspeed_superadmin
ulx_runspeed_admin
ulx_runspeed_user
ulx_runspeed_operator

ulx_jumppower_superadmin
ulx_jumppower_admin
ulx_jumppower_user
ulx_jumppower_operator

And if you set these greater than zero, and a player belongs to the right usergroup, it will set their runspeed or jumppower accordingly, on their FIRST spawn.
If you change these during gameplay, the player will have to reconnect or change it manually via !runspeed or !jumppower.
I made it like this so if a person wants to have a different runspeed or jumppower than the default for their group, they can use the regular command to
change it manually, and it won't reset when they die. The problem is, I need the function Player:GetUserGroup() for this to work,
and only the SVN version has this function! (it doesn't come with gmod either)
The way this works is, I hook into PlayerInitialSpawn and retrieve what's stored in the CVAR for whatever usergroup they're in.
To make a version of this for non-SVN, I need some other method of doing this without Player:GetUserGroup().. *looks at JamminR and Megiddo*
I guess I'll go ahead and upload the one I made for SVN ULX/ULib..

Oh, by the way JamminR, thanks for the developers tip, I removed 'return true'.  ;)
« Last Edit: February 23, 2010, 04:46:12 PM by RynO-SauruS »


YouTube music player by RynO-SauruS

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given