loose indentation
#1

Hey,

I added a NPC on my server, all works fine except that when i compile it, I get a warning.
line(4313) : warning 217: loose indentation. What i forgot to put?
pawn Код:
4300 |public OnPlayerSpawn(playerid)
4301 |{
4302 |  if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
4303 |  {
4304 |    new npcname[MAX_PLAYER_NAME];
4305 |    GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
4306 |    if(!strcmp(npcname, "MyFirstNPC", true)) //Checking if the NPC's name is MyFirstNPC
4307 |    {
4308 |      PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
4309 |      SetPlayerSkin(playerid,141);
4310 |    }
4311 |    return 1;
4312 |  }
4313 |    SetPlayerInterior(playerid,0);
4314 |    SetPlayerRandomSpawn(playerid);
4315 |    GivePlayerWeapon(playerid, 22, 999);
4316 |    GivePlayerWeapon(playerid, 26, 999);
4317 |    GivePlayerWeapon(playerid, 28, 999);
4318 |    GivePlayerMoney(playerid, 50000);
4319 |    return 1;
4320 |}
Reply
#2

Quote:
Originally Posted by Kostas'
Посмотреть сообщение
Hey,

I added a NPC on my server, all works fine except that when i compile it, I get a warning.
line(4313) : warning 217: loose indentation. What i forgot to put?
pawn Код:
4300 |public OnPlayerSpawn(playerid)
4301 |{
4302 |  if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
4303 |  {
4304 |    new npcname[MAX_PLAYER_NAME];
4305 |    GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
4306 |    if(!strcmp(npcname, "MyFirstNPC", true)) //Checking if the NPC's name is MyFirstNPC
4307 |    {
4308 |      PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
4309 |      SetPlayerSkin(playerid,141);
4310 |    }
4311 |    return 1;
4312 |  }
4313 |    SetPlayerInterior(playerid,0);
4314 |    SetPlayerRandomSpawn(playerid);
4315 |    GivePlayerWeapon(playerid, 22, 999);
4316 |    GivePlayerWeapon(playerid, 26, 999);
4317 |    GivePlayerWeapon(playerid, 28, 999);
4318 |    GivePlayerMoney(playerid, 50000);
4319 |    return 1;
4320 |}
Kostas, this area:

pawn Код:
4313 |    SetPlayerInterior(playerid,0);
4314 |    SetPlayerRandomSpawn(playerid);
4315 |    GivePlayerWeapon(playerid, 22, 999);
4316 |    GivePlayerWeapon(playerid, 26, 999);
4317 |    GivePlayerWeapon(playerid, 28, 999);
4318 |    GivePlayerMoney(playerid, 50000);
4319 |    return 1;
Is not under that IF you put there so theres no need for a space. also dude dont use space use tabs. its easyer to spot idendation errors like this.

EDIT: actually 2 spaces. there this will do:

pawn Код:
4300 |public OnPlayerSpawn(playerid)
4301 |{
4302 |  if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
4303 |  {
4304 |    new npcname[MAX_PLAYER_NAME];
4305 |    GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
4306 |    if(!strcmp(npcname, "MyFirstNPC", true)) //Checking if the NPC's name is MyFirstNPC
4307 |    {
4308 |      PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
4309 |      SetPlayerSkin(playerid,141);
4310 |    }
4311 |    return 1;
4312 |  }
4313 |  SetPlayerInterior(playerid,0);
4314 |  SetPlayerRandomSpawn(playerid);
4315 |  GivePlayerWeapon(playerid, 22, 999);
4316 |  GivePlayerWeapon(playerid, 26, 999);
4317 |  GivePlayerWeapon(playerid, 28, 999);
4318 |  GivePlayerMoney(playerid, 50000);
4319 |  return 1;
4320 |}
Reply
#3

Thank you, henry jiggy!
Reply
#4

Indent properly next time..
Reply
#5

Just use this if you have the problem.

http://dracoblue.net/tidy/pawn/
Reply
#6

Quote:
Originally Posted by [GOD]Dragonster82
Посмотреть сообщение
Just use this if you have the problem.

http://dracoblue.net/tidy/pawn/
Thanks man, I didn't know it
Reply
#7

Just Use Simple website
its really Eazy

http://dracoblue.net/tidy/pawn/
Reply
#8

Quote:
Originally Posted by $India$
Посмотреть сообщение
Just Use Simple website
its really Eazy

http://dracoblue.net/tidy/pawn/
Already told. But that's a bad option. Learn - how to use the indentation correct.
Reply
#9

its not difficult
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)