PDA

View Full Version : Procedure SetUserNicks(Active: Boolean);



Macrosoft
10-14-2007, 03:53 PM
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); (http://www.villavu.com/forum/showthread.php?t=19089)

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
10-14-2007, 03:56 PM
I don't understand :)

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

mastaraymond
10-14-2007, 03:57 PM
The Cow made a script like this... Must be somewhere ^^.

Macrosoft
10-14-2007, 03:59 PM
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
10-14-2007, 04:00 PM
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
10-14-2007, 04:03 PM
thanks, hope this goes into srl, its really useful (stupid leechers dont know how to set a nick)

Wizzup?
10-14-2007, 05:18 PM
thanks, hope this goes into srl, its really useful (stupid leechers dont know how to set a nick)

Then they should not auto. :)

Macrosoft
10-27-2007, 02:35 PM
agreed...


comments on procedure?

Rikje
10-27-2007, 05:00 PM
Nice procedure!, i like it :)
and a nice piece of code :)

Macrosoft
10-27-2007, 05:04 PM
thanks

Macrosoft
11-14-2007, 10:16 PM
dont you love how my scripts always get so many views, yet such little feedback?

wearenot
11-16-2007, 09:09 AM
ok so let me get this straight
this procedure automatically set your nickname?

Ownt?
11-16-2007, 09:27 AM
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
11-16-2007, 08:34 PM
ok so let me get this straight
this procedure automatically set your nickname?

yep