Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*------------------------------[v0.1]------------------------------
- --------------------[ GangZoneSystem by Dr_Pawn ]-------------------
- ------------------------------[v0.1]------------------------------*/
- /*------------------------------------------------------------ INCLIDE/DEFINES*/
- #include a_samp
- #define iMAX_GZ (99)
- #define iINVALID_GANGZONE_ID (-1)
- /*-------------------------------------------------------------------- FORWARD*/
- forward FimDominarGangZone(GangZoneID, Cor);
- forward iGz_FimDominarGangZone(GangZoneID, Cor);
- /*------------------------------------------------------------------------ NEW*/
- new UltimaGangZone = -1;
- enum iGz_Info
- {
- //GangZoneID
- iGz_,
- //GangZoneConfiguration
- Float:iGz_Pos[4],
- iGz_Cor,
- iGz_Dono,
- //GangZoneDomination
- bool:iGz_Dominando,
- iGz_DominandoCor
- };
- new iGz[iMAX_GZ][iGz_Info];
- /*-------------------------------------------------------------------- INCLUDE*/
- stock NovaGangZone(Float:PosXMin, Float:PosYMin, Float:PosXMax, Float:PosYMax, Cor, Dono = -1)
- {
- if(UltimaGangZone == (iMAX_GZ - 1)) print("iGz: Nao foi Possivel Criar outra GangZone. Motivo: Limite Atingido.");
- UltimaGangZone++;
- iGz[UltimaGangZone][iGz_] = GangZoneCreate(PosXMin, PosYMin, PosXMax, PosYMax);
- iGz[UltimaGangZone][iGz_Cor] = Cor;
- iGz[UltimaGangZone][iGz_Dono] = Dono;
- //Checar e Corrigir
- if(PosXMax < PosXMin)
- {
- new Float:Trocar = PosXMax;
- PosXMax = PosXMin;
- PosXMin = Trocar;
- }
- if(PosYMax < PosYMin)
- {
- new Float:Trocar = PosYMax;
- PosYMax = PosYMin;
- PosYMin = Trocar;
- }
- iGz[UltimaGangZone][iGz_Pos][0] = PosXMin;
- iGz[UltimaGangZone][iGz_Pos][1] = PosYMin;
- iGz[UltimaGangZone][iGz_Pos][2] = PosXMax;
- iGz[UltimaGangZone][iGz_Pos][3] = PosYMax;
- iGz[UltimaGangZone][iGz_Dominando] = false;
- iGz[UltimaGangZone][iGz_DominandoCor] = 0xFFFFFFAA;
- GangZoneShowForAll(iGz[UltimaGangZone][iGz_], Cor);
- return UltimaGangZone;
- }
- stock JogadorNaGangZone(playerid)
- {
- if(!IsPlayerConnected(playerid) || UltimaGangZone == iINVALID_GANGZONE_ID) return iINVALID_GANGZONE_ID;
- new Float:PosX,
- Float:PosY,
- Float:PosZ;
- GetPlayerPos(playerid, PosX, PosY, PosZ);
- for(new gz = 0; gz <= UltimaGangZone; gz++)
- if(PosX > iGz[gz][iGz_Pos][0] && PosY > iGz[gz][iGz_Pos][1] && PosX < iGz[gz][iGz_Pos][2] && PosY < iGz[gz][iGz_Pos][3])
- return gz;
- return iINVALID_GANGZONE_ID;
- }
- stock DominarGangZone(GangZoneID, Cor, Tempo)
- {
- if(GangZoneID > UltimaGangZone || iGz[GangZoneID][iGz_Dominando] == true) return 0;
- iGz[GangZoneID][iGz_Dominando] = true;
- iGz[GangZoneID][iGz_DominandoCor] = Cor;
- GangZoneFlashForAll(iGz[GangZoneID][iGz_], Cor);
- SetTimerEx("iGz_FimDominarGangZone", Tempo, false, "ii", GangZoneID, Cor);
- return 1;
- }
- stock TrocarCorGangZone(GangZoneID, Cor)
- {
- if(GangZoneID > UltimaGangZone || iGz[GangZoneID][iGz_Dominando] == true) return 0;
- GangZoneShowForAll(iGz[GangZoneID][iGz_], Cor);
- iGz[GangZoneID][iGz_Cor] = Cor;
- return 1;
- }
- stock TrocarDonoGangZone(GangZoneID, Dono)
- {
- if(GangZoneID > UltimaGangZone) return 0;
- iGz[iGz[GangZoneID][iGz_]][iGz_Dono] = Dono;
- return 1;
- }
- stock DonoDaGangZone(GangZoneID)
- {
- if(GangZoneID > UltimaGangZone) return -1;
- return iGz[iGz[GangZoneID][iGz_]][iGz_Dono];
- }
- stock DominandoGangZone(GangZoneID)
- {
- if(GangZoneID > UltimaGangZone) return false;
- return iGz[GangZoneID][iGz_Dominando];
- }
- public iGz_FimDominarGangZone(GangZoneID, Cor)
- {
- iGz[GangZoneID][iGz_Dominando] = false;
- GangZoneStopFlashForAll(iGz[GangZoneID][iGz_]);
- FimDominarGangZone(GangZoneID, Cor);
- return 1;
- }
- iGz_OnPlayerConnect(playerid)
- {
- if(UltimaGangZone == -1) return 1;
- for(new gz = 0; gz <= UltimaGangZone; gz++)
- {
- GangZoneShowForPlayer(playerid, iGz[gz][iGz_], iGz[gz][iGz_Cor]);
- if(iGz[gz][iGz_Dominando])
- GangZoneFlashForPlayer(playerid, iGz[gz][iGz_], iGz[gz][iGz_DominandoCor]);
- }
- return 1;
- }
- /*-------------------------------------------------------------------- NATIVES*/
- /*native NovaGangZone(Float:PosXMin, Float:PosYMin, Float:PosXMax, Float:PosYMax, Cor, Dono = -1);
- native JogadorNaGangZone(playerid);
- native DominarGangZone(GangZoneID, Cor, Tempo);
- native TrocarCorGangZone(GangZoneID, Cor);
- native TrocarDonoGangZone(GangZoneID, Dono);
- native DonoDaGangZone(GangZoneID);
- native DominandoGangZone(GangZoneID);*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement