//Bands like in Real Life or Gang Band for Radios!
//Created by zohartrejx aka John Ridar!
//unique do not release it
#include <a_samp>
#include <zcmd>
//WARNING It Requirest ZCMD To Run it!
//Including Colors. WARNING: Some of them are Custom Made by zohartrejx
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_RED 0xAA3333AA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_DARKRED 0x660000AA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_BRIGHTRED 0xFF0000AA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_VIOLET 0x9955DEEE
#define COLOR_LIGHTRED 0xFF99AADD
#define COLOR_SEAGREEN 0x00EEADDF
#define COLOR_GRAYWHITE 0xEEEEFFC4
#define COLOR_LIGHTNEUTRALBLUE 0xabcdef66
#define COLOR_GREENISHGOLD 0xCCFFDD56
#define COLOR_LIGHTBLUEGREEN 0x0FFDD349
#define COLOR_NEUTRALBLUE 0xABCDEF01
#define COLOR_LIGHTCYAN 0xAAFFCC33
#define COLOR_LEMON 0xDDDD2357
#define COLOR_MEDIUMBLUE 0x63AFF00A
#define COLOR_NEUTRAL 0xABCDEF97
#define COLOR_BLACK 0x00000000
#define COLOR_NEUTRALGREEN 0x81CFAB00
#define COLOR_DARKGREEN 0x12900BBF
#define COLOR_LIGHTGREEN 0x24FF0AB9
#define COLOR_DARKBLUE 0x300FFAAB
#define COLOR_BLUEGREEN 0x46BBAA00
#define COLOR_PINK 0xFF66FFAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_DARKRED 0x660000AA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_PURPLE 0x800080AA
#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_RED1 0xFF0000AA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BROWN 0x993300AA
#define COLOR_CYAN 0x99FFFFAA
#define COLOR_TAN 0xFFFFCCAA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_KHAKI 0x999900AA
#define COLOR_LIME 0x99FF00AA
#define COLOR_SYSTEM 0xEFEFF7AA
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD3 0xCBCCCEFF
#define COLOR_GRAD5 0xE3E3E3FF
#define COLOR_GRAD1 0xB4B5B7FF
//Variables
#define MAX_BANDS 10 // Changed to Max Groups 10 for no Abuses. You can change to max up to 500!
enum ginfo
{
grname[75],
leader,
active
};
enum pginfo
{
gid,
order,
invited,
attemptjoin
};
new BAND[MAX_PLAYERS][pginfo];
new BANDinfo[MAX_BANDS][ginfo];
public OnFilterScriptInit()
{
for(new x; x<MAX_PLAYERS; x++)
{
BAND[x][gid] = -1;
BAND[x][order] = -1;
BAND[x][invited] = -1;
BAND[x][attemptjoin] = -1;
}
print(" Band filterscript by JR is started ! ");
return 1;
}
public OnPlayerConnect(playerid)
{
BAND[playerid][gid] = -1;
BAND[playerid][invited] = -1;
BAND[playerid][attemptjoin] = -1;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
LeaveBAND(playerid, 2);
return 1;
}
COMMAND:bandcreate(playerid, params[])
{
if(BAND[playerid][gid] != -1) return SendClientMessage(playerid, 0xFF0000, "Leave your band with {FFFFFF}/Bandleave{FF0000} before creating a new one!");
if(strlen(params) > 49 || strlen(params) < 3) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Bandcreate{FF0000} (Band name 3-50 characters)!");
if(IsBANDTaken(params)) return SendClientMessage(playerid, 0xFF0000, "ERROR: Band name is already in Use!");
CreateBAND(params, playerid);
return 1;
}
COMMAND:bandleave(playerid, params[])
{
if(BAND[playerid][gid] == -1) return SendClientMessage(playerid, 0xFF0000, "ERROR:You are not in a Band to leave one!");
LeaveBAND(playerid, 0);
return 1;
}
COMMAND:bandinvite(playerid, params[])
{
if(BAND[playerid][order] != 1) return SendClientMessage(playerid, 0xFF0000, "You are not the leader of the band, you cannot invite people!");
new cid;
if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Bandinvite{FF0000} (playerid)");
cid = strval(params);
if(!IsPlayerConnected(cid)) return SendClientMessage(playerid, 0xFF0000, "Player Is not connected!");
if(BAND[cid][gid] == BAND[playerid][gid]) return SendClientMessage(playerid, 0xFF0000, "Player Is already in your band!");
if(BAND[cid][invited] == BAND[playerid][gid]) return SendClientMessage(playerid, 0xFF0000, "Player has already been invited to your band!");
if(BAND[cid][attemptjoin] == BAND[playerid][gid]) return BANDJoin(cid, BAND[playerid][gid]);
BAND[cid][invited] = BAND[playerid][gid];
new string[125], pname[24];
GetPlayerName(playerid, pname, 24);
format(string, sizeof(string), "You have been invited to join Band {FFFFFF}%s(%d){FFCC66} by {FFFFFF}%s(%d). /Bandjoin %d", BANDinfo[BAND[playerid][gid]][grname], BAND[playerid][gid], pname, playerid, BAND[playerid][gid]);
SendClientMessage(cid, 0xFFCC66, string);
GetPlayerName(cid, pname, 24);
format(string, sizeof(string), "You have invited {FFFFFF}%s(%d){FFCC66} to join your band!", pname, cid);
SendClientMessage(playerid, 0xFFCC66, string);
return 1;
}
COMMAND:bandowner(playerid, params[])
{
if(BAND[playerid][order] != 1) return SendClientMessage(playerid, 0xFF0000, "You are not the leader of the band, you cannot change the leader!");
new cid;
if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/bandowner{FF0000} (playerid)");
cid = strval(params);
if(!IsPlayerConnected(cid)) return SendClientMessage(playerid, 0xFF0000, "Player Is not connected!");
if(cid == playerid) return SendClientMessage(playerid, 0xFF0000, "ERROR: You are Band Owner !");
if(BAND[playerid][gid] != BAND[cid][gid]) return SendClientMessage(playerid, 0xFF0000, "Player Is not in your band!");
ChangeMemberOrder(BAND[playerid][gid], 1);
BAND[playerid][order] = BANDMembers(BAND[playerid][gid]);
return 1;
}
COMMAND:bandhelp(playerid, params[])
{
SendClientMessage(playerid, 0xFF0000, "|-----------Band Help by John Rider---------------------|");
SendClientMessage(playerid, 0xFF0000, "| /bandcreate,/bands,/bandjoin,/bandowner |");
SendClientMessage(playerid, 0xFF0000, "| /bandkick,/bm,/bandlist,/bandinvite,/bstats |");
SendClientMessage(playerid, 0xFF0000, "| /bm = IC Radio. /bmooc = OOC Radio |");
SendClientMessage(playerid, COLOR_RED, "| All has been Created by John Ridar! aka Zohartrejx | ");
SendClientMessage(playerid, 0xFF0000, "|-----------------End of Help---------------------------|");
return 1;
}
COMMAND:bandjoin(playerid, params[])
{
if(BAND[playerid][gid] != -1) return SendClientMessage(playerid, 0xFF0000, "You are already in a band! Leave your current one before joining another one!");
new grid;
if( (isnull(params) && BAND[playerid][invited] != -1 ) || ( strval(params) == BAND[playerid][invited] && BAND[playerid][invited] != -1) ) return BANDJoin(playerid, BAND[playerid][invited]);
if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/BANDjoin{FF0000} (bandid)");
grid = strval(params);
if(!BANDinfo[grid][active]) return SendClientMessage(playerid, COLOR_RED, "ERROR: You wanted to join band which doesnt Exsist!!");
BAND[playerid][attemptjoin] = grid;
new string[125], pname[24];
GetPlayerName(playerid, pname, 24);
format(string, sizeof(string), "You have requested to join band %s(ID:%d)", BANDinfo[grid][grname], grid);
SendClientMessage(playerid, 0xFFCC66, string);
format(string, sizeof(string), "{FFFFFF}%s(%d) {FFCC66}has requested to join your band. Type /Bandinvite %d to accept him!", pname, playerid, playerid);
SendMessageToLeader(grid, string);
return 1;
}
COMMAND:bandkick(playerid, params[])
{
if(BAND[playerid][order] != 1) return SendClientMessage(playerid, COLOR_RED, "ERROR:You are not the leader of a band, you cannot kick!");
new cid;
if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Bandkick{FF0000} (playerid)");
cid = strval(params);
if(!IsPlayerConnected(cid)) return SendClientMessage(playerid, 0xFF0000, "Player Is not connected!");
if(cid == playerid) return SendClientMessage(playerid, 0xFF0000, "You cannot kick yourself, silly.");
if(BAND[playerid][gid] != BAND[cid][gid]) return SendClientMessage(playerid, 0xFF0000, "Player Is not in your band!");
LeaveBAND(cid, 1);
return 1;
}
COMMAND:bm(playerid, params[])
{
if(BAND[playerid][gid] == -1) return SendClientMessage(playerid, 0xFF0000, "ERROR: You are not in Band. You cannot Talk over Radio!");
if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /bm [message]. WARNING! Its ICly!");
new pname[24], string[140+24];
GetPlayerName(playerid, pname, 24);
format(string, sizeof(string), "%s(%d): %s", pname, playerid, params);
SendMessageToAllBANDMembers(BAND[playerid][gid], string);
return 1;
}
COMMAND:bmooc(playerid, params[])
{
if(BAND[playerid][gid] == -1) return SendClientMessage(playerid, 0xFF0000, "ERROR: You are not in Band. You cannot Talk over Radio!");
if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /bm [message]. WARNING! Its OOCly!");
new pname[24], string[140+24];
GetPlayerName(playerid, pname, 24);
format(string, sizeof(string), "((%s(%d): %s ))", pname, playerid, params);
SendMessageToAllBANDMembers(BAND[playerid][gid], string);
return 1;
}
COMMAND:bstats(playerid, params[])
{
if(BAND[playerid][gid] == -1) return SendClientMessage(playerid, COLOR_GREEN, "ERROR: You are not in band. To check Band Stats, go in your band!");
SendClientMessage(playerid, COLOR_GREEN ,"Warning: Band Stats are Currently Under Construction! Need ideas for it. ");
return 1;
}
COMMAND:bandlist(playerid, params[])
{
if(isnull(params) && BAND[playerid][gid] == -1) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/BANDlist{FF0000} (BAND)");
if(isnull(params))
{
DisplayBANDMembers(BAND[playerid][gid], playerid);
return 1;
}
new grid = strval(params);
if(!BANDinfo[grid][active]) return SendClientMessage(playerid, 0xFF0000, "The band ID you have entered is not active!");
DisplayBANDMembers(grid, playerid);
return 1;
}
COMMAND:bands(playerid, params[])
{
ListBANDs(playerid);
return 1;
}
COMMAND:grl(playerid, params[])
return cmd_bandleave(playerid, params);
COMMAND:grc(playerid, params[])
return cmd_bandcreate(playerid, params);
COMMAND:gri(playerid, params[])
return cmd_bandinvite(playerid, params);
COMMAND:grlead(playerid, params[])
return cmd_bandowner(playerid, params);
COMMAND:grj(playerid, params[])
return cmd_bandjoin(playerid, params);
COMMAND:grk(playerid, params[])
return cmd_bandkick(playerid, params);
COMMAND:gm(playerid, params[])
return cmd_bm(playerid, params);
COMMAND:grlist(playerid, params[])
return cmd_bandlist(playerid, params);
stock DisplayBANDMembers(BANDid, playerid)
{
new amount[2], string[200], shortstr[55], pname[24];
format(string, sizeof(string), "Band Members for %s(ID:%d)", BANDinfo[BANDid][grname], BANDid);
SendClientMessage(playerid, 0xFFFFFF, string);
string = "";
for(new x; x<MAX_PLAYERS; x++)
{
if(BAND[x][gid] == BANDid)
{
amount[0] ++;
amount[1] ++;
GetPlayerName(x, pname, 24);
if(BANDinfo[BANDid][leader] != x) format(shortstr, sizeof(shortstr), "%s(%d),", pname, x);
if(BANDinfo[BANDid][leader] == x) format(shortstr, sizeof(shortstr), "[BOSS]%s(%d),", pname, x);
if(amount[1] == 1) format(string, sizeof(string), "%s", shortstr);
if(amount[1] != 1) format(string, sizeof(string), "%s %s", string, shortstr);
if(amount[0] == 6)
{
strdel(string, strlen(string)-1, strlen(string));
SendClientMessage(playerid, 0xFFCC66, string);
string = "";
amount[0] = 0;
}
}
}
strdel(string, strlen(string)-1, strlen(string));
if(amount[0] != 0) SendClientMessage(playerid, 0xFFCC66, string);
return 1;
}
stock ListBANDs(playerid)
{
new amount[2], string[200], shortstr[55];
SendClientMessage(playerid, 0xFFFFFF, "Current Active Bands:");
for(new x=0; x<MAX_BANDS; x++)
{
if(BANDinfo[x][active])
{
amount[0] ++;
amount[1] ++;
format(shortstr, sizeof(shortstr), "%s(ID:%d)", BANDinfo[x][grname], x);
if(amount[1] == 1) format(string, sizeof(string), "%s", shortstr);
if(amount[1] != 1) format(string, sizeof(string), "%s %s", string, shortstr);
if(amount[0] == 4)
{
SendClientMessage(playerid, 0xFFCC66, string);
string = "";
amount[0] = 0;
}
}
}
if(amount[1] == 0) SendClientMessage(playerid, 0xFFFF00, "There are currently no active bands!");
if(amount[1] != 0) SendClientMessage(playerid, 0xFFCC66, string);
return 1;
}
stock SendMessageToLeader(BANDi, message[])
return SendClientMessage(BANDinfo[BANDi][leader], 0xFFCC66, message);
stock BANDJoin(playerid, BANDi)
{
BAND[playerid][gid] = BANDi;
BAND[playerid][order] = BANDMembers(BANDi);
BAND[playerid][attemptjoin] = -1;
BAND[playerid][invited] = -1;
new pname[24], string[130];
GetPlayerName(playerid, pname, 24);
format(string, sizeof(string), "%s has joined your band!", pname);
SendMessageToAllBANDMembers(BANDi, string);
format(string, sizeof(string), "You have joined band %s(ID:%d)", BANDinfo[BANDi][grname] ,BANDi);
SendClientMessage(playerid, 0xFFCC66, string);
return 1;
}
stock FindNextSlot()
{
new id;
while(BANDinfo[id][active]) id ++;
return id;
}
stock IsBANDTaken(grpname[])
{
for(new x; x<MAX_BANDS; x++)
{
if(BANDinfo[x][active] == 1)
{
if(!strcmp(grpname, BANDinfo[x][grname], true) && strlen(BANDinfo[x][grname]) != 0) return 1;
}
}
return 0;
}
stock BANDInvite(playerid, BANDid)
return BAND[playerid][invited] = BANDid;
stock CreateBAND(grpname[], owner)
{
new slotid = FindNextSlot();
BANDinfo[slotid][leader] = owner;
format(BANDinfo[slotid][grname], 75, "%s", grpname);
BANDinfo[slotid][active] = 1;
BAND[owner][gid] = slotid;
BAND[owner][order] = 1;
new string[120];
format(string, sizeof(string), "You have created the band %s(ID:%d)", grpname, slotid);
SendClientMessage(owner, 0xFFCC66, string);
return slotid;
}
stock LeaveBAND(playerid, reason)
{
new BANDid = BAND[playerid][gid], orderid = BAND[playerid][order], string[100], pname[24];
BAND[playerid][gid] = -1;
BAND[playerid][order] = -1;
BANDCheck(BANDid, orderid);
GetPlayerName(playerid, pname, 24);
if(reason == 0)
{
format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} has left your band!", pname, playerid);
SendClientMessage(playerid, 0xFFCC66, "You have left your band");
}
if(reason == 1)
{
format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} has left your band (Kicked by the leader)!", pname, playerid);
SendClientMessage(playerid, 0xFFCC66, "You have been kicked from your band!");
}
if(reason == 2) format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} has left your band (Disconnected)!", pname, playerid);
SendMessageToAllBANDMembers(BANDid, string);
return 1;
}
stock BANDCheck(BANDid, orderid)
{
new gmems = BANDMembers(BANDid);
if(!gmems) BANDinfo[BANDid][active] = 0;
if(gmems != 0) ChangeMemberOrder(BANDid, orderid);
return 1;
}
stock BANDMembers(BANDid)
{
if(!BANDinfo[BANDid][active]) return 0;
new BANDmembers;
for(new i; i<MAX_PLAYERS; i++) if(BAND[i][gid] == BANDid) BANDmembers++;
return BANDmembers;
}
stock ChangeMemberOrder(BANDid, orderid)
{
for(new x; x<MAX_PLAYERS; x++)
{
if(BAND[x][gid] != BANDid || BAND[x][order] < orderid) continue;
BAND[x][order] --;
if(BAND[x][order] == 1)
{
BANDinfo[BANDid][leader] = x;
new string[128], pname[24];
GetPlayerName(x, pname, 24);
format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} Has been Promoted to the new Band Leader! Congratiulations!", pname, x);
SendMessageToAllBANDMembers(BANDid, string);
}
}
return 1;
}
stock SendMessageToAllBANDMembers(BANDid, message[])
{
if(!BANDinfo[BANDid][active]) return 0;
for(new x; x<MAX_PLAYERS; x++) if(BAND[x][gid] == BANDid) SendClientMessage(x, 0xFFCC66, message);
return 1;
}
//Created by zohartrejx aka John Ridar!
//unique do not release it
#include <a_samp>
#include <zcmd>
//WARNING It Requirest ZCMD To Run it!
//Including Colors. WARNING: Some of them are Custom Made by zohartrejx
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_RED 0xAA3333AA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_DARKRED 0x660000AA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_BRIGHTRED 0xFF0000AA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_VIOLET 0x9955DEEE
#define COLOR_LIGHTRED 0xFF99AADD
#define COLOR_SEAGREEN 0x00EEADDF
#define COLOR_GRAYWHITE 0xEEEEFFC4
#define COLOR_LIGHTNEUTRALBLUE 0xabcdef66
#define COLOR_GREENISHGOLD 0xCCFFDD56
#define COLOR_LIGHTBLUEGREEN 0x0FFDD349
#define COLOR_NEUTRALBLUE 0xABCDEF01
#define COLOR_LIGHTCYAN 0xAAFFCC33
#define COLOR_LEMON 0xDDDD2357
#define COLOR_MEDIUMBLUE 0x63AFF00A
#define COLOR_NEUTRAL 0xABCDEF97
#define COLOR_BLACK 0x00000000
#define COLOR_NEUTRALGREEN 0x81CFAB00
#define COLOR_DARKGREEN 0x12900BBF
#define COLOR_LIGHTGREEN 0x24FF0AB9
#define COLOR_DARKBLUE 0x300FFAAB
#define COLOR_BLUEGREEN 0x46BBAA00
#define COLOR_PINK 0xFF66FFAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_DARKRED 0x660000AA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_PURPLE 0x800080AA
#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_RED1 0xFF0000AA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BROWN 0x993300AA
#define COLOR_CYAN 0x99FFFFAA
#define COLOR_TAN 0xFFFFCCAA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_KHAKI 0x999900AA
#define COLOR_LIME 0x99FF00AA
#define COLOR_SYSTEM 0xEFEFF7AA
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD3 0xCBCCCEFF
#define COLOR_GRAD5 0xE3E3E3FF
#define COLOR_GRAD1 0xB4B5B7FF
//Variables
#define MAX_BANDS 10 // Changed to Max Groups 10 for no Abuses. You can change to max up to 500!
enum ginfo
{
grname[75],
leader,
active
};
enum pginfo
{
gid,
order,
invited,
attemptjoin
};
new BAND[MAX_PLAYERS][pginfo];
new BANDinfo[MAX_BANDS][ginfo];
public OnFilterScriptInit()
{
for(new x; x<MAX_PLAYERS; x++)
{
BAND[x][gid] = -1;
BAND[x][order] = -1;
BAND[x][invited] = -1;
BAND[x][attemptjoin] = -1;
}
print(" Band filterscript by JR is started ! ");
return 1;
}
public OnPlayerConnect(playerid)
{
BAND[playerid][gid] = -1;
BAND[playerid][invited] = -1;
BAND[playerid][attemptjoin] = -1;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
LeaveBAND(playerid, 2);
return 1;
}
COMMAND:bandcreate(playerid, params[])
{
if(BAND[playerid][gid] != -1) return SendClientMessage(playerid, 0xFF0000, "Leave your band with {FFFFFF}/Bandleave{FF0000} before creating a new one!");
if(strlen(params) > 49 || strlen(params) < 3) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Bandcreate{FF0000} (Band name 3-50 characters)!");
if(IsBANDTaken(params)) return SendClientMessage(playerid, 0xFF0000, "ERROR: Band name is already in Use!");
CreateBAND(params, playerid);
return 1;
}
COMMAND:bandleave(playerid, params[])
{
if(BAND[playerid][gid] == -1) return SendClientMessage(playerid, 0xFF0000, "ERROR:You are not in a Band to leave one!");
LeaveBAND(playerid, 0);
return 1;
}
COMMAND:bandinvite(playerid, params[])
{
if(BAND[playerid][order] != 1) return SendClientMessage(playerid, 0xFF0000, "You are not the leader of the band, you cannot invite people!");
new cid;
if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Bandinvite{FF0000} (playerid)");
cid = strval(params);
if(!IsPlayerConnected(cid)) return SendClientMessage(playerid, 0xFF0000, "Player Is not connected!");
if(BAND[cid][gid] == BAND[playerid][gid]) return SendClientMessage(playerid, 0xFF0000, "Player Is already in your band!");
if(BAND[cid][invited] == BAND[playerid][gid]) return SendClientMessage(playerid, 0xFF0000, "Player has already been invited to your band!");
if(BAND[cid][attemptjoin] == BAND[playerid][gid]) return BANDJoin(cid, BAND[playerid][gid]);
BAND[cid][invited] = BAND[playerid][gid];
new string[125], pname[24];
GetPlayerName(playerid, pname, 24);
format(string, sizeof(string), "You have been invited to join Band {FFFFFF}%s(%d){FFCC66} by {FFFFFF}%s(%d). /Bandjoin %d", BANDinfo[BAND[playerid][gid]][grname], BAND[playerid][gid], pname, playerid, BAND[playerid][gid]);
SendClientMessage(cid, 0xFFCC66, string);
GetPlayerName(cid, pname, 24);
format(string, sizeof(string), "You have invited {FFFFFF}%s(%d){FFCC66} to join your band!", pname, cid);
SendClientMessage(playerid, 0xFFCC66, string);
return 1;
}
COMMAND:bandowner(playerid, params[])
{
if(BAND[playerid][order] != 1) return SendClientMessage(playerid, 0xFF0000, "You are not the leader of the band, you cannot change the leader!");
new cid;
if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/bandowner{FF0000} (playerid)");
cid = strval(params);
if(!IsPlayerConnected(cid)) return SendClientMessage(playerid, 0xFF0000, "Player Is not connected!");
if(cid == playerid) return SendClientMessage(playerid, 0xFF0000, "ERROR: You are Band Owner !");
if(BAND[playerid][gid] != BAND[cid][gid]) return SendClientMessage(playerid, 0xFF0000, "Player Is not in your band!");
ChangeMemberOrder(BAND[playerid][gid], 1);
BAND[playerid][order] = BANDMembers(BAND[playerid][gid]);
return 1;
}
COMMAND:bandhelp(playerid, params[])
{
SendClientMessage(playerid, 0xFF0000, "|-----------Band Help by John Rider---------------------|");
SendClientMessage(playerid, 0xFF0000, "| /bandcreate,/bands,/bandjoin,/bandowner |");
SendClientMessage(playerid, 0xFF0000, "| /bandkick,/bm,/bandlist,/bandinvite,/bstats |");
SendClientMessage(playerid, 0xFF0000, "| /bm = IC Radio. /bmooc = OOC Radio |");
SendClientMessage(playerid, COLOR_RED, "| All has been Created by John Ridar! aka Zohartrejx | ");
SendClientMessage(playerid, 0xFF0000, "|-----------------End of Help---------------------------|");
return 1;
}
COMMAND:bandjoin(playerid, params[])
{
if(BAND[playerid][gid] != -1) return SendClientMessage(playerid, 0xFF0000, "You are already in a band! Leave your current one before joining another one!");
new grid;
if( (isnull(params) && BAND[playerid][invited] != -1 ) || ( strval(params) == BAND[playerid][invited] && BAND[playerid][invited] != -1) ) return BANDJoin(playerid, BAND[playerid][invited]);
if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/BANDjoin{FF0000} (bandid)");
grid = strval(params);
if(!BANDinfo[grid][active]) return SendClientMessage(playerid, COLOR_RED, "ERROR: You wanted to join band which doesnt Exsist!!");
BAND[playerid][attemptjoin] = grid;
new string[125], pname[24];
GetPlayerName(playerid, pname, 24);
format(string, sizeof(string), "You have requested to join band %s(ID:%d)", BANDinfo[grid][grname], grid);
SendClientMessage(playerid, 0xFFCC66, string);
format(string, sizeof(string), "{FFFFFF}%s(%d) {FFCC66}has requested to join your band. Type /Bandinvite %d to accept him!", pname, playerid, playerid);
SendMessageToLeader(grid, string);
return 1;
}
COMMAND:bandkick(playerid, params[])
{
if(BAND[playerid][order] != 1) return SendClientMessage(playerid, COLOR_RED, "ERROR:You are not the leader of a band, you cannot kick!");
new cid;
if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Bandkick{FF0000} (playerid)");
cid = strval(params);
if(!IsPlayerConnected(cid)) return SendClientMessage(playerid, 0xFF0000, "Player Is not connected!");
if(cid == playerid) return SendClientMessage(playerid, 0xFF0000, "You cannot kick yourself, silly.");
if(BAND[playerid][gid] != BAND[cid][gid]) return SendClientMessage(playerid, 0xFF0000, "Player Is not in your band!");
LeaveBAND(cid, 1);
return 1;
}
COMMAND:bm(playerid, params[])
{
if(BAND[playerid][gid] == -1) return SendClientMessage(playerid, 0xFF0000, "ERROR: You are not in Band. You cannot Talk over Radio!");
if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /bm [message]. WARNING! Its ICly!");
new pname[24], string[140+24];
GetPlayerName(playerid, pname, 24);
format(string, sizeof(string), "%s(%d): %s", pname, playerid, params);
SendMessageToAllBANDMembers(BAND[playerid][gid], string);
return 1;
}
COMMAND:bmooc(playerid, params[])
{
if(BAND[playerid][gid] == -1) return SendClientMessage(playerid, 0xFF0000, "ERROR: You are not in Band. You cannot Talk over Radio!");
if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /bm [message]. WARNING! Its OOCly!");
new pname[24], string[140+24];
GetPlayerName(playerid, pname, 24);
format(string, sizeof(string), "((%s(%d): %s ))", pname, playerid, params);
SendMessageToAllBANDMembers(BAND[playerid][gid], string);
return 1;
}
COMMAND:bstats(playerid, params[])
{
if(BAND[playerid][gid] == -1) return SendClientMessage(playerid, COLOR_GREEN, "ERROR: You are not in band. To check Band Stats, go in your band!");
SendClientMessage(playerid, COLOR_GREEN ,"Warning: Band Stats are Currently Under Construction! Need ideas for it. ");
return 1;
}
COMMAND:bandlist(playerid, params[])
{
if(isnull(params) && BAND[playerid][gid] == -1) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/BANDlist{FF0000} (BAND)");
if(isnull(params))
{
DisplayBANDMembers(BAND[playerid][gid], playerid);
return 1;
}
new grid = strval(params);
if(!BANDinfo[grid][active]) return SendClientMessage(playerid, 0xFF0000, "The band ID you have entered is not active!");
DisplayBANDMembers(grid, playerid);
return 1;
}
COMMAND:bands(playerid, params[])
{
ListBANDs(playerid);
return 1;
}
COMMAND:grl(playerid, params[])
return cmd_bandleave(playerid, params);
COMMAND:grc(playerid, params[])
return cmd_bandcreate(playerid, params);
COMMAND:gri(playerid, params[])
return cmd_bandinvite(playerid, params);
COMMAND:grlead(playerid, params[])
return cmd_bandowner(playerid, params);
COMMAND:grj(playerid, params[])
return cmd_bandjoin(playerid, params);
COMMAND:grk(playerid, params[])
return cmd_bandkick(playerid, params);
COMMAND:gm(playerid, params[])
return cmd_bm(playerid, params);
COMMAND:grlist(playerid, params[])
return cmd_bandlist(playerid, params);
stock DisplayBANDMembers(BANDid, playerid)
{
new amount[2], string[200], shortstr[55], pname[24];
format(string, sizeof(string), "Band Members for %s(ID:%d)", BANDinfo[BANDid][grname], BANDid);
SendClientMessage(playerid, 0xFFFFFF, string);
string = "";
for(new x; x<MAX_PLAYERS; x++)
{
if(BAND[x][gid] == BANDid)
{
amount[0] ++;
amount[1] ++;
GetPlayerName(x, pname, 24);
if(BANDinfo[BANDid][leader] != x) format(shortstr, sizeof(shortstr), "%s(%d),", pname, x);
if(BANDinfo[BANDid][leader] == x) format(shortstr, sizeof(shortstr), "[BOSS]%s(%d),", pname, x);
if(amount[1] == 1) format(string, sizeof(string), "%s", shortstr);
if(amount[1] != 1) format(string, sizeof(string), "%s %s", string, shortstr);
if(amount[0] == 6)
{
strdel(string, strlen(string)-1, strlen(string));
SendClientMessage(playerid, 0xFFCC66, string);
string = "";
amount[0] = 0;
}
}
}
strdel(string, strlen(string)-1, strlen(string));
if(amount[0] != 0) SendClientMessage(playerid, 0xFFCC66, string);
return 1;
}
stock ListBANDs(playerid)
{
new amount[2], string[200], shortstr[55];
SendClientMessage(playerid, 0xFFFFFF, "Current Active Bands:");
for(new x=0; x<MAX_BANDS; x++)
{
if(BANDinfo[x][active])
{
amount[0] ++;
amount[1] ++;
format(shortstr, sizeof(shortstr), "%s(ID:%d)", BANDinfo[x][grname], x);
if(amount[1] == 1) format(string, sizeof(string), "%s", shortstr);
if(amount[1] != 1) format(string, sizeof(string), "%s %s", string, shortstr);
if(amount[0] == 4)
{
SendClientMessage(playerid, 0xFFCC66, string);
string = "";
amount[0] = 0;
}
}
}
if(amount[1] == 0) SendClientMessage(playerid, 0xFFFF00, "There are currently no active bands!");
if(amount[1] != 0) SendClientMessage(playerid, 0xFFCC66, string);
return 1;
}
stock SendMessageToLeader(BANDi, message[])
return SendClientMessage(BANDinfo[BANDi][leader], 0xFFCC66, message);
stock BANDJoin(playerid, BANDi)
{
BAND[playerid][gid] = BANDi;
BAND[playerid][order] = BANDMembers(BANDi);
BAND[playerid][attemptjoin] = -1;
BAND[playerid][invited] = -1;
new pname[24], string[130];
GetPlayerName(playerid, pname, 24);
format(string, sizeof(string), "%s has joined your band!", pname);
SendMessageToAllBANDMembers(BANDi, string);
format(string, sizeof(string), "You have joined band %s(ID:%d)", BANDinfo[BANDi][grname] ,BANDi);
SendClientMessage(playerid, 0xFFCC66, string);
return 1;
}
stock FindNextSlot()
{
new id;
while(BANDinfo[id][active]) id ++;
return id;
}
stock IsBANDTaken(grpname[])
{
for(new x; x<MAX_BANDS; x++)
{
if(BANDinfo[x][active] == 1)
{
if(!strcmp(grpname, BANDinfo[x][grname], true) && strlen(BANDinfo[x][grname]) != 0) return 1;
}
}
return 0;
}
stock BANDInvite(playerid, BANDid)
return BAND[playerid][invited] = BANDid;
stock CreateBAND(grpname[], owner)
{
new slotid = FindNextSlot();
BANDinfo[slotid][leader] = owner;
format(BANDinfo[slotid][grname], 75, "%s", grpname);
BANDinfo[slotid][active] = 1;
BAND[owner][gid] = slotid;
BAND[owner][order] = 1;
new string[120];
format(string, sizeof(string), "You have created the band %s(ID:%d)", grpname, slotid);
SendClientMessage(owner, 0xFFCC66, string);
return slotid;
}
stock LeaveBAND(playerid, reason)
{
new BANDid = BAND[playerid][gid], orderid = BAND[playerid][order], string[100], pname[24];
BAND[playerid][gid] = -1;
BAND[playerid][order] = -1;
BANDCheck(BANDid, orderid);
GetPlayerName(playerid, pname, 24);
if(reason == 0)
{
format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} has left your band!", pname, playerid);
SendClientMessage(playerid, 0xFFCC66, "You have left your band");
}
if(reason == 1)
{
format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} has left your band (Kicked by the leader)!", pname, playerid);
SendClientMessage(playerid, 0xFFCC66, "You have been kicked from your band!");
}
if(reason == 2) format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} has left your band (Disconnected)!", pname, playerid);
SendMessageToAllBANDMembers(BANDid, string);
return 1;
}
stock BANDCheck(BANDid, orderid)
{
new gmems = BANDMembers(BANDid);
if(!gmems) BANDinfo[BANDid][active] = 0;
if(gmems != 0) ChangeMemberOrder(BANDid, orderid);
return 1;
}
stock BANDMembers(BANDid)
{
if(!BANDinfo[BANDid][active]) return 0;
new BANDmembers;
for(new i; i<MAX_PLAYERS; i++) if(BAND[i][gid] == BANDid) BANDmembers++;
return BANDmembers;
}
stock ChangeMemberOrder(BANDid, orderid)
{
for(new x; x<MAX_PLAYERS; x++)
{
if(BAND[x][gid] != BANDid || BAND[x][order] < orderid) continue;
BAND[x][order] --;
if(BAND[x][order] == 1)
{
BANDinfo[BANDid][leader] = x;
new string[128], pname[24];
GetPlayerName(x, pname, 24);
format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} Has been Promoted to the new Band Leader! Congratiulations!", pname, x);
SendMessageToAllBANDMembers(BANDid, string);
}
}
return 1;
}
stock SendMessageToAllBANDMembers(BANDid, message[])
{
if(!BANDinfo[BANDid][active]) return 0;
for(new x; x<MAX_PLAYERS; x++) if(BAND[x][gid] == BANDid) SendClientMessage(x, 0xFFCC66, message);
return 1;
}