SA-MP Forums Archive
2 annoying warnings - 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: 2 annoying warnings (/showthread.php?tid=317088)



2 annoying warnings - Da' J' - 09.02.2012

This line is giving me 2 really annoying warnings:
pawn Код:
if (PLAYERLIST_authed[playerid]==0){
It's giving these 2 warnings:
Код:
C:\Users\Joni\Desktop\TDM\filterscripts\saving.pwn(83) : warning 225: unreachable code
C:\Users\Joni\Desktop\TDM\filterscripts\saving.pwn(83) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Whole part of the script i'm adding:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  dcmd(login,5,cmdtext);
  dcmd(register,8,cmdtext);
  return 0;
 
    if (PLAYERLIST_authed[playerid]==0){
if (udb_Exists(PlayerName(playerid))){
SystemMsg(playerid,"You're not logged in yet.");
}

return 0;
}
    return 1;
}
dcmd's are all working fine, but under that all fucked -_- Tried everything. :/


Re: 2 annoying warnings - Babul - 09.02.2012

remove the return 0; after the dcmd's, the rest of the code needs to be executed, even if there ar no more commands. the only important return is the one directly before the end of the callback:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(login,5,cmdtext);
    dcmd(register,8,cmdtext);
    if (PLAYERLIST_authed[playerid]==0){
        if (udb_Exists(PlayerName(playerid))){
            SystemMsg(playerid,"You're not logged in yet.");
        }
    }
    return 1;
}
may i suggest you to use another command processor?
edit: maybe i broke your command by removing some returns, but dont hesitate to experiment with them


Re: 2 annoying warnings - MP2 - 09.02.2012

It should be return 0, not 1.