Apenas uma base, й provбvel que alguma coisa dк errado.
pawn Code:
GetClansCount()
{
new Name[MAX_PLAYER_NAME], ClansCount, Pos[2], Clans[50][MAX_PLAYER_NAME/2];
for(new i = 0, j = GetMaxPlayers(), k; i < j; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i, Name, sizeof Name);
Pos[0] = strfind(Name, "[");
Pos[1] = strfind(Name, "]");
if(Pos[0] != -1 && Pos[1] != -1 && (Pos[1] - Pos[0]) >= 1)
{
strmid(Clans[i], Name, Pos[0], Pos[1] + 1, MAX_PLAYER_NAME/2);
}
k = 0;
while(strlen(Clans[k]))
{
if(strcmp(Clans[k], Clans[i], false) != 0) ClansCount++;
k++;
}
}
}
return ClansCount;
}
pawn Code:
GetClanMembersCount(const clanname[])
{
#define MAX_CLANS 50
new Name[MAX_PLAYER_NAME], Count, Pos[2], Clans[MAX_CLANS][MAX_PLAYER_NAME/2];
for(new i = 0, j = GetMaxPlayers(), l, playerclan; i < j; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i, Name, sizeof Name);
Pos[0] = strfind(Name, "[");
Pos[1] = strfind(Name, "]");
if(Pos[0] != -1 && Pos[1] != -1 && (Pos[1] - Pos[0]) >= 1)
{
for(l = 0; l < sizeof Clans; l++) if(!strlen(Clans[l])) playerclan = l, l = (sizeof Clans);
strmid(Clans[playerclan], Name, Pos[0], Pos[1] + 1, MAX_PLAYER_NAME/2);
if(!strcmp(clanname, Clans[playerclan], false))
{
Count++;
continue;
}
}
}
}
return Count;
}