error Loose indentation -
Eymeric69 - 30.05.2016
hi again... with this script
PHP код:
public OnPlayerDeath(playerid, killerid, reason)
{
new KillStreak [MAX_PLAYERS];
if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
{
if(GetPlayerWantedLevel(killerid) < 6)
{
SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid) + 1);
}
KillStreak[killerid]++;
GivePlayerMoney(killerid, 1000);
}
SetPlayerWantedLevel(playerid, 0); // here loose indentation
KillStreak[playerid] = 0;
new str[256], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(killerid, PlayerName, sizeof(PlayerName));
it's making error (loose indentation)
thank for the help.
Re: error Loose indentation -
cuzido - 30.05.2016
Try this:
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new KillStreak [MAX_PLAYERS];
if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
{
if(GetPlayerWantedLevel(killerid) < 6)
{
SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid) + 1);
}
KillStreak[killerid]++;
GivePlayerMoney(killerid, 1000);
}
SetPlayerWantedLevel(playerid, 0); // here loose indentation
KillStreak[playerid] = 0;
new str[256], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(killerid, PlayerName, sizeof(PlayerName));
//rest of your code here
All you have to do is use TAB to get rid of the loose indentation.
Re: error Loose indentation - justice96 - 30.05.2016
PHP код:
public OnPlayerDeath(playerid, killerid, reason)
{
new KillStreak[MAX_PLAYERS];
if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
{
if(GetPlayerWantedLevel(killerid) < 6)
{
SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid) + 1);
}
KillStreak[killerid]++;
GivePlayerMoney(killerid, 1000);
}
SetPlayerWantedLevel(playerid, 0); // here loose indentation
KillStreak[playerid] = 0;
new str[256], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(killerid, PlayerName, sizeof(PlayerName));
Re: error Loose indentation -
iKevin - 30.05.2016
Use one of the above, however, indentation error is something you get when your code looks weird, and PAWN detects if you did a space in one line which you didn't in the rest, and if you open a bracket in the middle of a line and close it at the end, that sucks. Make your code more readable.
Re: error Loose indentation -
Eymeric69 - 30.05.2016
Thank but that is bugging and making errors now and i don't think it is a brackets error
PHP код:
switch( KillStreak[ killerid ] ) // loose indentation
{
case 1:
{
format(str, sizeof(str), "~r~ %s is on a kill!", PlayerName);
GameTextForAll(str,4000,4);
}
case 2:
{
format(str, sizeof(str), "~r~ %s is on a ~b~double kill!", PlayerName);
GameTextForAll(str,4000,4);
}
case 3:
{
format(str, sizeof(str), "~y~%s is on a ~r~killing spree!", PlayerName);
GameTextForAll(str,4000,4);
}
case 4:
{
format(str, sizeof(str), "~g~%s is on a ~b~mmmmmonster kill!", PlayerName);
GameTextForAll(str,4000,4);
}
case 5:
{
format(str, sizeof(str), "~r~%s is ~p~dominating!", PlayerName);
GameTextForAll(str,4000,4);
}
case 6:
{
format(str, sizeof(str), "~p~%s is ~y~unstopable!", PlayerName);
GameTextForAll(str,4000,4);
}/*
case 7: //You can do this as many times as you like
{
format(str,sizeof(str),"%s is annihilating!",Killername);
GameTextForAll(str,4000,4);
}
case 8:
{
format(str,sizeof(str),"%s is GodLike!",Killername);
GameTextForAll(str,4000,4);
}*/
}
}
Re: error Loose indentation -
iKevin - 30.05.2016
Of course it is, again indentation, look at the code.. isn't it weird?..
I mean, compare this (your code);
Код:
switch( KillStreak[ killerid ] ) // loose indentation
{
case 1:
{
format(str, sizeof(str), "~r~ %s is on a kill!", PlayerName);
GameTextForAll(str,4000,4);
}
case 2:
{
format(str, sizeof(str), "~r~ %s is on a ~b~double kill!", PlayerName);
GameTextForAll(str,4000,4);
}
case 3:
{
format(str, sizeof(str), "~y~%s is on a ~r~killing spree!", PlayerName);
GameTextForAll(str,4000,4);
}
case 4:
{
format(str, sizeof(str), "~g~%s is on a ~b~mmmmmonster kill!", PlayerName);
GameTextForAll(str,4000,4);
}
case 5:
{
format(str, sizeof(str), "~r~%s is ~p~dominating!", PlayerName);
GameTextForAll(str,4000,4);
}
case 6:
{
format(str, sizeof(str), "~p~%s is ~y~unstopable!", PlayerName);
GameTextForAll(str,4000,4);
}/*
case 7: //You can do this as many times as you like
{
format(str,sizeof(str),"%s is annihilating!",Killername);
GameTextForAll(str,4000,4);
}
case 8:
{
format(str,sizeof(str),"%s is GodLike!",Killername);
GameTextForAll(str,4000,4);
}*/
}
}
with my code (won't give errors);
Код:
switch(KillStreak[killerid])
{
case 1:
{
format(str, sizeof(str), "~r~ %s is on a kill!", PlayerName);
GameTextForAll(str,4000,4);
}
case 2:
{
format(str, sizeof(str), "~r~ %s is on a ~b~double kill!", PlayerName);
GameTextForAll(str,4000,4);
}
case 3:
{
format(str, sizeof(str), "~y~%s is on a ~r~killing spree!", PlayerName);
GameTextForAll(str,4000,4);
}
case 4:
{
format(str, sizeof(str), "~g~%s is on a ~b~mmmmmonster kill!", PlayerName);
GameTextForAll(str,4000,4);
}
case 5:
{
format(str, sizeof(str), "~r~%s is ~p~dominating!", PlayerName);
GameTextForAll(str,4000,4);
}
case 6:
{
format(str, sizeof(str), "~p~%s is ~y~unstopable!", PlayerName);
GameTextForAll(str,4000,4);
}
}
Show me the code above also, I can't see shit from that what you posted.
Re: error Loose indentation -
Eymeric69 - 30.05.2016
oh shit i've got bad eyes
Re: error Loose indentation - justice96 - 30.05.2016
PHP код:
switch( KillStreak[ killerid ] ) // loose indentation
{
case 1:
{
format(str, sizeof(str), "~r~ %s is on a kill!", PlayerName);
GameTextForAll(str,4000,4);
}
case 2:
{
format(str, sizeof(str), "~r~ %s is on a ~b~double kill!", PlayerName);
GameTextForAll(str,4000,4);
}
case 3:
{
format(str, sizeof(str), "~y~%s is on a ~r~killing spree!", PlayerName);
GameTextForAll(str,4000,4);
}
case 4:
{
format(str, sizeof(str), "~g~%s is on a ~b~mmmmmonster kill!", PlayerName);
GameTextForAll(str,4000,4);
}
case 5:
{
format(str, sizeof(str), "~r~%s is ~p~dominating!", PlayerName);
GameTextForAll(str,4000,4);
}
case 6:
{
format(str, sizeof(str), "~p~%s is ~y~unstopable!", PlayerName);
GameTextForAll(str,4000,4);
}/*
case 7: //You can do this as many times as you like
{
format(str,sizeof(str),"%s is annihilating!",Killername);
GameTextForAll(str,4000,4);
}
case 8:
{
format(str,sizeof(str),"%s is GodLike!",Killername);
GameTextForAll(str,4000,4);
}*/
}
Re: error Loose indentation -
Noris - 30.05.2016
****** and use "samp indenter" next time.
Re: error Loose indentation -
ilijap - 30.05.2016
Lol rlly? ^
#pragma tabsize 0