Big Bug in GameMode
#1

Hi. My name is Lucas. I'm from Brazil and with some problems in my GameMode. As my language is Portuguese, I am not good at English. so if you have something different in the text, do not blame me, blame the translator of ****** =D
I want to help the system GangZones. A big bug is happening there.
I am going to post a video

http://www.youtube.com/watch?v=PNSKv2dzBL8

For what has to see the video, when I positioned my camera at another angle is something the map turn a super gangzone. but back to another position when she returns to normal.
I will post the code of gangzones here.


On top of gamemode
Код:
forward GangZoneTimer();
forward PayPlayerInGz(playerID, GzID, Float:x1, Float:y1, Float:x2, Float:y2, cash);
#define MAX_GZS 7
new Text:GangZoneText[MAX_PLAYERS];
new GangZoneUnderAttack[MAX_GZS];
new GangZone[MAX_GZS];
new GangZoneWave[MAX_GZS][MAX_GANGS];
new GangZoneColor[MAX_GZS]={COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE};
new GangZoneOwner[MAX_GZS]={999};
new GangZoneName[MAX_GZS][256]=
{
"Caligulas",
"Barco Pirata",
"Estacionamento",
"Come-A-Lot",
"Four Dragons",
"Posto",
"Monumental"
};
new Float:GangZonePos[MAX_GZS][4]={
{2117.0391,1762.9517,2316.6868,1543.9752}, // Caligulas
{1807.0566,1705.2527,2032.7548,1462.8376}, // Barco Pirata
{1060.5496,2347.3291,1157.6431,2168.0803}, // Estacionamento
{2077.6921,1188.4260,2341.9512,980.2180}, // Come-A-Lot
{1877.8793,1083.0854,2032.3274,939.1128}, // Four Dragons
{2157.0647,2512.6069,2216.5444,2463.8530}, // Posto
{976.2117,1161.7599,1177.8610,959.5369}// Monumental
};
In OnPlayerConnect
Код:
for(new i=0; i<MAX_GZS; i++) GangZoneShowForPlayer(playerid, GangZone[i], GangZoneColor[i]);
In OnGameModeInit
Код:
for(new i=0; i<MAX_GZS; i++)
{
GangZone[i] = GangZoneCreate(GangZonePos[i][0], GangZonePos[i][1], GangZonePos[i][2], GangZonePos[i][3]);
}
At the end of GameMode
Код:
public PayPlayerInGz(playerID, GzID, Float:x1, Float:y1, Float:x2, Float:y2, cash) //ID_GZ
 {

  if(IsPlayerConnected(playerID))
   {
     new Float:X, Float:Y, Float:Z, Float:Health, Float:Colete;
     GetPlayerArmour(playerID, Colete);
     GetPlayerPos(playerID, X, Y, Z);
     GetPlayerHealth(playerID,Health);
     if((X >= x1) && (X <= x2) && (Y >= y1) && (Y <= y2))
     {
       if(playerGang[playerID] > 0)
       {
         if(GangZoneOwner[GzID] == playerGang[playerID] && GangZoneOwner[GzID] < 999)
         {
           GivePlayerMoney(playerID, cash);
           if(Health < 105) SetPlayerHealth(playerID,Health + 2);
           else if(Colete < 105) SetPlayerArmour(playerID, Colete + 2);
         }
       }
     }
     return 1;
   }
   return 0;
 }

 stock IsPlayerInTerritory(playerid, GzID)
 {
   new Float:x,Float:y,Float:z;
   GetPlayerPos(playerid, x, y, z);
   if(x >= GangZonePos[GzID][0] && y >= GangZonePos[GzID][1] && x <= GangZonePos[GzID][2] && y <= GangZonePos[GzID][3]) return 1;
   else return 0;
 }

 stock GetCountOnTerritory(GzID, gangid)
 {
   new Count;
   for(new i=0; i<MAX_PLAYERS; i++)
   {
     if(IsPlayerConnected(i) && IsPlayerInTerritory(i, GzID) && playerGang[i] == gangid) Count ++;
   }
   return Count;
 }

 stock GameTextForGang(gangid, text[])
 {
   for(new i=0; i<MAX_PLAYERS; i++)
   {
     if(playerGang[i] == gangid)
     {
       GameTextForPlayer(i, text, 4000, 3);
     }
   }
   return 1;
 }

 stock ShowZoneTextForPlayer(playerid, GzID)
 {
   TextDrawHideForPlayer(playerid, GangZoneText[playerid]);
   if(IsPlayerConnected(playerid) && IsPlayerInTerritory(playerid, GzID))
   {
     if(GangZoneOwner[GzID] == 999)
     {
       GangZoneText[playerid] = TextDrawCreate(480.000000,425.000000,"~w~Zona ~r~Sem Dono");
       TextDrawAlignment(GangZoneText[playerid],0);
       TextDrawBackgroundColor(GangZoneText[playerid],0x000000ff);
       TextDrawFont(GangZoneText[playerid],1);
       TextDrawLetterSize(GangZoneText[playerid],0.399999,1.000000);
       TextDrawColor(GangZoneText[playerid],0xffffffff);
       TextDrawSetOutline(GangZoneText[playerid],1);
       TextDrawSetProportional(GangZoneText[playerid],1);
       TextDrawSetShadow(GangZoneText[playerid],1);
     }
     else
     {
       new string[256];
       format(string, sizeof(string), "~w~Zona da Gang: ~r~%s", gangNames[GangZoneOwner[GzID]]);
       GangZoneText[playerid] = TextDrawCreate(480.000000,425.000000,string);
       TextDrawAlignment(GangZoneText[playerid],0);
       TextDrawBackgroundColor(GangZoneText[playerid],0x000000ff);
       TextDrawFont(GangZoneText[playerid],1);
       TextDrawLetterSize(GangZoneText[playerid],0.399999,1.000000);
       TextDrawColor(GangZoneText[playerid],0xffffffff);
       TextDrawSetOutline(GangZoneText[playerid],1);
       TextDrawSetProportional(GangZoneText[playerid],1);
       TextDrawSetShadow(GangZoneText[playerid],1);
     }
   }
   else
   {
     new string[256];
     format(string, sizeof(string), "~w~Zona nao dominavel");
     GangZoneText[playerid] = TextDrawCreate(480.000000,425.000000,string);
     TextDrawAlignment(GangZoneText[playerid],0);
     TextDrawBackgroundColor(GangZoneText[playerid],0x000000ff);
     TextDrawFont(GangZoneText[playerid],1);
     TextDrawLetterSize(GangZoneText[playerid],0.399999,1.000000);
     TextDrawColor(GangZoneText[playerid],0xffffffff);
     TextDrawSetOutline(GangZoneText[playerid],1);
     TextDrawSetProportional(GangZoneText[playerid],1);
     TextDrawSetShadow(GangZoneText[playerid],1);
   }
   TextDrawShowForPlayer(playerid, GangZoneText[playerid]);
   return 1;
 }
public GangZoneTimer()
{
  for(new i = 0 ; i < MAX_PLAYERS ; i++)
 {
     for(new j=0; j<MAX_GZS; j++)
    {
      ShowZoneTextForPlayer(i, j);
      PayPlayerInGz(i, j, GangZonePos[j][0], GangZonePos[j][1], GangZonePos[j][2], GangZonePos[j][3], 500);
      if(IsPlayerInTerritory(i, j))
      {
        if(playerGang[i] > 0)
        {
          if(playerGang[i] != GangZoneOwner[j])
          {
           if(GangZoneUnderAttack[j] == 1)
           {
              if(GangZoneWave[j][playerGang[i]] < 15)
                {
                  GangZoneWave[j][playerGang[i]] = 0;
                }
              }
              if(GangZoneWave[j][playerGang[i]] < 15)
              {
                GangZoneWave[j][playerGang[i]] ++;
              }
              if(GangZoneWave[j][playerGang[i]] >= 15 && GangZoneWave[j][playerGang[i]] < 100)
              {
                if(GangZoneUnderAttack[j] == 0)
                {
                  if(GangZoneOwner[j] < 999)
                  {
                    new string[256];
                    format(string, sizeof(string), "~n~ ~n~ ~n~ ~n~ ~n~~w~A gang ~r~%s ~w~esta atacando a zona ~y~%s ~w~da gang ~r~%s", gangNames[playerGang[i]], GangZoneName[j], gangNames[GangZoneOwner[j]]);
                    GameTextForAll(string, 5000, 3);
                  }
                  if(GangZoneOwner[j] == 999)
                  {
                    new string[256];
                    format(string, sizeof(string), "~n~ ~n~ ~n~ ~n~ ~n~~w~A gang ~r~%s ~w~esta atacando a zona ~y~%s", gangNames[playerGang[i]], GangZoneName[j]);
                    GameTextForAll(string, 5000, 3);
                  }
                  GangZoneFlashForAll(GangZone[j], gangInfo[playerGang[i]][2]);
                  GangZoneUnderAttack[j] = 1;
                }
                GangZoneWave[j][playerGang[i]] ++;
              }
              if(GangZoneWave[j][playerGang[i]] == 100)
              {
                if(GangZoneOwner[j] < 999)
                {
                  new string[256];
                  format(string, sizeof(string), "~n~ ~n~ ~n~ ~n~ ~n~~w~A gang ~r~%s ~w~conquistou a zona ~y~%s ~w~da gang ~r~%s", gangNames[playerGang[i]], GangZoneName[j], gangNames[GangZoneOwner[j]]);
                  GameTextForAll(string, 5000, 3);
                }
                if(GangZoneOwner[j] == 999)
                {
                  new string[256];
                  format(string, sizeof(string), "~n~ ~n~ ~n~ ~n~ ~n~~w~A gang ~r~%s ~w~conquistou a zona ~y~%s", gangNames[playerGang[i]], GangZoneName[j]);
                  GameTextForAll(string, 5000, 3);
                }
                GangZoneUnderAttack[j] = 0;
                GangZoneWave[j][playerGang[i]] = 0;
                GangZoneColor[j] = gangInfo[playerGang[i]][2];
                GangZoneOwner[j] = playerGang[i];
                GangZoneStopFlashForAll(GangZone[j]);
                GangZoneHideForAll(GangZone[j]);
                GangZoneShowForAll(GangZone[j], GangZoneColor[j]);
              }
            }
       }
     }
     else
     {
       if(GangZoneWave[j][playerGang[i]] > 0 && GetCountOnTerritory(playerGang[i], j) == 0)
       {
         if(GangZoneUnderAttack[j] == 1)
         {
            if(GangZoneWave[j][playerGang[i]] >= 15)
            {
              new string[256];
              format(string, sizeof(string), "~r~Sua gangue nao conquistou a zona ~y~%s", GangZoneName[j]);
              GameTextForGang(playerGang[i], string);
            	GangZoneUnderAttack[j] = 0;
              GangZoneWave[j][playerGang[i]] = 0;
              GangZoneStopFlashForAll(GangZone[j]);
              GangZoneHideForAll(GangZone[j]);
              GangZoneShowForAll(GangZone[j], GangZoneColor[j]);
             }
           }
           GangZoneWave[j][playerGang[i]] = 0;
        }
       }
     }
  }
   return 1;
}
Please! help me *.*
Reply
#2

I was already forgetting. also has this in OnGameModeInit

SetTimer("GangZoneTimer",2000,true);
Reply
#3

People, does anyone can help me here? Told me that as the creators of the SAMP are the statistics together and i thought those corners that could help me but I see that it is not well.
Reply
#4

Suckers!!!!
Reply
#5

Quote:
Originally Posted by [MrS
Lake ]
Suckers!!!!
That'll get you nowhere, you know.
Reply
#6

Yeah,

Please Close anyone this Topic !

Thanks,
- LJ
Reply
#7

Hm.
Reply
#8

Your bug,dude.
// Barco Pirata
{1060.5496,2347.3291,1157.6431,2168.0803},
minx,miny,maxx,maxy
miny>maxy
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)