Author Topic: Name Checking  (Read 965 times)

0 Members and 1 Guest are viewing this topic.

Offline K_Sparkz

  • Major(1)
  • Posts: 13
Name Checking
« on: June 13, 2008, 08:35:23 am »
How do u check if a Nick contains a certain piece of text??

is it possible to use the ContainString funcktion?? so far I can only make it work if the nick is the exact same as the given text...

Offline NTxC

  • Major(1)
  • Posts: 34
  • Scripter
Re: Name Checking
« Reply #1 on: June 13, 2008, 08:52:37 am »
Code: [Select]
procedure OnJoinGame(ID, Team: byte);
begin
   //
   if(ContainsString('text',GetPlayerStat(ID,'Name'))=true) then begin
     // Commands to do if the check returns True
   end else begin
     // Commands to do if the check returns False
   end;
   //
end;

Replace 'text' with desired string. ;)
:[ NT-Online Server Mod Coming Up! ]:
________________________________
Featuring:
- Admin System with dynamic ranks and privileges...
- Duel System...
- Reward System - earn rewards for your frags...
- CVARs - configuration variables - to make the server administering easier...

... and more! Coming soon!

Offline K_Sparkz

  • Major(1)
  • Posts: 13
Re: Name Checking
« Reply #2 on: June 13, 2008, 09:38:56 am »
Sweet.. thx for quick reply.!

Hmm doesnt seem to work after all... although it does work onJoinTeam with the exact same nick as the text

Quote
Procedure OnJoinTeam(ID, Team: byte);
begin
   if(ContainsString('kebab',GetPlayerStat(ID,'Name'))) then begin
   SayToPlayer(ID,'You name is not allowed');
  end;
end;
Where the nick im using is "kebab"... as it stands there its works.. but if I change text to f.eks.
Quote
if(ContainsString('keb',GetPlayerStat(ID,'Name'))) then begin
then it doesnt work....
« Last Edit: June 13, 2008, 09:55:20 am by K_Sparkz »

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Name Checking
« Reply #3 on: June 13, 2008, 11:45:49 am »
You're checking if 'keb' contains your name, should be if your name contains 'keb'...
Code: [Select]
if ContainsString(GetPlayerStat(ID,'Name'), 'kebab')) then begin
« Last Edit: June 13, 2008, 12:05:39 pm by Boblekonvolutt »

Offline K_Sparkz

  • Major(1)
  • Posts: 13
Re: Name Checking
« Reply #4 on: June 13, 2008, 11:51:40 am »
That makes perfect sense... thx

Offline NTxC

  • Major(1)
  • Posts: 34
  • Scripter
Re: Name Checking
« Reply #5 on: June 13, 2008, 12:04:07 pm »
Yeah, sorry, I haven't tested it. Wrote it from a scratch ;)
:[ NT-Online Server Mod Coming Up! ]:
________________________________
Featuring:
- Admin System with dynamic ranks and privileges...
- Duel System...
- Reward System - earn rewards for your frags...
- CVARs - configuration variables - to make the server administering easier...

... and more! Coming soon!