Код:
new RandomColors[400] = {
0x4F5152D4,0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,0xf0e68cFF,0xEE82EEFF,0xFF1493FF,
0xFFD720FF,0x8b4513FF,0x4949A0FF,0x148b8bFF,0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,0x10DC29FF,0xF4A460FF,
0x534081FF,0x0495CDFF,0xEF6CE8FF,0xBD34DAFF,0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,0x65ADEBFF,
0x5C1ACCFF,0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF,0x275222FF,0xF09F5BFF,0x3D0A4FFF,
0x22F767FF,0xD63034FF,0x9A6980FF,0xDFB935FF,0x3793FAFF,0x90239DFF,0xE9AB2FFF,0xAF2FF3FF,0x057F94FF,
0xB98519FF,0x388EEAFF,0x028151FF,0xA55043FF,0x0DE018FF,0x93AB1CFF,0x95BAF0FF,0x369976FF,0x18F71FFF,
0x4B8987FF,0x491B9EFF,0x829DC7FF,0xBCE635FF,0xCEA6DFFF,0x20D4ADFF,0x2D74FDFF,0x3C1C0DFF,0x12D6D4FF,
0x48C000FF,0x2A51E2FF,0xE3AC12FF,0xFC42A8FF,0x2FC827FF,0x1A30BFFF,0xB740C2FF,0x42ACF5FF,0x2FD9DEFF,
0xFAFB71FF,0x05D1CDFF,0xC471BDFF,0x94436EFF,0xC1F7ECFF,0xCE79EEFF,0xBD1EF2FF,0x93B7E4FF,0x3214AAFF,
0x184D3BFF,0xAE4B99FF,0x7E49D7FF,0x4C436EFF,0xFA24CCFF,0xCE76BEFF,0xA04E0AFF,0x9F945CFF,0xDCDE3DFF,
0x10C9C5FF,0x70524DFF,0x0BE472FF,0x8A2CD7FF,0x6152C2FF,0xCF72A9FF,0xE59338FF,0xEEDC2DFF,0xD8C762FF,
0xD8C762FF,0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,0xf0e68cFF,0x778899FF,0xFF1493FF,
0xF4A460FF,0xEE82EEFF,0xFFD720FF,0x8b4513FF,0x4949A0FF,0x148b8bFF,0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,
0x10DC29FF,0x534081FF,0x0495CDFF,0xEF6CE8FF,0xBD34DAFF,0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,
0x65ADEBFF,0x5C1ACCFF,0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF,0x275222FF,0xF09F5BFF,
0x3D0A4FFF,0x22F767FF,0xD63034FF,0x9A6980FF,0xDFB935FF,0x3793FAFF,0x90239DFF,0xE9AB2FFF,0xAF2FF3FF,
0x057F94FF,0xB98519FF,0x388EEAFF,0x028151FF,0xA55043FF,0x0DE018FF,0x93AB1CFF,0x95BAF0FF,0x369976FF,
0x18F71FFF,0x4B8987FF,0x491B9EFF,0x829DC7FF,0xBCE635FF,0xCEA6DFFF,0x20D4ADFF,0x2D74FDFF,0x3C1C0DFF,
0x12D6D4FF,0x48C000FF,0x2A51E2FF,0xE3AC12FF,0xFC42A8FF,0x2FC827FF,0x1A30BFFF,0xB740C2FF,0x42ACF5FF,
0x2FD9DEFF,0xFAFB71FF,0x05D1CDFF,0xC471BDFF,0x94436EFF,0xC1F7ECFF,0xCE79EEFF,0xBD1EF2FF,0x93B7E4FF,
0x3214AAFF,0x184D3BFF,0xAE4B99FF,0x7E49D7FF,0x4C436EFF,0xFA24CCFF,0xCE76BEFF,0xA04E0AFF,0x9F945CFF,
0xDCDE3DFF,0x10C9C5FF,0x70524DFF,0x0BE472FF,0x8A2CD7FF,0x6152C2FF,0xCF72A9FF,0xE59338FF,0xEEDC2DFF,
0xD8C762FF,0xD8C762FF,0x4F5152D4,0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,0xf0e68cFF,0xEE82EEFF,0xFF1493FF,
0xFFD720FF,0x8b4513FF,0x4949A0FF,0x148b8bFF,0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,0x10DC29FF,0xF4A460FF,
0x534081FF,0x0495CDFF,0xEF6CE8FF,0xBD34DAFF,0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,0x65ADEBFF,
0x5C1ACCFF,0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF,0x275222FF,0xF09F5BFF,0x3D0A4FFF,
0x22F767FF,0xD63034FF,0x9A6980FF,0xDFB935FF,0x3793FAFF,0x90239DFF,0xE9AB2FFF,0xAF2FF3FF,0x057F94FF,
0xB98519FF,0x388EEAFF,0x028151FF,0xA55043FF,0x0DE018FF,0x93AB1CFF,0x95BAF0FF,0x369976FF,0x18F71FFF,
0x4B8987FF,0x491B9EFF,0x829DC7FF,0xBCE635FF,0xCEA6DFFF,0x20D4ADFF,0x2D74FDFF,0x3C1C0DFF,0x12D6D4FF,
0x48C000FF,0x2A51E2FF,0xE3AC12FF,0xFC42A8FF,0x2FC827FF,0x1A30BFFF,0xB740C2FF,0x42ACF5FF,0x2FD9DEFF,
0xFAFB71FF,0x05D1CDFF,0xC471BDFF,0x94436EFF,0xC1F7ECFF,0xCE79EEFF,0xBD1EF2FF,0x93B7E4FF,0x3214AAFF,
0x184D3BFF,0xAE4B99FF,0x7E49D7FF,0x4C436EFF,0xFA24CCFF,0xCE76BEFF,0xA04E0AFF,0x9F945CFF,0xDCDE3DFF,
0x10C9C5FF,0x70524DFF,0x0BE472FF,0x8A2CD7FF,0x6152C2FF,0xCF72A9FF,0xE59338FF,0xEEDC2DFF,0xD8C762FF,
0xD8C762FF,0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,0xf0e68cFF,0x778899FF,0xFF1493FF,
0xF4A460FF,0xEE82EEFF,0xFFD720FF,0x8b4513FF,0x4949A0FF,0x148b8bFF,0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,
0x10DC29FF,0x534081FF,0x0495CDFF,0xEF6CE8FF,0xBD34DAFF,0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,
0x65ADEBFF,0x5C1ACCFF,0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF,0x275222FF,0xF09F5BFF,
0x3D0A4FFF,0x22F767FF,0xD63034FF,0x9A6980FF,0xDFB935FF,0x3793FAFF,0x90239DFF,0xE9AB2FFF,0xAF2FF3FF,
0x057F94FF,0xB98519FF,0x388EEAFF,0x028151FF,0xA55043FF,0x0DE018FF,0x93AB1CFF,0x95BAF0FF,0x369976FF,
0x18F71FFF,0x4B8987FF,0x491B9EFF,0x829DC7FF,0xBCE635FF,0xCEA6DFFF,0x20D4ADFF,0x2D74FDFF,0x3C1C0DFF,
0x12D6D4FF,0x48C000FF,0x2A51E2FF,0xE3AC12FF,0xFC42A8FF,0x2FC827FF,0x1A30BFFF,0xB740C2FF,0x42ACF5FF,
0x2FD9DEFF,0xFAFB71FF,0x05D1CDFF,0xC471BDFF,0x94436EFF,0xC1F7ECFF,0xCE79EEFF,0xBD1EF2FF,0x93B7E4FF,
0x3214AAFF,0x184D3BFF,0xAE4B99FF,0x7E49D7FF,0x4C436EFF,0xFA24CCFF,0xCE76BEFF,0xA04E0AFF,0x9F945CFF,
0xDCDE3DFF,0x10C9C5FF,0x70524DFF,0x0BE472FF,0x8A2CD7FF,0x6152C2FF,0xCF72A9FF,0xE59338FF,0xEEDC2DFF,
0xD8C762FF,0xD8C762FF
};
Код:
dcmd_gang(playerid,params[]) {
new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(!strlen(tmp)) return SendClientMessage(playerid, RandomColors[random(200)], "USE: /gang [create/invite/join/leave/stats/list/radar]");
//---- Creazione Gang
if(strcmp(tmp, "create", true) == 0)
{
if(!strlen(tmp2)) return SendClientMessage(playerid, RandomColors[random(200)], "USE: /gang create [GangName]");
if(strlen(tmp2) < 3 || strlen(tmp2) > 15) {
return SendClientMessage(playerid, RandomColors[random(200)], "Gang name must be between 3 and 15 characters");
}
if(PlayerGang[playerid] != 0)
{
return SendClientMessage(playerid, RandomColors[random(200)], "You must leave your gang before make a new one. /gang leave");
}
//CANCELLAZIONE GANG INATTIVE
if(GANG_NUMBER >= MAX_GANG)
{
new string[128];
new file[30];
new name[MAX_PLAYER_NAME];
for(new i = 0; i <= GANG_NUMBER; i++)
{
format(file, sizeof(file), GANG_FILE, i);
if(dini_Exists(file) && dini_Int(file,"GANG_MEMBERS") <= 1)
{
dini_Remove(file);
format(string, sizeof(string), "Gang Removed: ID:%d, Member: %d, Name: %s", i, GangInfo[i][GANG_MEMBERS], GangInfo[i][GANG_NAME]);
SendClientMessage(playerid, RandomColors[random(200)], string);
format(string, sizeof(string), "Gang %s Telah Di Bubarkan", GangInfo[i][GANG_NAME]);
SendClientMessageToAll(RandomColors[random(200)], string);
for(new p; p < MAX_PLAYERS; p++)
{
if(PlayerGang[p] == i && IsPlayerConnected(p))
{
GetPlayerName(p, name, sizeof(name));
format(file, sizeof(file), NAME_FILE, name);
dini_IntSet(file, "PGANG", 0);
PlayerGang[p] = 0;
}
}
}
}
}
new gangid = 0;
for(new i; i < GANG_NUMBER; i++)
{
new file[100];
format(file, sizeof(file), GANG_FILE, i);
if(dini_Exists(file))
{
new gname[15];
strcat(gname, dini_Get(file, "GANG_NAME"),15);
if(strfind(tmp2, gname, true) == 0)
{
return SendClientMessage(playerid, RandomColors[random(200)], "There is already a gang with the same name");
}
}
else if(!dini_Exists(file) && i != 0) gangid = i;
}
if(gangid == 0) {
GANG_NUMBER++;
gangid = GANG_NUMBER;
}
dini_IntSet(CFG,"GANG_NUMBER",GANG_NUMBER);
new gfile[100];
format(gfile, sizeof(gfile), GANG_FILE, gangid);
dini_Create(gfile);
format(GangInfo[gangid][GANG_NAME], sizeof(tmp2), "%s", tmp2);
dini_Set(gfile, "GANG_NAME", GangInfo[gangid][GANG_NAME]);
dini_IntSet(gfile, "GANG_ID", gangid);
dini_IntSet(gfile,"GANG_MEMBERS",0);
GangInfo[gangid][GANG_ID] = gangid;
GangInfo[gangid][GANG_MEMBERS] = 0;
GangInfo[gangid][GANG_COLOR] = RandomColors[gangid];
new string[128];
format(string, sizeof(string), "Gang Created. Name: %s, ID: %d", GangInfo[gangid][GANG_NAME], GangInfo[gangid][GANG_ID]);
SendClientMessage(playerid, RandomColors[random(200)], string);
JoinGang(playerid, gangid);
return 1;
}
//---- Invito
if(strcmp(tmp, "invite", true) == 0)
{
if(!strlen(tmp2)) return SendClientMessage(playerid, RandomColors[random(200)], "USE: /gang invite [ID]");
if(PlayerGang[playerid] == 0)
{
return SendClientMessage(playerid, RandomColors[random(200)], "You are not in a gang");
}
if(GangInfo[PlayerGang[playerid]][GANG_MEMBERS] > 14)
{
return SendClientMessage(playerid, RandomColors[random(200)], "Has reached the maximum number of members (15) for this gang");
}
new id = strval(tmp2);
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, RandomColors[random(200)], "Invalid ID");
new name[MAX_PLAYER_NAME];
new name1[MAX_PLAYER_NAME];
GetPlayerName(id, name, sizeof(name));
GetPlayerName(playerid, name1, sizeof(name1));
invited[id] = PlayerGang[playerid];
new string[256];
format(string, sizeof(string), "You have been invited from %s join in the gang %s. /gang join", name1, GangInfo[PlayerGang[playerid]][GANG_NAME]);
SendClientMessage(id, RandomColors[random(200)], string);
format(string, sizeof(string), "You invited %s to join in your gang", name);
SendClientMessage(playerid, RandomColors[random(200)], string);
return 1;
}
//---- Join Gang
if(strcmp(tmp, "join", true) == 0)
{
if(PlayerGang[playerid] != 0) return SendClientMessage(playerid, RandomColors[random(200)], "Devi lasciare la tua gang prima.");
if(invited[playerid] == 0) return SendClientMessage(playerid, RandomColors[random(200)], "Non sei stato invitato in nessuna gang.");
JoinGang(playerid, invited[playerid]);
return 1;
}
//---- Lasciare Gang
if(strcmp(tmp, "leave", true) == 0)
{
if(PlayerGang[playerid] == 0){
new file[100];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), NAME_FILE, name);
dini_IntSet(file, "PGANG", 0);
PlayerGang[playerid] = 0;
if(PlayerGang[playerid] == 0)
{
return SendClientMessage(playerid, RandomColors[random(200)], "You are not in a gang");
}
}
LeaveGang(playerid, PlayerGang[playerid]);
return 1;
}
//---- List
if(strcmp(tmp, "list", true) == 0)
{
new string[256];
new file[100];
new string2[256];
new listcount = 0;
for(new i = 0; i <= GANG_NUMBER; i++)
{
format(file, sizeof(file), GANG_FILE, i);
if(dini_Exists(file)) {
if(listcount == 10)
{
SendClientMessage(playerid, RandomColors[random(200)], string);
format(string, sizeof(string), "");
listcount = 0;
}
else
{
format(string2, sizeof(string2), "%s,", GangInfo[i][GANG_NAME]);
format(string, sizeof(string), "%s %s", string, string2);
listcount++;
}
}
}
return 1;
}
//---- Stats
if(strcmp(tmp, "stats", true) == 0)
{
if(PlayerGang[playerid] == 0)
{
return SendClientMessage(playerid, RandomColors[random(200)], "You are not in a gang");
}
new gangid = PlayerGang[playerid];
new string[128];
GangInfo[gangid][GANG_NZONE] = 0;
for(new i = 0; i <= ZONE_NUMBER; i++)
{
new file[100];
format(file, sizeof(file), ZONE_FILE, i);
if(dini_Exists(file) && GangInfo[gangid][GANG_ID] == dini_Int(file,"ZONE_GANGID")) GangInfo[gangid][GANG_NZONE]++;
}
format(string, sizeof(string), "ID: %d", gangid);
SendClientMessage(playerid, RandomColors[random(200)], string);
if(ITA[playerid]) format(string, sizeof(string), "Nome della gang: %s", GangInfo[gangid][GANG_NAME]);
else format(string, sizeof(string), "Gang Name: %s", GangInfo[gangid][GANG_NAME]);
SendClientMessage(playerid, RandomColors[random(200)], string);
if(ITA[playerid]) format(string, sizeof(string), "Numero di membri: %d", GangInfo[gangid][GANG_MEMBERS]);
else format(string, sizeof(string), "Members: %d", GangInfo[gangid][GANG_MEMBERS]);
SendClientMessage(playerid, RandomColors[random(200)], string);
if(ITA[playerid]) format(string, sizeof(string), "Numero di territori conquistati: %d", GangInfo[gangid][GANG_NZONE]);
else format(string, sizeof(string), "Number of Gang Zone: %d", GangInfo[gangid][GANG_NZONE]);
SendClientMessage(playerid, RandomColors[random(200)], string);
return 1;
}
//---- Delete Inactive
if(strcmp(tmp, "di", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RandomColors[random(200)], "No.");
new string[128];
new file[30];
new name[MAX_PLAYER_NAME];
for(new i = 0; i <= GANG_NUMBER; i++)
{
format(file, sizeof(file), GANG_FILE, i);
if(dini_Exists(file) && dini_Int(file,"GANG_MEMBERS") <= 1)
{
dini_Remove(file);
format(string, sizeof(string), "Gang Removed: ID:%d, Members: %d, Name: %s", i, GangInfo[i][GANG_MEMBERS], GangInfo[i][GANG_NAME]);
SendClientMessage(playerid, RandomColors[random(200)], string);
for(new p; p < MAX_PLAYERS; p++)
{
if(PlayerGang[p] == i && IsPlayerConnected(p))
{
GetPlayerName(p, name, sizeof(name));
format(file, sizeof(file), NAME_FILE, name);
dini_IntSet(file, "PGANG", 0);
PlayerGang[p] = 0;
}
}
}
}
return 1;
}
//---- Gang Radar
if(strcmp(tmp, "radar", true) == 0)
{
if(PlayerGang[playerid] == 0)
{
return SendClientMessage(playerid, RandomColors[random(200)], "You are not in a gang");
}
if(gradar[playerid] == 0)
{
for(new i; i < MAX_PLAYERS; i++)
{
if(PlayerGang[playerid] != PlayerGang[i] && IsPlayerConnected(i)) SetPlayerMarkerForPlayer(playerid, i, (GetPlayerColor(i) & 0xFFFFFF00));
}
gradar[playerid] = 1;
gradartimer[playerid] = SetTimerEx("GangRadar", 1000, true, "i", playerid);
}
else
{
for(new i; i < MAX_PLAYERS; i++) SetPlayerMarkerForPlayer(playerid, i, GetPlayerColor(i));
gradar[playerid] = 0;
KillTimer(gradartimer[playerid]);
}
return 1;
}
//---- Help
if(strcmp(tmp, "help", true) == 0)
{
{
SendClientMessage(playerid, RandomColors[random(200)], "Use: /Gang create to create gang");
SendClientMessage(playerid, RandomColors[random(200)], "Use: /Gang invite for invite a player in your gang");
SendClientMessage(playerid, RandomColors[random(200)], "Use: /Gang join for join a gang if you are invited");
SendClientMessage(playerid, RandomColors[random(200)], "Use: /Gang leave for leave a gang");
SendClientMessage(playerid, RandomColors[random(200)], "Use: /Gang for view other commands");
SendClientMessage(playerid, RandomColors[random(200)], "Use: /Gang help1 for help of difence and attack the territories");
}
return 1;
}
if(strcmp(tmp, "help1", true) == 0)
{
SendClientMessage(playerid, RandomColors[random(200)], "Use: /G [Text] to talk with your gang");
SendClientMessage(playerid, RandomColors[random(200)], "To attack a gang zone 3 members of your gang must stay there for 2 minutes");
SendClientMessage(playerid, RandomColors[random(200)], "When the 3 members invade the gangzone, this one start highlighting and it will stop when the gangzone it will be conquisted");
}
return 1;
}
else SendClientMessage(playerid, RandomColors[random(200)], "USE: /gang [create/invite/join/leave/stats/list/radar]");
return 1;
}
//---- Delete Zone
*/