Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: Mr on September 06, 2008, 03:55:05 am

Title: [Function] AddSpaces
Post by: Mr on September 06, 2008, 03:55:05 am
Script Name: AddSpaces
Script Description: This function allows you to add spaces to... meh, whatever, look at the attached screenshot
Original Author(s): Mr
Core Version: 2.2.X

Code: [Select]
{ Mr's AddSpaces }
function AddSpaces(Text: string; tlen: integer): string;
var
  i,Spacecount: integer;
  Spaces: string;
begin
  Spacecount := length(Text);
  for i := 0 to (tlen-Spacecount) do Spaces := Spaces+' ';
  Result := Spaces;
end;
If you don't always want to write the string that you want to use with my function twice, just change Result := Spaces; to Result := Text+Spaces;

Usage example:
Code: [Select]
WriteConsole(ID,GetPlayerStat(i,'Name')+AddSpaces(GetPlayerStat(i,'Name'),26)+iif(GodMode[i],'On','Off'),RGB(0,245,245));

- Mr
Title: Re: [Function] AddSpaces
Post by: Norbo on September 06, 2008, 04:45:17 am
whats the point? you can just press space to add spaces...
Title: Re: [Function] AddSpaces
Post by: EnEsCe on September 06, 2008, 04:48:51 am
It will dynamically add the right amount of spaces. Nice work Mr, simple and effective ;)
Title: Re: [Function] AddSpaces
Post by: Mr on September 06, 2008, 05:23:43 am
I updated the first post... I don't think that someone wants to calculate the amount of spaces that are needen for another string xD

Btw, thanks EnEsCe :)
Title: Re: [Function] AddSpaces
Post by: rayanaga on September 06, 2008, 09:02:27 am
Wow. Nice Work Mr.

Great for organizing console writes.
Title: Re: [Function] AddSpaces
Post by: DorkeyDear on September 08, 2008, 05:29:02 am
I have a similar function created a while ago, called Table. If you want to take a look: http://forums.soldat.pl/index.php?topic=26687
Good job though, nice clean and simple.