Re: get_part_name, chathooks and strings [message #367678 is a reply to message #366918] |
Sat, 17 January 2009 20:37 |
Genesis2001
Messages: 1397 Registered: August 2006
Karma:
|
General (1 Star) |
|
|
RoShamBo wrote on Sun, 11 January 2009 08:30 |
int FindPlayer(const char *Part) //-2: not unique, -1: not found
{
int Player = -1;
for(GenericSLNode *x = PlayerList->HeadNode; x != 0; x = x->NodeNext)
{
cPlayer *p = (cPlayer *)x->NodeData;
if(p && p->IsActive)
{
const char *pName = WideCharToChar(p->PlayerName);
if(stricmp(pName, Part) == 0)
{
delete []pName;
Player = p->PlayerId;
break;
}
if(stristr(pName, Part))
{
if(Player >= 0)
{
delete []pName;
return -2;
}
else
{
Player = p->PlayerId;
}
}
delete []pName;
}
}
return Player;
}
|
Nice
|
|
|