Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new clan_colors[] =
- {
- 0xFF0000AA, 0xFFF000AA, 0x00FF00AA
- }; //cada cor aqui, é a cor de um clan
- new clan_tag[sizeof clan_colors][14];
- public OnPlayerConnect(playerid)
- {
- new pname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pname, sizeof pname);
- if(pname[0] == '[' && strfind(pname, "]", true) >= 2) //tem que ter [..] no nick
- {
- static clans;
- new bool:is;
- if(clans <= sizeof clan_colors)
- {
- new tag[14];
- strmid(tag, pname, strfind(pname, "[", true), strfind(pname, "]", true));
- for(new j = 0; j < sizeof clan_tag; j++)
- {
- if(strfind(clan_tag[j], tag, false) != -1)
- {
- SetPlayerColor(playerid, clan_colors[j]);
- is = true;
- break;
- } else is = false;
- }
- if(!is)
- {
- new id;
- for(id = 0; id < sizeof clan_tag; id++)
- if(!strlen(clan_tag[id]))
- break;
- strmid(clan_tag[id], tag, 0, strlen(tag));
- SetPlayerColor(playerid, clan_colors[id]);
- clans++;
- }
- }
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new pname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pname, sizeof pname);
- if(pname[0] == '[' && strfind(pname, "]", true) >= 2)
- {
- new tag[14], has;
- strmid(tag, pname, strfind(pname, "[", true), strfind(pname, "]", true));
- for(new k = 0, t[14], n[MAX_PLAYER_NAME]; k < MAX_PLAYERS; k++)
- {
- GetPlayerName(k, n, sizeof n);
- if(n[0] == '[' && strfind(n, "]", true) >= 2)
- {
- strmid(t, n, strfind(n, "[", true), strfind(n, "]", true));
- if(playerid != k && strfind(tag, t, false) != -1) has++;
- }
- }
- if(has == 0)
- for(new i = 0; i < sizeof clan_tag; i++)
- if(strfind(clan_tag[i], tag, false) != -1)
- clan_tag[i] = "";
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment