Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: Swompie on July 08, 2010, 02:48:40 pm

Title: Almighty Gravity changer
Post by: Swompie on July 08, 2010, 02:48:40 pm
Author: Swompie (Mini thx to Curt` for some RegEx help)
Server version: 2.6.5 or higher
Command: /g NN (where NN represents a number; synonyms are /grav and /gravity)

Here's the source for the Almighty Gravity changer:
Code: (pascal) [Select]
const
    OnGravChangeNotice = true; // set to true to display a message to all players when gravity has changed
    Color = $FFFFFF; // color of the message

function OnCommand(ID: byte; Text: string): boolean;
var g: integer;
begin
  result := false;
  if (RegExpMatch('^/(g|grav|gravity) (-?\d+)', lowercase(Text))) then begin
    g := strtoint(GetPiece(Text, ' ', 1));
    ServerModifier('Gravity', g * 0.0006);
    if OnGravChangeNotice then
      WriteConsole(0, 'Gravity changed to ' + inttostr(g) + '%', Color);
    exit;
  end;
end;

Use /g 100 for default gravity!
Have fun making the people in your server beeing "WTF!" when you change the gravity ;)
Title: Re: Almighty Gravity changer
Post by: PKS|Shooter on July 08, 2010, 05:57:57 pm
download link?
Title: Re: Almighty Gravity changer
Post by: croat1gamer on July 08, 2010, 06:02:23 pm
Just copy and paste it in the .pas file.

Though, i think there is already one.
Title: Re: Almighty Gravity changer
Post by: Swompie on July 09, 2010, 06:10:31 am
download link?
Attached it for the lazy ones ;)

Though, i think there is already one.
Yes, but it's using the GetKeyPress() function iirc.
Title: Re: Almighty Gravity changer
Post by: mich1103 on July 09, 2010, 02:56:42 pm
I like this script, its very usefull !
But this command work for all or only for admin ?
Title: Re: Almighty Gravity changer
Post by: Swompie on July 09, 2010, 03:24:58 pm
Second part of your question.
Title: Re: Almighty Gravity changer
Post by: mich1103 on July 09, 2010, 03:38:58 pm
Ok so where's the part who say that there is only for admin ?
Title: Re: Almighty Gravity changer
Post by: the halo fan on July 09, 2010, 09:57:16 pm
As far as i know theres only a soldat server 2.6.5. you have 2.6.6.?
Title: Re: Almighty Gravity changer
Post by: Swompie on July 10, 2010, 05:11:14 am
Somewhat always makes me think it's 266, don't ask me what it was. Anyways, fixed.
Title: Re: Almighty Gravity changer
Post by: dnmr on July 10, 2010, 08:32:26 am
Ok so where's the part who say that there is only for admin ?
http://enesce.com/help/html/Events/OnCommand.html
Title: Re: Almighty Gravity changer
Post by: mich1103 on July 10, 2010, 08:36:46 am
Ok thanks  ;D
so this kind of command can be called by arsse ?
Title: Re: Almighty Gravity changer
Post by: Swompie on July 10, 2010, 08:41:16 am
Yes..
Title: Re: Almighty Gravity changer
Post by: mich1103 on July 10, 2010, 08:47:50 am
so i can do like
Code: [Select]
procedure ActivateServer();
begin
Command('/g 60');
end;

Title: Re: Almighty Gravity changer
Post by: frosty on July 11, 2010, 01:23:53 pm
very nice, much better than my gravity script :D