Missing bracket?
#1

Hi.

Код:
if(dialogid == 351)
{
   if(response)
   {
      for(new g; g<50; g++)
      {
         if(playerDB[playerid][Gauja] == GangDB[g][GNumber])
         {
            new str[256];
            format(str, 64, "Gaujos/%s.ini", GangDB[g][GName]);
            dfile_Open(str);
            new pool = GetPlayerPoolSize();
            for(new p; p<=pool; p++)
            {
		       if(!IsPlayerConnected(p))
		       {
			      continue;
		       }
		       if(playerDB[p][Gauja] == playerDB[playerid][Gauja])
		       {
                  new name[24];
	              GetPlayerName(p, name, 24);
                  format(str, 24, "%s|", name);
                  dfile_WriteString("GMembers", str_replace(str, "", dfile_ReadString("GMembers")));
                  playerDB[p][Gauja]=0;
                  SendClientMessage(p, GANG_SPALVA, "[GAUJOS CHAT] {FFFFFF}Gauja uюdaroma! Visi nariai iрmetami!");
			      GangDB[g][GMembers]-=1;
		       }
	        }
	        if(GangDB[g][GMembers] > 0)
	        {
		       new gangs[10][20];
		       explode(gangs, dfile_ReadString("GMembers"), "|");
		       dfile_SaveFile();
		       dfile_CloseFile();
		       for(new x; x<10; x++)
		       {
			      if(gangs[x][0])
			      {
			         format(str, 64, "saves/user/%s.ini", gangs[x]);
			         dfile_Open(str);
			         dfile_WriteInt("Gauja", -1);
			         dfile_SaveFile();
			         dfile_CloseFile();
			      }
		       }
	        }
	        else
	        {
		       dfile_SaveFile();
		       dfile_CloseFile();
	        }
            format(str, 64, "Gaujos/%s.ini", GangDB[g][GName]);
            dfile_Delete(str);
            DeleteNameFromFile("Gaujos/Gaujos.txt", GangDB[g][GName]);
            GangDB[g][gx] = 0.0;
            GangDB[g][gy] = 0.0;
            GangDB[g][gz] = 0.0;
            GangDB[g][GSize] = 0;
            GangDB[g][GSkin] = 0;
            GangDB[g][GMafia] = 0;
            GangDB[g][GColor] = 0;
            GangDB[g][GNumber] = 0;
            GangDB[g][GPoints] = 0;
            GangDB[g][GName][0] = 0;
            GangDB[g][GMembers] = 0;
            GangZoneDestroy(GangDB[i][GZone]);
            break;
         }
	  }
   }
   return 1;
}
Somewhy, this code breaks my gamemode... It gives errors that other variables are undefined, or shadows other variables... When I remove this code, no errors appear...

Any solutions?

P.S sorry for indentation. It got loose after pasting my code...
Reply
#2

pawn Код:
if(dialogid == 351)
{
   if(response)
   {
      for(new g; g<50; g++)
      {
         if(playerDB[playerid][Gauja] == GangDB[g][GNumber])
         {
            new str[256];
            format(str, 64, "Gaujos/%s.ini", GangDB[g][GName]);
            dfile_Open(str);
            new pool = GetPlayerPoolSize();
            for(new p; p<=pool; p++)
            {
               if(!IsPlayerConnected(p))
               {
                  continue;
               }
               if(playerDB[p][Gauja] == playerDB[playerid][Gauja])
               {
                  new name[24];
                  GetPlayerName(p, name, 24);
                  format(str, 24, "%s|", name);
                  dfile_WriteString("GMembers", str_replace(str, "", dfile_ReadString("GMembers")));
                  playerDB[p][Gauja]=0;
                  SendClientMessage(p, GANG_SPALVA, "[GAUJOS CHAT] {FFFFFF}Gauja uюdaroma! Visi nariai iрmetami!");
                  GangDB[g][GMembers]-=1;
               }
            }
            if(GangDB[g][GMembers] > 0)
            {
               new gangs[10][20];
               explode(gangs, dfile_ReadString("GMembers"), "|");
               dfile_SaveFile();
               dfile_CloseFile();
               for(new x; x<10; x++)
               {
                  if(gangs[x][0])
                  {
                     format(str, 64, "saves/user/%s.ini", gangs[x]);
                     dfile_Open(str);
                     dfile_WriteInt("Gauja", -1);
                     dfile_SaveFile();
                     dfile_CloseFile();
                  }
               }
            }
            else
            {
               dfile_SaveFile();
               dfile_CloseFile();
            }
            format(str, 64, "Gaujos/%s.ini", GangDB[g][GName]);
            dfile_Delete(str);
            DeleteNameFromFile("Gaujos/Gaujos.txt", GangDB[g][GName]);
            GangDB[g][gx] = 0.0;
            GangDB[g][gy] = 0.0;
            GangDB[g][gz] = 0.0;
            GangDB[g][GSize] = 0;
            GangDB[g][GSkin] = 0;
            GangDB[g][GMafia] = 0;
            GangDB[g][GColor] = 0;
            GangDB[g][GNumber] = 0;
            GangDB[g][GPoints] = 0;
            GangDB[g][GName][0] = 0;
            GangDB[g][GMembers] = 0;
            GangZoneDestroy(GangDB[i][GZone]);
            break;
         }
      }
      }
   }
   return 1;
}
Reply
#3

Quote:
Originally Posted by UltraScripter
Посмотреть сообщение
pawn Код:
if(dialogid == 351)
{
   if(response)
   {
      for(new g; g<50; g++)
      {
         if(playerDB[playerid][Gauja] == GangDB[g][GNumber])
         {
            new str[256];
            format(str, 64, "Gaujos/%s.ini", GangDB[g][GName]);
            dfile_Open(str);
            new pool = GetPlayerPoolSize();
            for(new p; p<=pool; p++)
            {
               if(!IsPlayerConnected(p))
               {
                  continue;
               }
               if(playerDB[p][Gauja] == playerDB[playerid][Gauja])
               {
                  new name[24];
                  GetPlayerName(p, name, 24);
                  format(str, 24, "%s|", name);
                  dfile_WriteString("GMembers", str_replace(str, "", dfile_ReadString("GMembers")));
                  playerDB[p][Gauja]=0;
                  SendClientMessage(p, GANG_SPALVA, "[GAUJOS CHAT] {FFFFFF}Gauja uюdaroma! Visi nariai iрmetami!");
                  GangDB[g][GMembers]-=1;
               }
            }
            if(GangDB[g][GMembers] > 0)
            {
               new gangs[10][20];
               explode(gangs, dfile_ReadString("GMembers"), "|");
               dfile_SaveFile();
               dfile_CloseFile();
               for(new x; x<10; x++)
               {
                  if(gangs[x][0])
                  {
                     format(str, 64, "saves/user/%s.ini", gangs[x]);
                     dfile_Open(str);
                     dfile_WriteInt("Gauja", -1);
                     dfile_SaveFile();
                     dfile_CloseFile();
                  }
               }
            }
            else
            {
               dfile_SaveFile();
               dfile_CloseFile();
            }
            format(str, 64, "Gaujos/%s.ini", GangDB[g][GName]);
            dfile_Delete(str);
            DeleteNameFromFile("Gaujos/Gaujos.txt", GangDB[g][GName]);
            GangDB[g][gx] = 0.0;
            GangDB[g][gy] = 0.0;
            GangDB[g][gz] = 0.0;
            GangDB[g][GSize] = 0;
            GangDB[g][GSkin] = 0;
            GangDB[g][GMafia] = 0;
            GangDB[g][GColor] = 0;
            GangDB[g][GNumber] = 0;
            GangDB[g][GPoints] = 0;
            GangDB[g][GName][0] = 0;
            GangDB[g][GMembers] = 0;
            GangZoneDestroy(GangDB[i][GZone]);
            break;
         }
      }
      }
   }
   return 1;
}
Compiler crashes after your code... I guess too many brackets in your code.
Reply
#4

try this
https://sampforum.blast.hk/showthread.php?tid=291018
Reply
#5

Use this.
Reply
#6

Guys, I deleted every line one by one to check which one gives me errors, and this gave me:

Quote:

new gangs[10][20];

Any ideas why?
Reply
#7

try this code:
Код:
 if(dialogid == 351)
{
	if(response)
	{
		for(new g; g<50; g++)
		{
			if(playerDB[playerid][Gauja] == GangDB[g][GNumber])
			{
				new str[256];
				format(str, 64, "Gaujos/%s.ini", GangDB[g][GName]);
				dfile_Open(str);
				new pool = GetPlayerPoolSize();
				for(new p; p<=pool; p++)
				{
					if(!IsPlayerConnected(p))
					{
						continue;
					}
					if(playerDB[p][Gauja] == playerDB[playerid][Gauja])
					{
						new name[24];
						GetPlayerName(p, name, 24);
						format(str, 24, "%s|", name);
						dfile_WriteString("GMembers", str_replace(str, "", dfile_ReadString("GMembers")));
						playerDB[p][Gauja]=0;
						SendClientMessage(p, GANG_SPALVA, "[GAUJOS CHAT] {FFFFFF}Gauja uюdaroma! Visi nariai iрmetami!");
						GangDB[g][GMembers]-=1;
					}
				}
				if(GangDB[g][GMembers] > 0)
				{
					new gangs[10][20];
					explode(gangs, dfile_ReadString("GMembers"), "|");
					dfile_SaveFile();
					dfile_CloseFile();
					for(new x; x<10; x++)
					{
						if(gangs[x][0])
						{
							format(str, 64, "saves/user/%s.ini", gangs[x]);
							dfile_Open(str);
							dfile_WriteInt("Gauja", -1);
							dfile_SaveFile();
							dfile_CloseFile();
						}
					}
				}
				else
				{
					dfile_SaveFile();
					dfile_CloseFile();
				}
				format(str, 64, "Gaujos/%s.ini", GangDB[g][GName]);
				dfile_Delete(str);
				DeleteNameFromFile("Gaujos/Gaujos.txt", GangDB[g][GName]);
				GangDB[g][gx] = 0.0;
				GangDB[g][gy] = 0.0;
				GangDB[g][gz] = 0.0;
				GangDB[g][GSize] = 0;
				GangDB[g][GSkin] = 0;
				GangDB[g][GMafia] = 0;
				GangDB[g][GColor] = 0;
				GangDB[g][GNumber] = 0;
				GangDB[g][GPoints] = 0;
				GangDB[g][GName][0] = 0;
				GangDB[g][GMembers] = 0;
				GangZoneDestroy(GangDB[i][GZone]);
				break;
			}
		}
	}
return 1;
}
Reply
#8

Quote:
Originally Posted by Dusan01
Посмотреть сообщение
try this code:
Код:
 if(dialogid == 351)
{
	if(response)
	{
		for(new g; g<50; g++)
		{
			if(playerDB[playerid][Gauja] == GangDB[g][GNumber])
			{
				new str[256];
				format(str, 64, "Gaujos/%s.ini", GangDB[g][GName]);
				dfile_Open(str);
				new pool = GetPlayerPoolSize();
				for(new p; p<=pool; p++)
				{
					if(!IsPlayerConnected(p))
					{
						continue;
					}
					if(playerDB[p][Gauja] == playerDB[playerid][Gauja])
					{
						new name[24];
						GetPlayerName(p, name, 24);
						format(str, 24, "%s|", name);
						dfile_WriteString("GMembers", str_replace(str, "", dfile_ReadString("GMembers")));
						playerDB[p][Gauja]=0;
						SendClientMessage(p, GANG_SPALVA, "[GAUJOS CHAT] {FFFFFF}Gauja uюdaroma! Visi nariai iрmetami!");
						GangDB[g][GMembers]-=1;
					}
				}
				if(GangDB[g][GMembers] > 0)
				{
					new gangs[10][20];
					explode(gangs, dfile_ReadString("GMembers"), "|");
					dfile_SaveFile();
					dfile_CloseFile();
					for(new x; x<10; x++)
					{
						if(gangs[x][0])
						{
							format(str, 64, "saves/user/%s.ini", gangs[x]);
							dfile_Open(str);
							dfile_WriteInt("Gauja", -1);
							dfile_SaveFile();
							dfile_CloseFile();
						}
					}
				}
				else
				{
					dfile_SaveFile();
					dfile_CloseFile();
				}
				format(str, 64, "Gaujos/%s.ini", GangDB[g][GName]);
				dfile_Delete(str);
				DeleteNameFromFile("Gaujos/Gaujos.txt", GangDB[g][GName]);
				GangDB[g][gx] = 0.0;
				GangDB[g][gy] = 0.0;
				GangDB[g][gz] = 0.0;
				GangDB[g][GSize] = 0;
				GangDB[g][GSkin] = 0;
				GangDB[g][GMafia] = 0;
				GangDB[g][GColor] = 0;
				GangDB[g][GNumber] = 0;
				GangDB[g][GPoints] = 0;
				GangDB[g][GName][0] = 0;
				GangDB[g][GMembers] = 0;
				GangZoneDestroy(GangDB[i][GZone]);
				break;
			}
		}
	}
return 1;
}
SAME...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)