Here's an old one I made, only because luigifan9 was a jerk, I was only scripting for a month or so when I made this.
Code:
if(strcmp(cmd, "/cc", true) == 0 || strcmp(cmd, "/clancreate", true) == 0) // clan create
{
if(playerclan[playerid] != 99) return SendClientMessage(playerid,ORANGE,"you are already in a clan leave before creating a new one");
new reason[10];
new cid = 99;
format(reason,sizeof(reason),"%s",bigstrtok(cmdtext, idx));
if(!strlen(reason))
{
SendClientMessage(playerid, ORANGE, "USAGE: /cc [clan name]");
SendClientMessage(playerid, ORANGE, "FUNCTION: Will create a clan");
return 1;
}
for(new i = 9; i > -1; i--)
{
if (strcmp(clannames[i]," ",true) == 0 || !strlen(clannames[i])) cid = i;
}
if (cid == 99) return SendClientMessage(playerid,ORANGE,"too many clans are active try again later");
GetPlayerName(playerid, sendername, sizeof(sendername));
playerclan[playerid] = cid;
format(clannames[cid],10,"%s",reason);
format(string, sizeof(string), "you have created a new clan: %s",clannames[cid]);
SendClientMessage(playerid,CLANTEXT, string);
clanjoin[playerid] = 1;
return 1;
}
if(strcmp(cmd, "/clans", true) == 0) // clan listing
{
SendClientMessage(playerid,GREEN,"Listing Clans:");
for(new i = 0; i < 10; i++)
{
if (strcmp(clannames[i]," ",false) == 1 && strlen(clannames[i])) format(string,sizeof(string),"%s%s (%d) ",string,clannames[i],i);
}
if (!strlen(string)) return SendClientMessage(playerid,RED,"no active clans");
SendClientMessage(playerid,CLANTEXT,string);
return 1;
}
if(strcmp(cmd, "/cj", true) == 0 || strcmp(cmd, "/clanjoin", true) == 0) // clan create
{
if(playerclan[playerid] != 99) return SendClientMessage(playerid,ORANGE,"you are already in a clan leave before joining another one");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid,ORANGE,"USAGE: /clanjoin [Clan ID]");
new cid = strval(tmp);
new name[56];
GetPlayerName(playerid,name,sizeof(name));
if(!strlen(clannames[cid]) || (cid < 0 || cid > 9))
{
format(string,sizeof(string),"%d is not a valid clan ID", cid);
return SendClientMessage(playerid,ORANGE,string);
}
if(clanask[playerid] == cid) return SendClientMessage(playerid,RED,"you have already asked to join that clan");
if(claninvite[playerid] == cid)
{
format(string,sizeof(string),"you have joined %s use ;text for clan talk",clannames[cid]);
SendClientMessage(playerid,CLANTEXT,string);
playerclan[playerid] = cid;
format(string,sizeof(string),"[%s] %s has joined the clan",clannames[cid],name);
SendClientMessageToClan(CLANTEXT,string,cid);
claninvite[playerid] = 99;
clanjoin[playerid] = SetClanJoinID(cid);
}
else if(claninvite[playerid] != cid)
{
format(string,sizeof(string),"you have requested to join %s",clannames[cid]);
SendClientMessage(playerid,CLANTEXT,string);
format(string,sizeof(string),"[%s] %s(%d) has requested to join the clan",clannames[cid],name,playerid);
SendClientMessageToClan(CLANTEXT,string,cid);
clanask[playerid] = cid;
}
return 1;
}
if(strcmp(cmd, "/ci", true) == 0 || strcmp(cmd, "/claninvite", true) == 0) // clan create
{
if(playerclan[playerid] == 99) return SendClientMessage(playerid,ORANGE,"you are not in a clan");
if(ClanLeader(playerclan[playerid]) != playerid) return SendClientMessage(playerid,ORANGE,"only the clan leader may invite people");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid,ORANGE,"USAGE: /claninvite [ID]");
new id = ReturnUser(tmp);
new name[56], nama[56];
if(IsPlayerConnected(id))
{
if(playerclan[playerid] == playerclan[id]) return SendClientMessage(playerid,RED,"that user is already in your clan");
if(claninvite[id] == playerclan[playerid]) return SendClientMessage(playerid,RED,"that user has already been invited to your clan");
if(clanask[id] == playerclan[playerid])
{
format(string,sizeof(string),"you have joined %s use ;text for clan talk",clannames[playerclan[playerid]]);
SendClientMessage(id,CLANTEXT,string);
playerclan[id] = playerclan[playerid];
GetPlayerName(id,name,sizeof(name));
GetPlayerName(playerid,nama,sizeof(nama));
format(string,sizeof(string),"[%s] %s(%d) has been accepted in by %s",clannames[playerclan[playerid]],name,id,nama);
SendClientMessageToClan(CLANTEXT,string,playerclan[playerid]);
clanask[playerid] = 99;
clanjoin[id] = SetClanJoinID(playerclan[playerid]);
}
else if(clanask[playerid] != playerclan[playerid])
{
GetPlayerName(id,name,sizeof(name));
GetPlayerName(playerid,nama,sizeof(nama));
format(string,sizeof(string),"%s has asked you to join thier clan: %s type /cj %d to join",nama,clannames[playerclan[playerid]],playerclan[playerid]);
SendClientMessage(id,ORANGE,string);
format(string,sizeof(string),"[%s] %s has asked %s to join the clan",clannames[playerclan[playerid]],nama,name);
SendClientMessageToClan(CLANTEXT,string,playerclan[playerid]);
claninvite[id] = playerclan[playerid];
}
}
else if (!IsPlayerConnected(id))
{
format(string, sizeof(string), "%d is not an active player.", id);
SendClientMessage(playerid, RED, string);
}
return 1;
}
if(strcmp(cmd, "/cl", true) == 0 || strcmp(cmd, "/clanleave", true) == 0) // clan create
{
new name[56];
if(playerclan[playerid] == 99) return SendClientMessage(playerid,ORANGE,"you are not in a clan");
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"[%s] %s(%d) has left the clan",clannames[playerclan[playerid]],name,playerid);
SendClientMessageToClan(CLANTEXT,string,playerclan[playerid]);
new delclan = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(playerclan[i] == playerclan[playerid] && i != playerid) delclan++;
}
}
if (delclan == 0) clannames[playerclan[playerid]] = " ";
if (delclan != 0 && ClanLeader(playerclan[playerid]) == playerid)
{
new clid;
new cid;
cid = playerclan[playerid];
playerclan[playerid] = 99;
clid = ClanLeader(cid);
GetPlayerName(clid,name,sizeof(name));
format(string,sizeof(string),"[%s] %s(%d) is the new clan leader",clannames[cid],name,clid);
clanjoin[clid] = 1;
SendClientMessageToClan(CLANTEXT,string,cid);
}
playerclan[playerid] = 99;
return 1;
}
if(strcmp(cmd, "/clist", true) == 0 || strcmp(cmd, "/clanlist", true) == 0) // clan create
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp) && playerclan[playerid] == 99) return SendClientMessage(playerid,ORANGE,"you are not in a clan");
new cid = strval(tmp);
new name[56];
if(!strlen(tmp) && playerclan[playerid] != 99)
{
format(string,sizeof(string),"%s clan member list",clannames[cid]);
SendClientMessage(playerid,GREEN,string);
string = " ";
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i,name,sizeof(name));
if(playerclan[i] == cid) format(string,sizeof(string),"%s%s (%d) ",string,name,i);
}
}
SendClientMessage(playerid,ORANGE,string);
return 1;
}
if(!strlen(clannames[cid]) || (cid < 0 || cid > 9))
{
format(string,sizeof(string),"%d is not a valid clan ID", cid);
return SendClientMessage(playerid,ORANGE,string);
}
format(string,sizeof(string),"%s clan member list",clannames[cid]);
SendClientMessage(playerid,GREEN,string);
string = " ";
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i,name,sizeof(name));
if(playerclan[i] == cid) format(string,sizeof(string),"%s%s (%d) ",string,name,i);
}
}
SendClientMessage(playerid,ORANGE,string);
return 1;
}
if(strcmp(cmd, "/ck", true) == 0 || strcmp(cmd, "/clankick", true) == 0) // clan create
{
if(playerclan[playerid] == 99) return SendClientMessage(playerid,ORANGE,"you are not in a clan");
if(ClanLeader(playerclan[playerid]) != playerid) return SendClientMessage(playerid,ORANGE,"only the clan leader may kick people");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid,ORANGE,"USAGE: /clankick [ID]");
new id = ReturnUser(tmp);
if(id == playerid) return SendClientMessage(playerid,ORANGE,"you cannot kick yourself out, use /clanleave");
new name[56], nama[56];
if(IsPlayerConnected(id) && playerclan[id] == playerclan[playerid])
{
GetPlayerName(playerid,name,sizeof(name));
GetPlayerName(id,nama,sizeof(nama));
new delclan = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(playerclan[i] == playerclan[playerid] && i != playerid) delclan++;
}
}
format(string,sizeof(string),"[%s] you have been kicked out by %s",clannames[playerclan[playerid]],name);
SendClientMessage(id,CLANTEXT,string);
if (delclan == 0) clannames[playerclan[playerid]] = " ";
playerclan[id] = 99;
if (playerclan[playerid] != 99)
{
format(string,sizeof(string),"[%s] %s has kicked out %s",clannames[playerclan[playerid]],name,nama);
SendClientMessageToClan(CLANTEXT,string,playerclan[playerid]);
}
}
else if (!IsPlayerConnected(id))
{
format(string, sizeof(string), "%d is not an active player or is not in your clan", id);
SendClientMessage(playerid, RED, string);
}
return 1;
}