SA-MP Forums Archive
loose indentation - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: loose indentation (/showthread.php?tid=286931)



loose indentation - Kostas' - 01.10.2011

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 |}



Re: loose indentation - henry jiggy - 01.10.2011

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 |}



Re: loose indentation - Kostas' - 01.10.2011

Thank you, henry jiggy!


Re: loose indentation - =WoR=G4M3Ov3r - 01.10.2011

Indent properly next time..


Re: loose indentation - [GOD]Dragonster82 - 01.10.2011

Just use this if you have the problem.

http://dracoblue.net/tidy/pawn/


Re: loose indentation - Kostas' - 01.10.2011

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


Re: loose indentation - $India$ - 01.10.2011

Just Use Simple website
its really Eazy

http://dracoblue.net/tidy/pawn/


Re: loose indentation - Kingunit - 01.10.2011

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.


Re: loose indentation - $India$ - 01.10.2011

its not difficult