25.12.2013, 06:58
Hi mates again! this time i downloaded a gang zone script from here
https://sampforum.blast.hk/showthread.php?tid=261411
Full fs:
Just /gang list and gang radar:
Both /gang radar and /gang list are not working for me any help?
https://sampforum.blast.hk/showthread.php?tid=261411
Full fs:
pawn Код:
/*-------------------------
Made by MavericK (http://www.italianfighters.com)
Don't remove credits.
Test it on the official server italianfighters.com:7777
--------------------------*/
#include <a_samp>
#include <dini>
#include <dcallbacks>
#define MAX_GANG 400
#define MAX_ZONE 400
#define GREY 0x4F5152D4
#define CFG "MGang/CFG.ini"
#define GANG_FILE "MGang/Gang/%d.ini"
#define ZONE_FILE "MGang/Zone/%d.ini"
#define NAME_FILE "MUsers/%s.ini"
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
forward JoinGang(playerid, gangid);
forward GangRadar(playerid);
forward LeaveGang(playerid, gangid);
forward ConquistaGZ(areaid, gangid);
forward Message2Gang(gangid, text[]);
forward Message2All(ita[], eng[]);
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
};
//BLU IF 0x0000FF85
new GANG_NUMBER; //Numero di gang massimo
new ZONE_NUMBER; //Numero di zone massimo
new Float:x1, Float:y1, Float:z1; //Coordinata primo estremo /createzone
new Float:x2, Float:y2, Float:z2; //Coordinata secondo estremo /createzone
new creating = 0; //Determina se un и stato preso il primo estremo della zona
new zoneid = 0; //Determina l'id della nuova zona creata
new PlayerGang[MAX_PLAYERS]; //Gang del giocatore
new gradar[MAX_PLAYERS]; //Gang radar switch
new gradartimer[MAX_PLAYERS]; //Gang radar timer
new invited[MAX_PLAYERS]; //Il giocatore и stato invitato
new ITA[MAX_PLAYERS]; //Linguaggio del giocatore
new GangTimer[MAX_GANG][MAX_ZONE]; //Timer di conquista della zona
new Invaders[MAX_GANG][MAX_ZONE]; // Invasori di una zona
enum GANG_MAIN {
GANG_ID, //ID Della gang
GANG_NAME[20], //Nome della gang
GANG_COLOR, //Colore della gang
GANG_NZONE, //Numero di gang zone conquistate
GANG_MEMBERS //Numero membri della gang
}
enum ZONE_MAIN {
ZONE_ID, //ID Della zona
ZONE_GZID, //ID della gangzone
ZONE_GANGID, //Gang che possiede la zona
ZONE_COLOR, //Colore della zona
Float:ZONE_X1, //Coordinate della zona
Float:ZONE_Y1,
Float:ZONE_X2,
Float:ZONE_Y2
}
new GangInfo[MAX_GANG][GANG_MAIN];
new ZoneInfo[MAX_ZONE][ZONE_MAIN];
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Gang Wars MavericK 1337 System LOADED");
print("--------------------------------------\n");
SetTimer("TIMER_DCallbacks",1000,true); //TIMER ZONACHECK
ShowPlayerMarkers(1);
//---- Creazione del CFG (Se non presente)
if(!dini_Exists(CFG))
{
dini_Create(CFG);
dini_IntSet(CFG,"GANG_NUMBER",0);
dini_IntSet(CFG,"ZONE_NUMBER",0);
}
//---- Rilevamento CFG
GANG_NUMBER = dini_Int(CFG,"GANG_NUMBER");
ZONE_NUMBER = dini_Int(CFG,"ZONE_NUMBER");
//---- Rilevamento Gang
for(new i = 0; i <= GANG_NUMBER; i++)
{
new file[100];
format(file, sizeof(file), GANG_FILE, i);
if(dini_Exists(file)) {
GangInfo[i][GANG_ID] = i;
strcat(GangInfo[i][GANG_NAME], dini_Get(file, "GANG_NAME"),strlen(dini_Get(file, "GANG_NAME"))+1);
GangInfo[i][GANG_MEMBERS] = dini_Int(file, "GANG_MEMBERS");
GangInfo[i][GANG_COLOR] = RandomColors[i];
for(new l; l < ZONE_NUMBER; l++)
{
format(file, sizeof(file), ZONE_FILE, l);
if(dini_Exists(file) && GangInfo[i][GANG_ID] == dini_Int(file,"ZONE_GANGID")) GangInfo[i][GANG_NZONE]++;
}
}
}
//---- Rilevamento GangZone e settaggio AreaCheck
for(new i = 0; i <= ZONE_NUMBER; i++)
{
new file[100];
format(file, sizeof(file), ZONE_FILE, i);
if(dini_Exists(file))
{
ZoneInfo[i][ZONE_GANGID] = dini_Int(file,"ZONE_GANGID");
ZoneInfo[i][ZONE_ID] = i;
ZoneInfo[i][ZONE_COLOR] = RandomColors[ZoneInfo[i][ZONE_GANGID]];
ZoneInfo[i][ZONE_X1] = dini_Float(file,"ZONE_X1");
ZoneInfo[i][ZONE_Y1] = dini_Float(file,"ZONE_Y1");
ZoneInfo[i][ZONE_X2] = dini_Float(file,"ZONE_X2");
ZoneInfo[i][ZONE_Y2] = dini_Float(file,"ZONE_Y2");
/*if(ZoneInfo[i][ZONE_X1] < -667.4763 || ZoneInfo[i][ZONE_X2] > 2922.8083 || ZoneInfo[i][ZONE_Y1] < 400.0233 || ZoneInfo[i][ZONE_Y2] > 2905.2715)
{
AddAreaCheck(1, 2, 1, 2);
continue;
}UNCOMMENT THIS TO USE ONLY LAS VENTURAS ZONE*/
ZoneInfo[i][ZONE_GZID] = GangZoneCreate(ZoneInfo[i][ZONE_X1], ZoneInfo[i][ZONE_Y1], ZoneInfo[i][ZONE_X2], ZoneInfo[i][ZONE_Y2]);
GangZoneShowForAll(ZoneInfo[i][ZONE_GZID], ZoneInfo[i][ZONE_COLOR]);
AddAreaCheck(ZoneInfo[i][ZONE_X1], ZoneInfo[i][ZONE_X2], ZoneInfo[i][ZONE_Y1], ZoneInfo[i][ZONE_Y2]);
Invaders[i][i] = 0;
} else if(!dini_Exists(file) && i != 0) AddAreaCheck(1, 2, 1, 2);
}
//---- Setta il PGANG (Gang Del Giocatore)
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new file[100];
new fileg[100];
new name[MAX_PLAYER_NAME];
gradar[i] = 0; // RESET GANG RADAR
GetPlayerName(i, name, sizeof(name));
format(file, sizeof(file), NAME_FILE, name);
if(!dini_Exists(file))
{
dini_Create(file);
dini_IntSet(file, "PGANG", 0);
dini_IntSet(file, "Lang", 0);
}
PlayerGang[i] = dini_Int(file, "PGANG");
format(fileg, sizeof(fileg), GANG_FILE, PlayerGang[i]);
if(!dini_Exists(fileg))
{
dini_IntSet(file, "PGANG", 0);
PlayerGang[i] = 0;
}
}
}
return 1;
}
public OnFilterScriptExit()
{
//---- Distrugge tutte le GangZone
for(new i = 0; i <= ZONE_NUMBER; i++)
{
GangZoneDestroy(ZoneInfo[i][ZONE_GZID]);
}
return 1;
}
public OnPlayerConnect(playerid)
{
//---- Setta il PGANG (Gang Del Giocatore)
new file[100];
new fileg[100];
new name[MAX_PLAYER_NAME];
gradar[playerid] = 0;
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), NAME_FILE, name);
if(!dini_Exists(file))
{
dini_Create(file);
dini_IntSet(file, "PGANG", 0);
dini_IntSet(file, "Lang", 0);
}
PlayerGang[playerid] = dini_Int(file, "PGANG");
//---- Mostra GangZone quando un player si connette
for(new i = 0; i <= ZONE_NUMBER; i++)
{
format(file, sizeof(file), ZONE_FILE, i);
if(dini_Exists(file))
{
GangZoneShowForPlayer(playerid, ZoneInfo[i][ZONE_GZID], ZoneInfo[i][ZONE_COLOR]);
}
}
format(fileg, sizeof(fileg), GANG_FILE, PlayerGang[playerid]);
if(!dini_Exists(fileg))
{
dini_IntSet(file, "PGANG", 0);
PlayerGang[playerid] = 0;
}
for(new i; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
if(PlayerGang[playerid] != PlayerGang[i] && gradar[i] == 1) SetPlayerMarkerForPlayer(i, playerid, (GetPlayerColor(playerid) & 0xFFFFFF00));
}
return 1;
}
public OnPlayerSpawn(playerid)
{
//---- Settaggio colore player = Colore della gang
if(PlayerGang[playerid] != 0) SetPlayerColor(playerid, GangInfo[PlayerGang[playerid]][GANG_COLOR]);
//---- Setta il PGANG (Gang Del Giocatore)
new file[100];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), NAME_FILE, name);
if(dini_Int(file, "Lang") == 1) ITA[playerid] = true;
else ITA[playerid] = false;
for(new i; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
if(PlayerGang[playerid] != PlayerGang[i] && gradar[i] == 1) SetPlayerMarkerForPlayer(i, playerid, (GetPlayerColor(playerid) & 0xFFFFFF00));
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
//---- Creazione Zona
if (strcmp("/createzone", cmdtext, true, 10) == 0)
{
if (!IsPlayerAdmin(playerid)) return 0;
new file[100];
if(creating == 0) ZONE_NUMBER++;
if(zoneid == 0)
{
for(new i = 0; i < ZONE_NUMBER; i++)
{
format(file, sizeof(file), ZONE_FILE, i);
if(!dini_Exists(file) && i != 0) zoneid = i;
}
}
format(file, sizeof(file), ZONE_FILE, zoneid);
if(creating == 0)
{
dini_IntSet(CFG,"ZONE_NUMBER",ZONE_NUMBER);
dini_Create(file);
dini_IntSet(file, "ZONE_GANGID", 0);
ZoneInfo[zoneid][ZONE_ID] = zoneid;
ZoneInfo[zoneid][ZONE_GANGID] = 0;
ZoneInfo[zoneid][ZONE_COLOR] = GREY;
GetPlayerPos(playerid, x1, y1, z1);
SendClientMessage(playerid, RandomColors[random(200)], "Rerun the cmd in the opposite corner of the zone");
creating = 1;
}
else
{
GetPlayerPos(playerid, x2, y2, z2);
if(x1 < x2)
{
dini_FloatSet(file, "ZONE_X1", x1);
dini_FloatSet(file, "ZONE_X2", x2);
}
else
{
dini_FloatSet(file, "ZONE_X1", x2);
dini_FloatSet(file, "ZONE_X2", x1);
}
if(y1 < y2)
{
dini_FloatSet(file, "ZONE_Y1", y1);
dini_FloatSet(file, "ZONE_Y2", y2);
}
else
{
dini_FloatSet(file, "ZONE_Y1", y2);
dini_FloatSet(file, "ZONE_Y2", y1);
}
ZoneInfo[zoneid][ZONE_X1] = dini_Float(file, "X1");
ZoneInfo[zoneid][ZONE_Y1] = dini_Float(file, "Y1");
ZoneInfo[zoneid][ZONE_X2] = dini_Float(file, "X2");
ZoneInfo[zoneid][ZONE_Y2] = dini_Float(file, "Y2");
ZoneInfo[zoneid][ZONE_GZID] = GangZoneCreate(x1, y1, x2, y2);
GangZoneShowForAll(ZoneInfo[zoneid][ZONE_GZID], GREY);
AddAreaCheck(ZoneInfo[zoneid][ZONE_X1], ZoneInfo[zoneid][ZONE_X2], ZoneInfo[zoneid][ZONE_Y1], ZoneInfo[zoneid][ZONE_Y2]);
creating = 0;
new string[128];
format(string, sizeof(string), "GangZone Creata. ID: %d", zoneid);
SendClientMessage(playerid, RandomColors[random(200)], string);
zoneid = 0;
}
return 1;
}
dcmd(gang, 4, cmdtext);
dcmd(deletezone, 10, cmdtext);
dcmd(g, 1, cmdtext);
return 0;
}
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) {
if(ITA[playerid]) return SendClientMessage(playerid, RandomColors[random(200)], "Il nome della gang deve essere compreso tra 3 e 15 caratteri");
else return SendClientMessage(playerid, RandomColors[random(200)], "Gang name must be between 3 and 15 characters");
}
if(PlayerGang[playerid] != 0)
{
if(ITA[playerid]) return SendClientMessage(playerid, RandomColors[random(200)], "Devi lasciare la tua attuale gang prima di crearne una. /gang leave");
else 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 Rimossa: ID:%d, Membri: %d, Nome: %s", i, GangInfo[i][GANG_MEMBERS], GangInfo[i][GANG_NAME]);
SendClientMessage(playerid, RandomColors[random(200)], string);
format(string, sizeof(string), "La gang %s si и sciolta", 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)
{
if(ITA[playerid]) return SendClientMessage(playerid, RandomColors[random(200)], "Esiste giа una gang con lo stesso nome");
else 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];
if(ITA[playerid]) format(string, sizeof(string), "Gang Creata. Nome: %s, ID: %d", GangInfo[gangid][GANG_NAME], GangInfo[gangid][GANG_ID]);
else 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)
{
if(ITA[playerid]) return SendClientMessage(playerid, RandomColors[random(200)], "Non sei in nessuna gang");
else return SendClientMessage(playerid, RandomColors[random(200)], "You are not in a gang");
}
if(GangInfo[PlayerGang[playerid]][GANG_MEMBERS] > 14)
{
if(ITA[playerid]) return SendClientMessage(playerid, RandomColors[random(200)], "и stato raggiunto il numero massimo di membri (15) per questa gang");
else 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];
if(ITA[id]) format(string, sizeof(string), "Sei stato invitato da %s a entrare a nella gang %s. /gang join", name1, GangInfo[PlayerGang[playerid]][GANG_NAME]);
else 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);
if(ITA[playerid]) format(string, sizeof(string), "Hai invitato %s a entrare a nella tua gang", name);
else 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)
{
if(ITA[playerid]) return SendClientMessage(playerid, RandomColors[random(200)], "Non sei in nessuna gang");
else 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)
{
if(ITA[playerid]) return SendClientMessage(playerid, RandomColors[random(200)], "Non sei in nessuna gang");
else 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)
{
if(ITA[playerid]) return SendClientMessage(playerid, RandomColors[random(200)], "Non sei in nessuna gang");
else 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)
{
if(ITA[playerid])
{
SendClientMessage(playerid, RandomColors[random(200)], "Usa: /Gang create per create una gang");
SendClientMessage(playerid, RandomColors[random(200)], "Usa: /Gang invite per invitare un giocatore nella gang");
SendClientMessage(playerid, RandomColors[random(200)], "Usa: /Gang join per entrare a far parte della gang dove sei stato invitato");
SendClientMessage(playerid, RandomColors[random(200)], "Usa: /Gang leave per lasciare la tua attuale gang");
SendClientMessage(playerid, RandomColors[random(200)], "Usa: /Gang per vedere gli altri comandi utili");
SendClientMessage(playerid, RandomColors[random(200)], "Usa: /Gang help1 per sapere come conquistare e difendere i territori");
}
else
{
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)
{
if(ITA[playerid])
{
SendClientMessage(playerid, RandomColors[random(200)], "Usa: /G [Messagio] per parlare con i membri della tua gang");
SendClientMessage(playerid, RandomColors[random(200)], "Per conquistare un territorio almeno 3 membri della tua gang");
SendClientMessage(playerid, RandomColors[random(200)], "Devono occuparlo per 2 minuti. Quando i 3 membri invadono il territorio");
SendClientMessage(playerid, RandomColors[random(200)], "Quest'ultimo incomincia a lampeggiare e smetterа quando il territorio sarа conquistato");
SendClientMessage(playerid, RandomColors[random(200)], "Entrando in un territorio nemico vedrai il nome della gang che lo possiede in basso a destra");
}
else
{
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
dcmd_deletezone(playerid,params[]) {
new tmp[256] , Index; tmp = strtok(params,Index);
new id = strval(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid, RandomColors[random(200)], "USA: /deletezone [ID]");
if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RandomColors[random(200)], "Devi essere admin livello 3");
new file[100];
format(file, sizeof(file), ZONE_FILE, id);
GangZoneDestroy(ZoneInfo[id][ZONE_GZID]);
dini_Remove(file);
new string[128];
format(string, sizeof(string), "GangZone removed.", zoneid);
SendClientMessage(playerid, RandomColors[random(200)], string);
return 1;
}
//---- Gang Chat
dcmd_g(playerid,params[]) {
if(PlayerGang[playerid] == 0)
{
if(ITA[playerid]) return SendClientMessage(playerid, RandomColors[random(200)], "Non sei in nessuna gang");
else return SendClientMessage(playerid, RandomColors[random(200)], "You are not in a gang");
}
if(!strlen(params)) return SendClientMessage(playerid, RandomColors[random(200)], "USA: /g [Message]");
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[GANG] %s: %s", name, params);
Message2Gang(PlayerGang[playerid], string);
return 1;
}
//---- Join Gang
public JoinGang(playerid, gangid)
{
new file[100];
new name[MAX_PLAYER_NAME];
new gfile[100];
format(gfile, sizeof(gfile), GANG_FILE, gangid);
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), NAME_FILE, name);
dini_IntSet(file, "PGANG", gangid);
new string[256];
new stringeng[256];
PlayerGang[playerid] = gangid;
GangInfo[gangid][GANG_MEMBERS]++;
if(ITA[playerid]) format(string, sizeof(string), "Sei entrato a far parte della gang %s, Membri: %d", GangInfo[gangid][GANG_NAME], GangInfo[gangid][GANG_MEMBERS]);
else format(string, sizeof(string), "You joined the gang %s, Members: %d", GangInfo[gangid][GANG_NAME], GangInfo[gangid][GANG_MEMBERS]);
SendClientMessage(playerid, RandomColors[random(200)], string);
format(string, sizeof(string), "%s и entrato a far parte della gang %s", name , GangInfo[gangid][GANG_NAME]);
format(stringeng, sizeof(stringeng), "%s Has joined the gang %s", name , GangInfo[gangid][GANG_NAME]);
Message2All(string, stringeng);
SetPlayerColor(playerid, GangInfo[gangid][GANG_COLOR]);
dini_IntSet(gfile, "GANG_MEMBERS", GangInfo[gangid][GANG_MEMBERS]);
return 1;
}
//---- Gang Radar Timer
public GangRadar(playerid)
{
for(new i; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
if(PlayerGang[playerid] != PlayerGang[i] && gradar[playerid] == 1) SetPlayerMarkerForPlayer(playerid, i, (GetPlayerColor(i) & 0xFFFFFF00));
}
}
//---- Lasciare Gang
public LeaveGang(playerid, gangid)
{
new file[100];
new name[MAX_PLAYER_NAME];
new gfile[100];
format(gfile, sizeof(gfile), GANG_FILE, gangid);
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), NAME_FILE, name);
dini_IntSet(file, "PGANG", 0);
new string[256];
new stringeng[256];
if(ITA[playerid]) format(string, sizeof(string), "Hai lasciato la gang %s", GangInfo[gangid][GANG_NAME]);
else format(string, sizeof(string), "You left the gang %s", GangInfo[gangid][GANG_NAME]);
SendClientMessage(playerid, RandomColors[random(200)], string);
format(string, sizeof(string), "%s ha lasciato la gang %s", name , GangInfo[gangid][GANG_NAME]);
format(stringeng, sizeof(stringeng), "%s has left gang %s", name , GangInfo[gangid][GANG_NAME]);
Message2All(string, stringeng);
PlayerGang[playerid] = 0;
GangInfo[gangid][GANG_MEMBERS]--;
SetPlayerColor(playerid, RandomColors[random(200)]);
if(GangInfo[gangid][GANG_MEMBERS] == 0) {
format(string, sizeof(string), "La gang %s si и sciolta", GangInfo[gangid][GANG_NAME]);
format(stringeng, sizeof(stringeng), "The gang %s was abandoned", GangInfo[gangid][GANG_NAME]);
Message2All(string, stringeng);
return dini_Remove(gfile);
}
dini_IntSet(gfile, "GANG_MEMBERS", GangInfo[gangid][GANG_MEMBERS]);
return 1;
}
public Message2All(ita[], eng[])
{
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(ITA[i]) SendClientMessage(i, RandomColors[random(200)], ita);
else SendClientMessage(i, RandomColors[random(200)], eng);
}
}
return 1;
}
//---- AREACHECK
OnPlayerEnterArea(playerid,areaid) {
new string[128];
new gangid = PlayerGang[playerid];
if(gangid != ZoneInfo[areaid][ZONE_GANGID] && gangid != 0 && GetPlayerVirtualWorld(playerid) == 0) Invaders[gangid][areaid]++; //Aggiunta di un invasore
if(Invaders[gangid][areaid] == 3)
{
//---- Se gli invasori sono sufficienti (3) Parte il timer per far conquistare la gangzone agli invasori
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerGang[i] == gangid)
{
if(ITA[playerid]) SendClientMessage(i, RandomColors[random(200)], "State conquistando la zona");
else SendClientMessage(i, RandomColors[random(200)], "You are conquisting the gang zone");
}
}
GangZoneFlashForAll(ZoneInfo[areaid][ZONE_GZID],GangInfo[gangid][GANG_COLOR]);
if(ZoneInfo[areaid][ZONE_GANGID] != 0) GangTimer[gangid][areaid] = SetTimerEx("ConquistaGZ", 60000*2, false, "ii", areaid, gangid);
else GangTimer[gangid][areaid] = SetTimerEx("ConquistaGZ", 30000, false, "ii", areaid, gangid);
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerGang[i] == ZoneInfo[areaid][ZONE_GANGID] && PlayerGang[playerid] != ZoneInfo[areaid][ZONE_GANGID] && PlayerGang[i] != 0)
{
if(ITA[playerid])
{
SendClientMessage(i, RandomColors[random(200)], "Una vostra zona и sotto attacco");
SendClientMessage(i, RandomColors[random(200)], "Una vostra zona и sotto attacco");
SendClientMessage(i, RandomColors[random(200)], "Una vostra zona и sotto attacco");
} else
{
SendClientMessage(i, RandomColors[random(200)], "A GangZone of yours is under attack");
SendClientMessage(i, RandomColors[random(200)], "A GangZone of yours is under attack");
SendClientMessage(i, RandomColors[random(200)], "A GangZone of yours is under attack");
}
format(string, sizeof(string), "X: %f, Y: %f, Area ID: %d", ZoneInfo[areaid][ZONE_X1], ZoneInfo[areaid][ZONE_Y1], areaid);
if(IsPlayerAdmin(i)) SendClientMessage(i, RandomColors[random(200)], string);
}
}
}
//---- Nome della gangzone
if(ZoneInfo[areaid][ZONE_GANGID] != 0)
{
format(string, sizeof(string), "%s", GangInfo[ZoneInfo[areaid][ZONE_GANGID]][GANG_NAME]);
GameTextForPlayer(playerid, string, 1000, 1);
}
}
OnPlayerLeaveArea(playerid,areaid) {
new gangid = PlayerGang[playerid];
if(Invaders[gangid][areaid] == 3)
{
KillTimer(GangTimer[gangid][areaid]); //---- Kill del timer per conquistare la gangzone
GangZoneStopFlashForAll(ZoneInfo[areaid][ZONE_GZID]);
}
if(gangid != ZoneInfo[areaid][ZONE_GANGID] && gangid != 0 && GetPlayerVirtualWorld(playerid) == 0) Invaders[gangid][areaid]--; //---- Togliere un invasor
}
//---- Conquista di una gangzone
public ConquistaGZ(areaid, gangid)
{
GangZoneStopFlashForAll(ZoneInfo[areaid][ZONE_GZID]);
ZoneInfo[areaid][ZONE_GANGID] = gangid;
new file[100];
format(file, sizeof(file), ZONE_FILE, areaid);
dini_IntSet(file, "ZONE_GANGID", ZoneInfo[areaid][ZONE_GANGID]);
ZoneInfo[areaid][ZONE_COLOR] = GangInfo[gangid][GANG_COLOR];
//---- Rilevamento GangZone
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerGang[i] == gangid)
{
if(ITA[i]) SendClientMessage(i, RandomColors[random(200)], "Zona conquistata");
else SendClientMessage(i, RandomColors[random(200)], "Zona conquisted");
}
}
for(new i = 0; i <= ZONE_NUMBER; i++)
{
GangZoneDestroy(ZoneInfo[i][ZONE_GZID]);
format(file, sizeof(file), ZONE_FILE, i);
if(dini_Exists(file))
{
ZoneInfo[i][ZONE_GANGID] = dini_Int(file,"ZONE_GANGID");
ZoneInfo[i][ZONE_ID] = i;
ZoneInfo[i][ZONE_COLOR] = RandomColors[ZoneInfo[i][ZONE_GANGID]];
ZoneInfo[i][ZONE_X1] = dini_Float(file,"ZONE_X1");
ZoneInfo[i][ZONE_Y1] = dini_Float(file,"ZONE_Y1");
ZoneInfo[i][ZONE_X2] = dini_Float(file,"ZONE_X2");
ZoneInfo[i][ZONE_Y2] = dini_Float(file,"ZONE_Y2");
ZoneInfo[i][ZONE_GZID] = GangZoneCreate(ZoneInfo[i][ZONE_X1], ZoneInfo[i][ZONE_Y1], ZoneInfo[i][ZONE_X2], ZoneInfo[i][ZONE_Y2]);
GangZoneShowForAll(ZoneInfo[i][ZONE_GZID], ZoneInfo[i][ZONE_COLOR]);
}
}
return 1;
}
public Message2Gang(gangid, text[])
{
for(new i; i < MAX_PLAYERS; i++)
{
if(PlayerGang[i] == gangid && IsPlayerConnected(i)) SendClientMessage(i, GangInfo[gangid][GANG_COLOR], text);
}
return 1;
}
stock sscanf(string[], format[], {Float,_}:...)
{
#if defined isnull
if (isnull(string))
#else
if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
#endif
{
return format[0];
}
#pragma tabsize 4
new
formatPos = 0,
stringPos = 0,
paramPos = 2,
paramCount = numargs(),
delim = ' ';
while (string[stringPos] && string[stringPos] <= ' ')
{
stringPos++;
}
while (paramPos < paramCount && string[stringPos])
{
switch (format[formatPos++])
{
case '\0':
{
return 0;
}
case 'i', 'd':
{
new
neg = 1,
num = 0,
ch = string[stringPos];
if (ch == '-')
{
neg = -1;
ch = string[++stringPos];
}
do
{
stringPos++;
if ('0' <= ch <= '9')
{
num = (num * 10) + (ch - '0');
}
else
{
return -1;
}
}
while ((ch = string[stringPos]) > ' ' && ch != delim);
setarg(paramPos, 0, num * neg);
}
case 'h', 'x':
{
new
num = 0,
ch = string[stringPos];
do
{
stringPos++;
switch (ch)
{
case 'x', 'X':
{
num = 0;
continue;
}
case '0' .. '9':
{
num = (num << 4) | (ch - '0');
}
case 'a' .. 'f':
{
num = (num << 4) | (ch - ('a' - 10));
}
case 'A' .. 'F':
{
num = (num << 4) | (ch - ('A' - 10));
}
default:
{
return -1;
}
}
}
while ((ch = string[stringPos]) > ' ' && ch != delim);
setarg(paramPos, 0, num);
}
case 'c':
{
setarg(paramPos, 0, string[stringPos++]);
}
case 'f':
{
new changestr[16], changepos = 0, strpos = stringPos;
while(changepos < 16 && string[strpos] && string[strpos] != delim)
{
changestr[changepos++] = string[strpos++];
}
changestr[changepos] = '\0';
setarg(paramPos,0,_:floatstr(changestr));
}
case 'p':
{
delim = format[formatPos++];
continue;
}
case '\'':
{
new
end = formatPos - 1,
ch;
while ((ch = format[++end]) && ch != '\'') {}
if (!ch)
{
return -1;
}
format[end] = '\0';
if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
{
if (format[end + 1])
{
return -1;
}
return 0;
}
format[end] = '\'';
stringPos = ch + (end - formatPos);
formatPos = end + 1;
}
case 'u':
{
new
end = stringPos - 1,
id = 0,
bool:num = true,
ch;
while ((ch = string[++end]) && ch != delim)
{
if (num)
{
if ('0' <= ch <= '9')
{
id = (id * 10) + (ch - '0');
}
else
{
num = false;
}
}
}
if (num && IsPlayerConnected(id))
{
setarg(paramPos, 0, id);
}
else
{
#if !defined foreach
#define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
#define __SSCANF_FOREACH__
#endif
string[end] = '\0';
num = false;
new
name[MAX_PLAYER_NAME];
id = end - stringPos;
foreach (Player, playerid)
{
GetPlayerName(playerid, name, sizeof (name));
if (!strcmp(name, string[stringPos], true, id))
{
setarg(paramPos, 0, playerid);
num = true;
break;
}
}
if (!num)
{
setarg(paramPos, 0, INVALID_PLAYER_ID);
}
string[end] = ch;
#if defined __SSCANF_FOREACH__
#undef foreach
#undef __SSCANF_FOREACH__
#endif
}
stringPos = end;
}
case 's', 'z':
{
new
i = 0,
ch;
if (format[formatPos])
{
while ((ch = string[stringPos++]) && ch != delim)
{
setarg(paramPos, i++, ch);
}
if (!i)
{
return -1;
}
}
else
{
while ((ch = string[stringPos++]))
{
setarg(paramPos, i++, ch);
}
}
stringPos--;
setarg(paramPos, i, '\0');
}
default:
{
continue;
}
}
while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
{
stringPos++;
}
while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
{
stringPos++;
}
paramPos++;
}
do
{
if ((delim = format[formatPos++]) > ' ')
{
if (delim == '\'')
{
while ((delim = format[formatPos++]) && delim != '\'') {}
}
else if (delim != 'z')
{
return delim;
}
}
}
while (delim > ' ');
return 0;
}
pawn Код:
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;
}
//---- Gang Radar
if(strcmp(tmp, "radar", true) == 0)
{
if(PlayerGang[playerid] == 0)
{
if(ITA[playerid]) return SendClientMessage(playerid, RandomColors[random(200)], "Non sei in nessuna gang");
else 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;
}