AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Parse out clan name (https://forums.alliedmods.net/showthread.php?t=60924)

Sun_Blood 09-16-2007 14:39

Parse out clan name
 
Hello

How can I check if a player is a member of the |sun| clan?
for exampel I want to take this list and only get a match on the first 2 names

|sun|lala
|sun| lala
|gas|ala
|lps*|la


Code:

if (clan is "|sun|") {
//do somthing
}


ConnorMcLeod 09-16-2007 15:36

Re: Parse out clan name
 
Try this :

Code:
new g_tag[] = "|sun|" public client_connect(id) {     static name[32]     get_user_name(id, name, sizeof name - 1)     if( equali(name, g_tag, sizeof g_tag) )     {         //do stuff here     } }

Zenith77 09-16-2007 17:08

Re: Parse out clan name
 
Quote:

Originally Posted by connorr (Post 531999)
Try this :

Code:
new g_tag[] = "|sun|" public client_connect(id) {     static name[32]     get_user_name(id, name, sizeof name - 1)     if( equali(name, g_tag, sizeof g_tag) )     {         //do stuff here     } }

@connorr: That's not quite right ;). Just one native off!

You could've looked in my Clan Tryout System, or a host of other plugins. But the code is so easy, I'll just post it here (this is adapting off what connorr originally posted):

Code:
new gTag[] = "sun|"; public client_connect(id) {      new name[32];      get_user_name(id, name, sizeof(name)-1);      if (containi(name, gTag) > -1)      {            // Code here.      } }

You could also make it read from a file full of clan names, just as a suggestion for multiple clan tags.

ConnorMcLeod 09-16-2007 17:15

Re: Parse out clan name
 
Oh i was thinking that equali was checking from name[0] to name[sizeof g_tag], in that case 5.
Please explain me what's wrong here.
Thanks.

Zenith77 09-16-2007 17:19

Re: Parse out clan name
 
Quote:

Originally Posted by connorr (Post 532049)
Oh i was thinking that equali was checking from name[0] to name[sizeof g_tag], in that case 5.
Please explain me what's wrong here.
Thanks.

PlayerNameHere|sun

'nuff said.

djmd378 09-16-2007 18:24

Re: Parse out clan name
 
1 Attachment(s)
I sorta kinda made this for what you want but just for the OwnageClan (Ownage | ) because of their servers where you connect and you are automatically renamed to have their tag and your keys rebind.


Anyways, just edit to your needs since I don't feel like it.

Sun_Blood 09-17-2007 15:32

Re: Parse out clan name
 
Thanks for the response but there is one problem.
I failed to say in my first post (sorry) that the name of the players is already in a string.

So I have an array whit the nicks and I want to check if the user I am currently working whit is in the clan |sun|.

So
Code:

nickname[] = |sun|lalala
tag[] = |sun|

if (tag[i] is in nickname[i])  {
        //do code
}


Zenith77 09-17-2007 17:15

Re: Parse out clan name
 
Quote:

Originally Posted by Sun_Blood (Post 532383)
Thanks for the response but there is one problem.
I failed to say in my first post (sorry) that the name of the players is already in a string.

So I have an array whit the nicks and I want to check if the user I am currently working whit is in the clan |sun|.

So
Code:

nickname[] = |sun|lalala
tag[] = |sun|

if (tag[i] is in nickname[i])  {
        //do code
}


Look at my code I posted.


All times are GMT -4. The time now is 16:08.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.