SRL Archive - Research & Development Lounge

Procedure SetUserNicks(Active: Boolean);


Macrosoft

2007-10-14 11:53:02

Well, I have decided to post this procedure in this section as well as the SRL Members section because I want more people to use it!

This is the thread in the "SRL New Functions" section (SRL Members only):
Procedure SetUserNicks(Active: Boolean);

This procedure sets the user nicks for you! If "active" is false, the characters in which nicks can not be made from their usernames(ex: la la la), will become non-active (Players[].Active:=False). If "active" is true, they will remain active, even if a nick name can not be created.

I dont know if this has already been made, so let me no if it has.

{*******************************************************************************
Procedure SetUserNicks(Active: Boolean);
By: Macrosoft
Description: Will set the nickname for all the players in your script. If Active is set as false,
then if a player's username cannot be used to make a nickname, the player will become not active.
*******************************************************************************}

Procedure SetUserNicks(Active: Boolean);

var
counter: integer;
n, a, x, NameLength: integer;
cName: array of char;
nName: array[0..2] of char;
begin
a:=GetArrayLength(Players);
for n:= 0 to a-1 do
begin
Counter:=2;
x:=0
NameLength:=Length(Players[n].Name);
SetArrayLength(cName, NameLength + 1);
repeat
begin
cName[Counter-1]:=StrGet(Players[n].Name, Counter);
if(cName[Counter-1] = ' ')then
begin
x:=0;
Counter:=Counter+1;
end else
begin
nName[x]:=cName[Counter-1];
x:=x+1;
end;
Counter:=Counter+1;
end;
until(Counter=NameLength + 2) or (x=3);
if(Counter=NameLength + 2)then
begin
writeln('Nickname can not be made from the username: ' + Players[n].Name);
if(Active=False) then
begin
writeln(Players[n].Name + ' is no longer active');
Players[n].Active:=False;
end;
end else
begin
Players[n].Nick:= nName[0] + nName[1] + nName[2];
writeln(Players[n].Name +#39+ 's nickname has been set to: ' + Players[n].Nick);
end;
end;
end;

Feel free to use this but remember to Credit Me!

Give Me Feedback!

Harry

2007-10-14 11:56:24

I don't understand :)

But what is this accidentally sets your nick with a captial letter?

mastaraymond

2007-10-14 11:57:42

The Cow made a script like this… Must be somewhere ^^.

Macrosoft

2007-10-14 11:59:16

From: Hy71194
I don't understand :)

But what is this accidentally sets your nick with a captial letter?


look at the code, it wont

if there is a space, x will be set to 0 and the next char will be skipped

Harry

2007-10-14 12:00:01

From: mastaraymond
The Cow made a script like this… Must be somewhere ^^.


It is Mad Cow ;)

Yeah, something like this was in SB100's powerskillz. Nice code though, good job.

Macrosoft

2007-10-14 12:03:47

thanks, hope this goes into srl, its really useful (stupid leechers dont know how to set a nick)

Wizzup?

2007-10-14 13:18:54

From: Macrosoft
thanks, hope this goes into srl, its really useful (stupid leechers dont know how to set a nick)


Then they should not auto. :)

Macrosoft

2007-10-27 10:35:02

agreed…


comments on procedure?

Rikje

2007-10-27 13:00:29

Nice procedure!, i like it :)
and a nice piece of code :)

Macrosoft

2007-10-27 13:04:26

thanks

Macrosoft

2007-11-14 17:16:24

dont you love how my scripts always get so many views, yet such little feedback?

wearenot

2007-11-16 04:09:44

ok so let me get this straight
this procedure automatically set your nickname?

Ownt?

2007-11-16 04:27:39

Nice coding. I really don't think that people who don't have the time to learn how to set their own nickname should really be spoon fed the answers though =\
Still, nice procedure.

Macrosoft

2007-11-16 15:34:44

From: wearenot
ok so let me get this straight
this procedure automatically set your nickname?


yep