SA-MP Forums Archive
[Question]Is this correct indent? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Question]Is this correct indent? (/showthread.php?tid=261348)



[Question]Is this correct indent? - Gazmull - 13.06.2011

Can i ask, because im confused at indenting

Is this correct?
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,sizeof(pName));
    if(killerid == INVALID_PLAYER_ID)
    {
        SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
        printf("%s was killed (%s)",pName,reason);
    }
    else
    {
        if(gTeam[killerid] != gTeam[playerid])
        {
            SendDeathMessage(killerid,playerid,reason);
            SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
            GivePlayerMoney(killerid, 10000);
            printf("%s was killed by %s (%s)",pName,killerid,reason);
        }
        else
        {
             SendDeathMessage(killerid,playerid,reason);
             printf("%s was killed by a team mate",pName);
        }
    }
    return 1;
}
Thanks.


Re: [Question]Is this correct indent? - Bmxerlmao5288 - 13.06.2011

When i Do My Codeing I Do It like this For The Indenting

Код:
         public OnPlayerDeath(playerid, killerid, reason)
{    
         new pName[MAX_PLAYER_NAME];
         GetPlayerName(playerid,pName,sizeof(pName));
         if(killerid == INVALID_PLAYER_ID)
{       
         SendMessage(INVALID_PLAYER_ID,playerid,reason);
         printf("%s was killed (%s)",pName,reason);
}
         else    
{        
         if(gTeam[killerid] != gTeam[playerid])
{        SendDeathMessage(killerid,playerid,reason);
         SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
         GivePlayerMoney(killerid, 10000);
         printf("%s was killed by %s (%s)",pName,killerid,reason);
}        
         else        
{             
         SendDeathMessage(killerid,playerid,reason);
         printf("%s was killed by a team mate",pName);
         return 1;
}
But Other Than That It Looks Good


Re: [Question]Is this correct indent? - Gazmull - 13.06.2011

Quote:
Originally Posted by Bmxerlmao5288
Посмотреть сообщение
When i Do My Codeing I Do It like this For The Indenting

Код:
         public OnPlayerDeath(playerid, killerid, reason)
{    
         new pName[MAX_PLAYER_NAME];
         GetPlayerName(playerid,pName,sizeof(pName));
         if(killerid == INVALID_PLAYER_ID)
{       
         SendMessage(INVALID_PLAYER_ID,playerid,reason);
         printf("%s was killed (%s)",pName,reason);
}
         else    
{        
         if(gTeam[killerid] != gTeam[playerid])
{        SendDeathMessage(killerid,playerid,reason);
         SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
         GivePlayerMoney(killerid, 10000);
         printf("%s was killed by %s (%s)",pName,killerid,reason);
}        
         else        
{             
         SendDeathMessage(killerid,playerid,reason);
         printf("%s was killed by a team mate",pName);
         return 1;
}
But Other Than That It Looks Good
I use to code like that too when i start pawn coding

btw, thanks