25.04.2009, 16:24
- Clan Tag detection/removal snippet:
pawn Код:stock RemoveClanTagFromName(playerid)
{
new start, end, string[MAX_PLAYER_NAME];
GetPlayerName(playerid, string, sizeof(string));
start = strfind(string, "[", true);
end = strfind(string, "]", true);
if(start >= end) return 0;
else
{
strdel(string, start, end + 1);
SetPlayerName(playerid, string);
return 1;
}
}RemoveClanTagFromName(playerid) - does that it says on the tin, and returns 0 if the player doesn't have a clantag.pawn Код:stock TagDetect(playerid)
{
new string[MAX_PLAYER_NAME];
GetPlayerName(playerid, string, sizeof(string));
if(strfind(string, "]", true) > strfind(string, "[", true)) return 1;
else return 0;
}
TagDetect(playerid) - is a simpler version of the above, and can be used in a script to stop someone getting 2 clantags. It returns 1 if the player already has a clantag, and 0 if they do not.
Both of these scripts work with clantags situated anywhere in the name.
- [LS]Weirdosport
- Weirdo[LS]sport
- Weirdosport[LS]
For example, a (nooby) person connects to the server, with the username [l]o[l]o[l], and decides he wants his tags removing:- After the first iteration, his name will be o[l]o[l].
- Then it will become oo[l]
- And finally oo

