I Having My Clan Tag System But When Player Connects With [CTag] He Not Gets Kicked So Please Fix And Help Me
pls help me
Code:
/** Clan Tag System Is Here **/
#define ClanTag "[uG]"
forward Kicker(playerid);
public Kicker(playerid)
{
Kick(playerid);
return 1;
}
stock GetPlayerID(const Name[])
{
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(i, pName, sizeof(pName));
if(strcmp(Name, pName, true)==0)
{
return i;
}
}
}
return -1;
}
public OnPlayerConnect(playerid)
{
/* Clan System */
new playeridname[MAX_PLAYER_NAME];
if (IsPlayerNPC(playerid)) return 1;
GetPlayerName(playerid,playeridname,sizeof(playeridname));
Clan[playerid] = dini_Int(AddDirFile(dir_userfiles, playeridname), "Clanmember");
if(Clan[playerid]==0)
{
if(strcmp(playeridname, ClanTag, true)==0)
{
new str[256];
format(str, sizeof(str), "Hey you are not from %s clan, go back and change your name to something else and don't use the tag!.", ClanTag);
SendClientMessage(playerid, COLOR_RED, str);
SetTimerEx("Kicker", 2000, 0, "i", playerid);
}
/** Command To Set **/
CMD:setclanmember(playerid, params[])
{
new tmp, tmp2,giveplayer[25], playername[25], string[256];
if (adlvl[playerid] < 5) return 0;
if (sscanf(params, "dd", tmp, tmp2)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /setclanmember [playerid] [option] (options : 1 = Set, 0 = Remove)");\
if(tmp > 1 || tmp2 < 0) return SendClientMessage(playerid, COLOR_RED,"ERROR:Available Options 0-1");
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
GetPlayerName(tmp, giveplayer, MAX_PLAYER_NAME);
if (Clan[tmp] == tmp2) return SendClientMessage(playerid, COLOR_RED,"That Player Is/Not Already A Clan Member.");
dini_IntSet(AddDirFile(dir_userfiles, giveplayer), "Clanmember", tmp);
if(tmp2==1)
{
SendPlayerFormattedText(tmp, COLOR_YELLOW, "An admin has Setted you as a clan member, now you can use %s tag in your name.", ClanTag, "");
SendPlayerFormattedText(playerid, COLOR_YELLOW, "You have setted %s As a clan member.", giveplayer, "");
Clan[tmp]=1;
if (adminuc[playerid] == 0)
{
format(string, 128, "Admin Log: %s has Setted %s's as a clan member %s.", playername, giveplayer);
SendMessageToAdmins(COLOR_ADMIN, string);
}
printf("[Clan] %s has setted %s as a clan member", playername, giveplayer);
}
else if(tmp==0)
{
SendPlayerFormattedText(tmp, COLOR_RED, "An Admin Has Kicked You From Clan Remove %s Tag From Your Name Now.", ClanTag, "");
SendPlayerFormattedText(playerid, COLOR_YELLOW, "You Have Kicked %s From Clan.", giveplayer, "");
Clan[tmp]=0;
if (adminuc[playerid] == 0)
{
format(string, 128, "Admin Log: %s has Kicked %s's From Clan %s.", playername, giveplayer);
SendMessageToAdmins(COLOR_ADMIN, string);
}
printf("[Clan] %s has Kicked %s From Clan", playername, giveplayer);
}
return 1;
}