Raised This Month: $ Target: $400
 0% 

get_clan_tag


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Empowers
BANNED
Join Date: Feb 2009
Location: Ukraine
Old 09-28-2009 , 08:27   get_clan_tag
Reply With Quote #1

I need to get clan tag from names of 2 or more players.

For example I have 2 names:

<GooD TEam> ANdy
<GooD TeaM> cANdy
Clan Tag should be <GooD TeaM>

or

RON 'killers
Tonny 'killers
Clan Tag should be 'killers

it can be any other names with same clan tags..

so i need something like this:
PHP Code:
new clantag[32]
get_clan_tag(clantag,31,name1,name2,name3...) 
Any suggestions?
Empowers is offline
Send a message via ICQ to Empowers
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 09-28-2009 , 08:30   Re: get_clan_tag
Reply With Quote #2

you must get the names of all players & then replace
PHP Code:
for(1<= g_MaxPlayersi++) 
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Empowers
BANNED
Join Date: Feb 2009
Location: Ukraine
Old 09-28-2009 , 08:43   Re: get_clan_tag
Reply With Quote #3

read my post fist =) and then answer ^^
Empowers is offline
Send a message via ICQ to Empowers
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-28-2009 , 08:53   Re: get_clan_tag
Reply With Quote #4

You can't do that, because clan tag format can differ from one to other, like <WTF> |WTF| 'WTF' .:WTF:. and so...all you can do is to get the name and check for symbols like "<|'." then take the string between that symbols.
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Empowers
BANNED
Join Date: Feb 2009
Location: Ukraine
Old 09-28-2009 , 10:56   Re: get_clan_tag
Reply With Quote #5

man... but if there A two names like:
<GooD TEam> ANdy
<GooD TeaM> GGg

So we can find the same <GooD TeaM> ???

I talking about comparing 2 or more names and finding the same part that must be a clan tag
Empowers is offline
Send a message via ICQ to Empowers
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 09-28-2009 , 11:20   Re: get_clan_tag
Reply With Quote #6

You could start comparing each cell separately from the beginning of the names and check when they don't match anymore. Somehow for only two players and why not more, there's a chance for:
"[ Best Team > Manny"
"[ Best Team > Molly"
So whether you were going to remove the tag, the guys would get names of "anny" and "olly".
SnoW is offline
Send a message via MSN to SnoW
Empowers
BANNED
Join Date: Feb 2009
Location: Ukraine
Old 09-28-2009 , 11:22   Re: get_clan_tag
Reply With Quote #7

i don't wanna to remove the rag =) just get to print it
Empowers is offline
Send a message via ICQ to Empowers
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-28-2009 , 11:48   Re: get_clan_tag
Reply With Quote #8

Quote:
Originally Posted by Empowers View Post
i don't wanna to remove the rag =) just get to print it
Well like SnoW said:

Quote:
Originally Posted by SnoW View Post
You could start comparing each cell separately from the beginning of the names and check when they don't match anymore. Somehow for only two players and why not more, there's a chance for:
"[ Best Team > Manny"
"[ Best Team > Molly"
So whether you were going to remove the tag, the guys would get names of "anny" and "olly".
Even if you are just printing it, the tag would still be wrong:
"[ Best Team > M"
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Empowers
BANNED
Join Date: Feb 2009
Location: Ukraine
Old 09-28-2009 , 12:58   Re: get_clan_tag
Reply With Quote #9

Quote:
"[ Best Team > Manny"
"[ Best Team > Molly"
ok.. that is the bug.. It doesn't matter for me

Someone give me the code of this. I need this funtion even with that bug.

+karma
Empowers is offline
Send a message via ICQ to Empowers
Old 09-29-2009, 09:40
Empowers
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-29-2009 , 13:05   Re: get_clan_tag
Reply With Quote #10

Code:
#include < amxmodx > #include < amxmisc > GetSimilarStringFromArray( const szStrings[ ][ ], const iTotalStrings, szOutput[ ], const iLen ) {     new szMatch[ 32 ], iMatchLength;     new iLongestMatchLength;         new i, j;     for( i = 0; i < iTotalStrings; i++ ) {         for( j = i + 1; j < iTotalStrings; j++ ) {             iMatchLength = GetSimilarStringFrom2( szStrings[ i ], szStrings[ j ], szMatch, charsmax( szMatch ) );             if( iMatchLength > iLongestMatchLength ) {                 iLongestMatchLength = iMatchLength;                 copy( szOutput, iMatchLength, szMatch );             }         }     }     return iLongestMatchLength; } GetSimilarStringFrom2( const szString1[ ], const szString2[ ], szOutput[ ], const iLen ) {     new iLen1 = strlen( szString1 );     if( !iLen1 ) {         return 0;     }         new iLen2 = strlen( szString2 );     if( !iLen2 ) {         return 0;     }         new iPos1, iPos2;     new bool:bMatched, iMatchLength;     new iLongestMatchLength;     for( iPos1 = 0; iPos1 < iLen1; iPos1++ ) {         bMatched = false;         for( iPos2 = 0; iPos2 < iLen2; iPos2++ ) {             if( szString1[ iPos1 ] == szString2[ iPos2 ] ) {                 bMatched = true;             }             else if( bMatched ) {                 iMatchLength = iPos2 - iPos1;                 if( iMatchLength > iLongestMatchLength ) {                     iLongestMatchLength = iMatchLength;                     copy( szOutput, iMatchLength, szString1[ iPos1 ] );                 }                 bMatched = false;             }         }     }     return iLongestMatchLength; } // Usage: public someFunction( ) {     new iPlayers[ 32 ], iNum;     get_players( iPlayers, iNum );         new szNames[ 32 ][ 32 ];     for( new i = 0; i < iNum; i++ ) {         get_user_name( iPlayers[ i ], szNames[ i ], charsmax( szNames[ ] ) );     }         new szClanTag[ 32 ];     GetSimilarStringFromArray( szNames, iNum, szClanTag, charsmax( szClanTag ) ); }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:33.


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