[Warns] CMD
#1

Hello friends, I was creating the command to accept, but for reasons, I had warning of it if any could guide me remove these warnings are thanked, I attached the code

PHP код:
    CMD:accept(playeridparams[])
    {
        new 
string[128];
        if(
IsPlayerConnected(playerid))
        {
            if(
isnull(params))
            {
                
SendClientMessage(playeridCOLOR_WHITE"Usage: /accept [name]");
                
SendClientMessage(playeridCOLOR_GREY"Options: faction");
                return 
1;
            }
            else if(
strcmp(params,"faction",true) == 0)
            {
                if(
InviteOffer[playerid] < 999)
                {
                    if(
IsPlayerConnected(InviteOffer[playerid]))
                    {
                        if(
InviteFaction[playerid] == 0)
                        {
                            
/*if(PlayerInfo[playerid][pJailTime] > 1)
                            {
                                SendClientMessage(playerid, COLOR_WHITE, "No puedes ser invitado estando en prisiуn.");
                                return 1;
                            }*/
                            
if( PlayerInfo[playerid][pMember] >= || PlayerInfo[playerid][pLeader] >= || PlayerInfo[playerid][pLeader] == || PlayerInfo[playerid][pMember] == || PlayerInfo[playerid][pMember] == && PlayerInfo[playerid][pDivision] >= || PlayerInfo[playerid][pMember] == && PlayerInfo[playerid][pDivision] == 1)
                            {
                                
SendClientMessage(playeridCOLOR_WHITE"No puedes aceptar esta invitaciуn, porque ya estбs en una familia/facciуn.");
                            }
                            else
                            {
                                
PlayerInfo[playerid][pFaction] = InviteFaction[playerid];
                                
PlayerInfo[playerid][pRank] = 0;
                                
PlayerInfo[playerid][pDivision] = 0;
                                
PlayerInfo[playerid][pMember] = 0;
                                
format(stringsizeof(string), "%s has accepted %s's invite to join the %s."GetPlayerNameEx(playerid), GetPlayerNameEx(InviteOffer[playerid]), GetFactionName(InviteFaction[playerid]));
                                
format(stringsizeof(string), "   You have accepted the invitation and joined the %s, you were invited by %s."GetFactionName(InviteFaction[playerid]), GetPlayerNameEx(InviteOffer[playerid]));
                                
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                                
format(stringsizeof(string), "   %s has accepted the invitation and joined the %s."GetPlayerNameEx(playerid), GetFactionName(InviteFaction[playerid]));
                                
SendClientMessage(InviteOffer[playerid], COLOR_LIGHTBLUEstring);
                                
InviteOffer[playerid] = 999;
                                
InviteFaction[playerid] = 0;
                        }
                    }
                }
            }
            else {
                
SendClientMessage(playeridCOLOR_GREY"   No one has invited you to join an organisation/family!");//3055
                
return 1;//3056
            
}//3057
        
}//3058
    
}//3059
    
return 1;//3060
}//3061 
Quote:

C:\Users\sk\Desktop\x\gamemodes\x.pwn(3054) : warning 217: loose indentation
C:\Users\sk\Desktop\x\gamemodes\x.pwn(3060) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Warnings.

Thanks!
Reply
#2

pawn Код:
CMD:accept(playerid, params[])
{
        new string[128];
        if(IsPlayerConnected(playerid))
        {
            if(isnull(params))
            {
                SendClientMessage(playerid, COLOR_WHITE, "Usage: /accept [name]");
                SendClientMessage(playerid, COLOR_GREY, "Options: faction");
                return 1;
            }
            else if(strcmp(params,"faction",true) == 0)
            {
                if(InviteOffer[playerid] < 999)
                {
                    if(IsPlayerConnected(InviteOffer[playerid]))
                    {
                        if(InviteFaction[playerid] == 0)
                        {
                            /*if(PlayerInfo[playerid][pJailTime] > 1)
                            {
                                SendClientMessage(playerid, COLOR_WHITE, "No puedes ser invitado estando en prisiуn.");
                                return 1;
                            }*/

                            if( PlayerInfo[playerid][pMember] >= 3 || PlayerInfo[playerid][pLeader] >= 3 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 && PlayerInfo[playerid][pDivision] >= 3 || PlayerInfo[playerid][pMember] == 2 && PlayerInfo[playerid][pDivision] == 1)
                            {
                                SendClientMessage(playerid, COLOR_WHITE, "No puedes aceptar esta invitaciуn, porque ya estбs en una familia/facciуn.");
                            }
                            else

                            {
                                PlayerInfo[playerid][pFaction] = InviteFaction[playerid];
                                PlayerInfo[playerid][pRank] = 0;
                                PlayerInfo[playerid][pDivision] = 0;
                                PlayerInfo[playerid][pMember] = 0;
                                format(string, sizeof(string), "%s has accepted %s's invite to join the %s.", GetPlayerNameEx(playerid), GetPlayerNameEx(InviteOffer[playerid]), GetFactionName(InviteFaction[playerid]));
                                format(string, sizeof(string), "   You have accepted the invitation and joined the %s, you were invited by %s.", GetFactionName(InviteFaction[playerid]), GetPlayerNameEx(InviteOffer[playerid]));
                                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                                format(string, sizeof(string), "   %s has accepted the invitation and joined the %s.", GetPlayerNameEx(playerid), GetFactionName(InviteFaction[playerid]));
                                SendClientMessage(InviteOffer[playerid], COLOR_LIGHTBLUE, string);
                                InviteOffer[playerid] = 999;
                                InviteFaction[playerid] = 0;
                          }
                    }
                }
            }
            else {
                SendClientMessage(playerid, COLOR_GREY, "   No one has invited you to join an organisation/family!");
                return 1;
            }
        }
    }
    return 1;
}  
}
Reply
#3

- Removed IsPlayerConnected() useless check
- Removed two return's no need for them

@Datax: At least fix the mistakes next time

pawn Код:
CMD:accept(playerid, params[])
{
    new string[128];
    if(isnull(params))
    {
        SendClientMessage(playerid, COLOR_WHITE, "Usage: /accept [name]");
        SendClientMessage(playerid, COLOR_GREY, "Options: faction");
    }
    else if(strcmp(params,"faction",true) == 0)
    {
        if(InviteOffer[playerid] < 999)
        {
            if(IsPlayerConnected(InviteOffer[playerid]))
            {
                if(InviteFaction[playerid] == 0)
                {
                    /*if(PlayerInfo[playerid][pJailTime] > 1)
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "No puedes ser invitado estando en prisiуn.");
                        return 1;
                    }*/

                    if( PlayerInfo[playerid][pMember] >= 3 || PlayerInfo[playerid][pLeader] >= 3 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 && PlayerInfo[playerid][pDivision] >= 3 || PlayerInfo[playerid][pMember] == 2 && PlayerInfo[playerid][pDivision] == 1)
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "No puedes aceptar esta invitaciуn, porque ya estбs en una familia/facciуn.");
                    }
                    else
                    {
                        PlayerInfo[playerid][pFaction] = InviteFaction[playerid];
                        PlayerInfo[playerid][pRank] = 0;
                        PlayerInfo[playerid][pDivision] = 0;
                        PlayerInfo[playerid][pMember] = 0;
                        format(string, sizeof(string), "%s has accepted %s's invite to join the %s.", GetPlayerNameEx(playerid), GetPlayerNameEx(InviteOffer[playerid]), GetFactionName(InviteFaction[playerid]));
                        format(string, sizeof(string), "   You have accepted the invitation and joined the %s, you were invited by %s.", GetFactionName(InviteFaction[playerid]), GetPlayerNameEx(InviteOffer[playerid]));
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "   %s has accepted the invitation and joined the %s.", GetPlayerNameEx(playerid), GetFactionName(InviteFaction[playerid]));
                        SendClientMessage(InviteOffer[playerid], COLOR_LIGHTBLUE, string);
                        InviteOffer[playerid] = 999;
                        InviteFaction[playerid] = 0;
                     }
                 }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   No one has invited you to join an organisation/family!");
            }
        }
    }
    return 1;
}
Reply
#4

Mmm..
Quote:

}
return 1;
}
}//(3062) : error 054: unmatched closing brace ("}")

Reply
#5

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
- Removed IsPlayerConnected() useless check
- Removed two return's no need for them

@Datax: At least fix the mistakes next time

pawn Код:
CMD:accept(playerid, params[])
{
    new string[128];
    if(isnull(params))
    {
        SendClientMessage(playerid, COLOR_WHITE, "Usage: /accept [name]");
        SendClientMessage(playerid, COLOR_GREY, "Options: faction");
    }
    else if(strcmp(params,"faction",true) == 0)
    {
        if(InviteOffer[playerid] < 999)
        {
            if(IsPlayerConnected(InviteOffer[playerid]))
            {
                if(InviteFaction[playerid] == 0)
                {
                    /*if(PlayerInfo[playerid][pJailTime] > 1)
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "No puedes ser invitado estando en prisiуn.");
                        return 1;
                    }*/

                    if( PlayerInfo[playerid][pMember] >= 3 || PlayerInfo[playerid][pLeader] >= 3 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 && PlayerInfo[playerid][pDivision] >= 3 || PlayerInfo[playerid][pMember] == 2 && PlayerInfo[playerid][pDivision] == 1)
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "No puedes aceptar esta invitaciуn, porque ya estбs en una familia/facciуn.");
                    }
                    else
                    {
                        PlayerInfo[playerid][pFaction] = InviteFaction[playerid];
                        PlayerInfo[playerid][pRank] = 0;
                        PlayerInfo[playerid][pDivision] = 0;
                        PlayerInfo[playerid][pMember] = 0;
                        format(string, sizeof(string), "%s has accepted %s's invite to join the %s.", GetPlayerNameEx(playerid), GetPlayerNameEx(InviteOffer[playerid]), GetFactionName(InviteFaction[playerid]));
                        format(string, sizeof(string), "   You have accepted the invitation and joined the %s, you were invited by %s.", GetFactionName(InviteFaction[playerid]), GetPlayerNameEx(InviteOffer[playerid]));
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "   %s has accepted the invitation and joined the %s.", GetPlayerNameEx(playerid), GetFactionName(InviteFaction[playerid]));
                        SendClientMessage(InviteOffer[playerid], COLOR_LIGHTBLUE, string);
                        InviteOffer[playerid] = 999;
                        InviteFaction[playerid] = 0;
                     }
                 }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   No one has invited you to join an organisation/family!");
            }
        }
    }
    return 1;
}
@[uL]Pottus ,Thank you very much friend, Your help was spectacular, can close the topic
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)