Loose Indentation
#1

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
 if(newkeys == KEY_SUBMISSION)
	{
		if(IsPlayerInAnyVehicle(playerid))
 {
			{

      }
		}
	}
	  	if(newkeys & KEY_FIRE && IsPlayerInAnyVehicle(playerid))
	{
		if(!IsNosVehicle(GetPlayerVehicleID(playerid))) return SendClientMessage(playerid, 0xFF0000AA, "You can't add Nitrous to this vehicle");
		AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
		PlayerPlaySound(playerid, 1133 ,0, 0, 0);
		GameTextForPlayer(playerid,"~y~Nitro",4000,1);
}
	// Check if the player is in any vehicle and is the driver
	if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
Код:
C:\Documents and Settings\Juan & Miguel\Desktop\Stunt Paradise 0.3a\gamemodes\SP.pwn(2318) : warning 217: loose indentation
C:\Documents and Settings\Juan & Miguel\Desktop\Stunt Paradise 0.3a\gamemodes\SP.pwn(2326) : warning 217: loose indentation
How can I fix it?
Reply
#2

I think we need a bigger part of your script to fix this..

Код:
		
if(IsPlayerInAnyVehicle(playerid))
 {
			{

      }
		}
	}
Where are these brackets for?
Reply
#3

At top of your script:

pawn Код:
#pragma tabsize 0
Then they gone.
Reply
#4

Hey guys thanks for helping, Jeff's method worked.
Reply
#5

Quote:
Originally Posted by Juanxz
Hey guys thanks for helping, Jeff's method worked.
Therefore we are here. Nice that i could help you.
Reply
#6

Just to inform you, doing #pragma's is definately not the best method to solve this.
It would be better to learn about Pawn's coding structure and fix these brackets!
Reply
#7

Are there any negative side effects from using #pragma?
Reply
#8

Quote:
Originally Posted by Juanxz
Are there any negative side effects from using #pragma?
Of course. Assume you don't edit your script for some time, and re-start editing after, say 1 year.
You will probably have problems reading your code because it is not well structured.
Reply
#9

Yikes....thanks for telling me.
Here's the full script:
Код:
  }
  return 0;
}
#pragma tabsize 0
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
 if(newkeys == KEY_SUBMISSION)
	{
		if(IsPlayerInAnyVehicle(playerid))
 {
			{

      }
		}
	}
	  	if(newkeys & KEY_FIRE && IsPlayerInAnyVehicle(playerid))
	{
		if(!IsNosVehicle(GetPlayerVehicleID(playerid))) return SendClientMessage(playerid, 0xFF0000AA, "You can't add Nitrous to this vehicle");
		AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
		PlayerPlaySound(playerid, 1133 ,0, 0, 0);
		GameTextForPlayer(playerid,"~y~Nitro",4000,1);
}
	// Check if the player is in any vehicle and is the driver
	if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
	  // Check for the HORN key (Crouch key is the same as the horn key)
		if (newkeys & KEY_CROUCH)
		{
		  // Create variables
		  new Float:vx, Float:vy, Float:vz;

		  // Get the vehicles velocity
		  GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);

		  // Check the values are not too high already
		  if (floatabs(vx) < 3 && floatabs(vy) < 3 && floatabs(vz) < 3)
		  {
		    // Boost the vehicle speed
		  	SetVehicleVelocity(GetPlayerVehicleID(playerid), vx * SpeedBoostMultiplier[playerid], vy * SpeedBoostMultiplier[playerid], vz * SpeedBoostMultiplier[playerid]);
		  }

		  // Exit here
		  return 1;
		}
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)