7 Warning ! Plz Help Me
#1

I trie to fix a 7 warning on 20 min , are you amiable to help me?

He show me thas warnings

Код:
:\Documents and Settings\Claudiu\Desktop\Chestii !\EnGame\gamemodes\Mortalii.pwn(19169) : warning 217: loose indentation
C:\Documents and Settings\Claudiu\Desktop\Chestii !\EnGame\gamemodes\Mortalii.pwn(19175) : warning 217: loose indentation
C:\Documents and Settings\Claudiu\Desktop\Chestii !\EnGame\gamemodes\Mortalii.pwn(19188) : warning 217: loose indentation
C:\Documents and Settings\Claudiu\Desktop\Chestii !\EnGame\gamemodes\Mortalii.pwn(19207) : warning 217: loose indentation
C:\Documents and Settings\Claudiu\Desktop\Chestii !\EnGame\gamemodes\Mortalii.pwn(19226) : warning 217: loose indentation
C:\Documents and Settings\Claudiu\Desktop\Chestii !\EnGame\gamemodes\Mortalii.pwn(19237) : warning 217: loose indentation
C:\Documents and Settings\Claudiu\Desktop\Chestii !\EnGame\gamemodes\Mortalii.pwn(19243) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:      6888 bytes
Code size:     1405556 bytes
Data size:     2338156 bytes
Stack/heap size:   16384 bytes; estimated max. usage=4904 cells (19616 bytes)
Total requirements: 3766984 bytes

7 Warnings.
And Here Is The Comand
Код:
  if(strcmp(cmd,"/buylicense",true)==0)
  {
    if(IsPlayerConnected(playerid))
    {
      if(PlayerToPoint(25.0,playerid,1492.6129,1308.1138,1093.2937))
      {
      new x_nr[256];
      x_nr = strtok(cmdtext, idx);
      if(!strlen(x_nr)) {
       SendClientMessage(playerid, COLOR_DBLUE, "|__________________ Licenses __________________|");
       SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /buylicense [name]");
       SendClientMessage(playerid, COLOR_YELLOW, "Available names: Driving  (500$)");
       SendClientMessage(playerid, COLOR_YELLOW, "Available names: Flying  (8000$)");
       SendClientMessage(playerid, COLOR_YELLOW, "Available names: Sailing  (4500$)");
       SendClientMessage(playerid, COLOR_YELLOW, "Available names: Fishing  (2000$)");
       SendClientMessage(playerid, COLOR_YELLOW, "Available names: Gun    (15000$)");
       SendClientMessage(playerid, COLOR_DBLUE, "|____________________________________________|");
       return 1;
      }
      if(strcmp(x_nr,"Driving",true) == 0)
      {
        if(PlayerInfo[playerid][pCarLic] < 1)
        if(GetPlayerMoney(playerid) < 500)
        {
         format(string, sizeof(string), ".: Driving License costs $500, You don't have enough :.");
         SendClientMessage(playerid, COLOR_WHITE, string);
         return 1;
        }
        if(PlayerInfo[playerid][pCarLic] == 1)
        {
         format(string, sizeof(string), ".: You already have a Driving license :.");
         SendClientMessage(playerid, COLOR_WHITE, string);
         return 1;
        }
        PlayerInfo[playerid][pCarLic] = 1;
        SendClientMessage(playerid,COLOR_WHITE,".: You can now drive cars :.");
        GivePlayerMoney(playerid,-500);
      }
      else if(strcmp(x_nr,"Flying",true) == 0)
      {
         if(PlayerInfo[playerid][pFlyLic] < 1)
         if(GetPlayerMoney(playerid) < 8000)
          {
         format(string, sizeof(string), ".:Flying License costs $8000, You don't have enough :.");
         SendClientMessage(playerid, COLOR_WHITE, string);
         return 1;
        }
        if(PlayerInfo[playerid][pFlyLic] == 1)
        {
         format(string, sizeof(string), ".: You already have a Flying license :.");
         SendClientMessage(playerid, COLOR_WHITE, string);
         return 1;
        }
        PlayerInfo[playerid][pFlyLic] = 1;
        SendClientMessage(playerid,COLOR_WHITE,".: You can now drive Helys and Planes :.");
        GivePlayerMoney(playerid,-8000);
      }
      else if(strcmp(x_nr,"Sailing",true) == 0)
      {
         if(PlayerInfo[playerid][pBoatLic] < 1)
         if(GetPlayerMoney(playerid) < 4500)
        {
         format(string, sizeof(string), ".:Sailing License costs $4500, You don't have enough :.");
         SendClientMessage(playerid, COLOR_WHITE, string);
         return 1;
        }
        if(PlayerInfo[playerid][pBoatLic] == 1)
        {
         format(string, sizeof(string), ".: You already have a Sailing license :.");
         SendClientMessage(playerid, COLOR_WHITE, string);
         return 1;
        }
        PlayerInfo[playerid][pBoatLic] = 1;
        SendClientMessage(playerid,COLOR_WHITE,".: You can now drive Boats :.");
        GivePlayerMoney(playerid,-4500);
      }
      else if(strcmp(x_nr,"Fishing",true) == 0)
      {
         if(PlayerInfo[playerid][pFishLic] < 1)
         if(GetPlayerMoney(playerid) < 2000)
        {
         format(string, sizeof(string), ".:Fishing License costs $2000, You don't have enough :.");
         SendClientMessage(playerid, COLOR_WHITE, string);
         return 1;
        }
        if(PlayerInfo[playerid][pFishLic] == 1)
        {
         format(string, sizeof(string), ".: You already have a Fishing license :.");
         SendClientMessage(playerid, COLOR_WHITE, string);
         return 1;
        }
        PlayerInfo[playerid][pFishLic] = 1;
        SendClientMessage(playerid,COLOR_WHITE,".: You can now Fish Safe :.");
        GivePlayerMoney(playerid,-2000);
      }
      else if(strcmp(x_nr,"Gun",true) == 0)
      {
         if(PlayerInfo[playerid][pGunLic] < 1)
         if(GetPlayerMoney(playerid) < 15000)
        {
         format(string, sizeof(string), ".:Gun License costs $15000, You don't have enough :.");
         SendClientMessage(playerid, COLOR_WHITE, string);
         return 1;
        }
        if(PlayerInfo[playerid][pGunLic] == 1)
        {
         format(string, sizeof(string), ".: You already have a Gun license :.");
         SendClientMessage(playerid, COLOR_WHITE, string);
         return 1;
        }
        PlayerInfo[playerid][pGunLic] = 1;
        SendClientMessage(playerid,COLOR_WHITE,".: You can now have a Gun Safe :.");
        GivePlayerMoney(playerid,-15000);
        }
      }
     else
     {
      SendClientMessage(playerid, COLOR_GREY, "  You are not in the City Hall !");
      return 1;
     }
    }//not connected
   return 1;
  }
Reply
#2

Indent your code.
Reply
#3

Код:
        if(PlayerInfo[playerid][pFlyLic] == 1)
        {
         format(string, sizeof(string), ".: You already have a Flying license :.");
         SendClientMessage(playerid, COLOR_WHITE, string);
         return 1;
        }
        PlayerInfo[playerid][pFlyLic] = 1;
        SendClientMessage(playerid,COLOR_WHITE,".: You can now drive Helys and Planes :.");
        GivePlayerMoney(playerid,-8000);
      }
      else if(strcmp(x_nr,"Sailing",true) == 0)
      {
         if(PlayerInfo[playerid][pBoatLic] < 1)
         if(GetPlayerMoney(playerid) < 4500)
        {
         format(string, sizeof(string), ".:Sailing License costs $4500, You don't have enough :.");
         SendClientMessage(playerid, COLOR_WHITE, string);
         return 1;
        }
        if(PlayerInfo[playerid][pBoatLic] == 1)
        {
         format(string, sizeof(string), ".: You already have a Sailing license :.");
         SendClientMessage(playerid, COLOR_WHITE, string);
         return 1;
        }
        PlayerInfo[playerid][pBoatLic] = 1;
        SendClientMessage(playerid,COLOR_WHITE,".: You can now drive Boats :.");
        GivePlayerMoney(playerid,-4500);
      }
      else if(strcmp(x_nr,"Fishing",true) == 0)
      {
         if(PlayerInfo[playerid][pFishLic] < 1)
         if(GetPlayerMoney(playerid) < 2000)
        {
         format(string, sizeof(string), ".:Fishing License costs $2000, You don't have enough :.");
         SendClientMessage(playerid, COLOR_WHITE, string);
         return 1;
        }
        if(PlayerInfo[playerid][pFishLic] == 1)
        {
         format(string, sizeof(string), ".: You already have a Fishing license :.");
         SendClientMessage(playerid, COLOR_WHITE, string);
         return 1;
        }
        PlayerInfo[playerid][pFishLic] = 1;
        SendClientMessage(playerid,COLOR_WHITE,".: You can now Fish Safe :.");
        GivePlayerMoney(playerid,-2000);
      }
      else if(strcmp(x_nr,"Gun",true) == 0)
      {
         if(PlayerInfo[playerid][pGunLic] < 1)
         if(GetPlayerMoney(playerid) < 15000)
        {
         format(string, sizeof(string), ".:Gun License costs $15000, You don't have enough :.");
         SendClientMessage(playerid, COLOR_WHITE, string);
         return 1;
        }
        if(PlayerInfo[playerid][pGunLic] == 1)
        {
         format(string, sizeof(string), ".: You already have a Gun license :.");
         SendClientMessage(playerid, COLOR_WHITE, string);
         return 1;
        }
        PlayerInfo[playerid][pGunLic] = 1;
        SendClientMessage(playerid,COLOR_WHITE,".: You can now have a Gun Safe :.");
        GivePlayerMoney(playerid,-15000);
        }
      }
     else
     {
      SendClientMessage(playerid, COLOR_GREY, "  You are not in the City Hall !");
      return 1;
     }
    }//not connected
   return 1;
19122 - 19234
Reply
#4

Quote:
Originally Posted by Don Correlli
Indent your code and re-compile.
You're getting these warnings because code is not indented.
Reply
#5

Loose identation is a warning caused by some spaces .. I will expalin it with an example

pawn Код:
if(strcmp(cmd,"/buylicense",true)==0)
   {
   SetPlayerPos(playerid,123,456,789);
     SendClientMessage(playerid,COLOR_YELLOW,"Hey");
   return 1;

   }
The above code would give a warning .. The below code is correct

pawn Код:
if(strcmp(cmd,"/buylicense",true)==0)
   {
   SetPlayerPos(playerid,123,456,789);
   SendClientMessage(playerid,COLOR_YELLOW,"Hey");
   return 1;

   }
Reply
#6

Quote:
Originally Posted by Peter Corneile
Loose identation is a warning caused by some spaces .. I will expalin it with an example
The below code is correct

pawn Код:
if(strcmp(cmd,"/buylicense",true)==0)
   {
   SetPlayerPos(playerid,123,456,789);
   SendClientMessage(playerid,COLOR_YELLOW,"Hey");
   return 1;

   }
Not really.

pawn Код:
if(strcmp(cmd,"/buylicense",true)==0)
{
  SetPlayerPos(playerid,123,456,789);
  SendClientMessage(playerid,COLOR_YELLOW,"Hey");
  return 1;
}
Reply
#7

Quote:
Originally Posted by Mikep.
Quote:
Originally Posted by Peter Corneile
Loose identation is a warning caused by some spaces .. I will expalin it with an example
The below code is correct

pawn Код:
if(strcmp(cmd,"/buylicense",true)==0)
  {
   SetPlayerPos(playerid,123,456,789);
   SendClientMessage(playerid,COLOR_YELLOW,"Hey");
   return 1;

  }
Not really.

pawn Код:
if(strcmp(cmd,"/buylicense",true)==0)
{
  SetPlayerPos(playerid,123,456,789);
  SendClientMessage(playerid,COLOR_YELLOW,"Hey");
  return 1;
}
Indentation works however you indent it, as long as you don't leave excess whitespace causing incorrect indentation, so both of your examples are correct.
Reply
#8

Quote:
Originally Posted by Calgon
Indentation works however you indent it, as long as you don't leave excess whitespace causing incorrect indentation, so both of your examples are correct.
It's correct for the compiler but Mikep's example is properly indented.
Reply
#9

Instead of having to worry about indentation, just do

#pragma tabsize 0

and see what happens when you compile it.
Reply
#10

Quote:
Originally Posted by Hiitch[WS
- WestSide Servers ]
Instead of having to worry about indentation, just do

#pragma tabsize 0

and see what happens when you compile it.
That's not the best solution.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)