unreachable code -
enzulikeS - 03.05.2018
Код:
CMD:gotojob(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return SCM(playerid, COLOR_LIGHTRED, "You need to log in first.");
if(PlayerInfo[playerid][pAdmin] == 0) return SCM(playerid, COLOR_LIGHTRED, "Nu ai acces la aceasta comanda.");
{
ShowPlayerDialog(playerid, DIALOG_GOTOJOB, DIALOG_STYLE_LIST,"Gotojob", "Detective\nDrugs Dealer\nPizza Boy\nBus Driver\nArms Dealer\nGarbageman\nFisherman\nTrucker\nFarmer");
return 1;
}
return 1;
}
D:\server\gamemodes\ExtremeGame.pwn(23571) : warning 225: unreachable code
Re: unreachable code -
git - 03.05.2018
Код:
CMD:gotojob(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return SCM(playerid, COLOR_LIGHTRED, "You need to log in first.");
if(PlayerInfo[playerid][pAdmin] == 0) // return SCM(playerid, COLOR_LIGHTRED, "Nu ai acces la aceasta comanda.");
{
SCM(playerid, COLOR_LIGHTRED, "Nu ai acces la aceasta comanda.");
ShowPlayerDialog(playerid, DIALOG_GOTOJOB, DIALOG_STYLE_LIST,"Gotojob", "Detective\nDrugs Dealer\nPizza Boy\nBus Driver\nArms Dealer\nGarbageman\nFisherman\nTrucker\nFarmer");
return 1;
}
return 1;
}
You were returning the client message and then still carried on the code.
However, I think your code is wrong, do this:
Код:
CMD:gotojob(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return SCM(playerid, COLOR_LIGHTRED, "You need to log in first.");
if(PlayerInfo[playerid][pAdmin] == 0) // return SCM(playerid, COLOR_LIGHTRED, "Nu ai acces la aceasta comanda.");
{
SCM(playerid, COLOR_LIGHTRED, "Nu ai acces la aceasta comanda.");
return 1;
}
else
{
ShowPlayerDialog(playerid, DIALOG_GOTOJOB, DIALOG_STYLE_LIST,"Gotojob", "Detective\nDrugs
Dealer\nPizza Boy\nBus Driver\nArms Dealer\nGarbageman\nFisherman\nTrucker\nFarmer");
}
return 1;
}
Re: unreachable code -
enzulikeS - 03.05.2018
fixed, ty.
thanks for the second code, the solve was replacing mine with the second one
Re: unreachable code -
kovac - 03.05.2018
It can be simply done like this:
PHP код:
CMD:gotojob(playerid)
{
if(gPlayerLogged[playerid] == 0) return SCM(playerid, COLOR_LIGHTRED, "You need to log in first.");
if(PlayerInfo[playerid][pAdmin] == 0) return SCM(playerid, COLOR_LIGHTRED, "Nu ai acces la aceasta comanda.");
ShowPlayerDialog(playerid, DIALOG_GOTOJOB, DIALOG_STYLE_LIST,"Gotojob", "Detective\nDrugs
Dealer\nPizza Boy\nBus Driver\nArms Dealer\nGarbageman\nFisherman\nTrucker\nFarmer");
return 1;
}
Re: unreachable code -
SeanDenZYR - 04.05.2018
It can be more easily done by removing:
latest ZCMD Include requires each commands used by its command engine to return a value. But you've already returned values via:
pawn Код:
if(gPlayerLogged[playerid] == 0) return SCM(playerid, COLOR_LIGHTRED, "You need to log in first.");
pawn Код:
if(PlayerInfo[playerid][pAdmin] == 0) return SCM(playerid, COLOR_LIGHTRED, "Nu ai acces la aceasta comanda.");
and by the way, remove these brackets.
Код:
CMD:gotojob(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return SCM(playerid, COLOR_LIGHTRED, "You need to log in first.");
if(PlayerInfo[playerid][pAdmin] == 0) return SCM(playerid, COLOR_LIGHTRED, "Nu ai acces la aceasta comanda.");
{
ShowPlayerDialog(playerid, DIALOG_GOTOJOB, DIALOG_STYLE_LIST,"Gotojob", "Detective\nDrugs Dealer\nPizza Boy\nBus Driver\nArms Dealer\nGarbageman\nFisherman\nTrucker\nFarmer");
return 1;
}
return 1;
}