SA-MP Forums Archive
warning 225: unreachable code - 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: warning 225: unreachable code (/showthread.php?tid=415231)



warning 225: unreachable code - Louris - 12.02.2013

Код:
CMD:giveall(playerid, params[])
{
    new value;
    if(PlayerInfo[playerid][pPadmin] == 0) return SendClientMessage( playerid, -1, "Tu ne pagrindinis administratorius!" );
    if(sscanf(params, "d", value) != 0) SendClientMessage(playerid, 0xFFFFFFFF, "Naudojimas /giveall [kiek]"); return 1;
        for(new i; i < MAX_PLAYERS; i++)
        {
        if(IsPlayerConnected(i))
        {
            GivePlayerMoney(i, value);
        }
}
    return 1;
}



Re: warning 225: unreachable code - DaRk_RaiN - 12.02.2013

pawn Код:
CMD:giveall(playerid, params[])
{
    new value;
    if(PlayerInfo[playerid][pPadmin] == 0) return SendClientMessage( playerid, -1, "Tu ne pagrindinis administratorius!" );
    if(sscanf(params, "d", value) != 0)return  SendClientMessage(playerid, 0xFFFFFFFF, "Naudojimas /giveall [kiek]"); return 1;
        for(new i; i < MAX_PLAYERS; i++)
        {
        if(IsPlayerConnected(i))
        {
            GivePlayerMoney(i, value);
        }
}
    return 1;
}



Re: warning 225: unreachable code - zombieking - 12.02.2013

Actually:
pawn Код:
CMD:giveall(playerid, params[])
{
    new value;
    if(PlayerInfo[playerid][pPadmin] == 0) return SendClientMessage( playerid, -1, "Tu ne pagrindinis administratorius!" );
    if(sscanf(params, "d", value) != 0) return  SendClientMessage(playerid, 0xFFFFFFFF, "Naudojimas /giveall [kiek]");
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            GivePlayerMoney(i, value);
        }
    }
    return 1;
}
The code above my post (by Dark Rain) would still output the warning
One of your problems was the indentation too



Re: warning 225: unreachable code - Louris - 12.02.2013

Quote:
Originally Posted by zombieking
Посмотреть сообщение
Actually:
pawn Код:
CMD:giveall(playerid, params[])
{
    new value;
    if(PlayerInfo[playerid][pPadmin] == 0) return SendClientMessage( playerid, -1, "Tu ne pagrindinis administratorius!" );
    if(sscanf(params, "d", value) != 0) return  SendClientMessage(playerid, 0xFFFFFFFF, "Naudojimas /giveall [kiek]");
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            GivePlayerMoney(i, value);
        }
    }
    return 1;
}
The code above my post (by Dark Rain) would still output the warning
One of your problems was the indentation too
Thank you.