D:\lucru\1_3_samp\1.3 samp 0.3e\gamemodes\inaintedetaxi2.pwn(55006) : warning 225: unreachable code
55006: if(strcmp(cmd, "/contract", true) == 0)
if(strcmp(cmd, "/contract", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "{00A6FF}>>{FFFFFF} Scrie: /contract [playerid/PartOfName] [amount]");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "{00A6FF}>>{FFFFFF} Scrie: /contract [playerid/PartOfName] [amount]");
return 1;
}
moneys = strval(tmp);
if(moneys < 1000 || moneys > 100000) { SendClientMessage(playerid, COLOR_GREY, "{FFFFFF}[{4FD359}RCRPR{FFFFFF}]: Contractele incep de la $1000 pana la $100000!"); return 1; }
if(PlayerInfo[playerid][pLevel] < 2)
{
SendClientMessage(playerid, COLOR_GRAD1, "{FFFFFF}[{4FD359}RCRPR{FFFFFF}]: Ai nevoie de level 2 ca sa pui un contract !");
return 1;
}
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PlayerInfo[giveplayerid][pMember] == 14 && PlayerInfo[playerid][pMember] == 14)
{
SendClientMessage(playerid, COLOR_GREY, "{FFFFFF}[{4FD359}RCRPR{FFFFFF}]: Ne pare rau, dar nu poti pune un Contract pe un Hitman.");
return 1;
}
else if(PlayerInfo[giveplayerid][pLeader] == 14 && PlayerInfo[playerid][pMember] == 14)
{
SendClientMessage(playerid, COLOR_GREY, "{FFFFFF}[{4FD359}RCRPR{FFFFFF}]: Ne pare rau, dar nu poti pune un Contract pe un Hitman.");
return 1;
}
else if(PlayerInfo[giveplayerid][pMember] == 14||PlayerInfo[giveplayerid][pLeader] == 14)
{
SendClientMessage(playerid, COLOR_GREY, "{FFFFFF}[{4FD359}RCRPR{FFFFFF}]: Ne pare rau, dar nu poti pune un Contract pe un Hitman.");
return 1;
}
if(gTeam[giveplayerid] == 2 && moneys != 100000)
{
SendClientMessage(playerid, COLOR_GREY, "{FFFFFF}[{4FD359}RCRPR{FFFFFF}]: Un contract pe un Cops costa 100.000$.");
return 1;
}
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "{FFFFFF}[{4FD359}RCRPR{FFFFFF}]: Nu poti sa pui un contract pe tine insusi."); return 1; }
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney = GetPlayerMoney(playerid);
if (moneys > 0 && playermoney >= moneys)
{
GivePlayerMoney(playerid, (0 - moneys));
PlayerInfo[giveplayerid][pHeadValue]+=moneys;
format(string, sizeof(string), "{00A6FF}>>{FFFFFF} %s a pus un contract pe %s, cu %d$.",sendername, giveplayer, moneys);
SendFamilyMessage(8, COLOR_YELLOW, string);
format(string, sizeof(string), "{00A6FF}>>{FFFFFF} Ai pus un contract pe %s, cu %d$.",giveplayer, moneys);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Invalid transaction amount.");
}
}
}
else
{
format(string, sizeof(string), "{FFFFFF}[{4FD359}RCRPR{FFFFFF}]: Acest jucator nu este Online.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
return 1;
}
if(strcmp(cmd, "/contract", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "{00A6FF}>>{FFFFFF} Scrie: /contract [playerid/PartOfName] [amount]");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "{00A6FF}>>{FFFFFF} Scrie: /contract [playerid/PartOfName] [amount]");
return 1;
}
moneys = strval(tmp);
if(moneys < 1000 || moneys > 100000) { SendClientMessage(playerid, COLOR_GREY, "{FFFFFF}[{4FD359}RCRPR{FFFFFF}]: Contractele incep de la $1000 pana la $100000!"); return 1; }
if(PlayerInfo[playerid][pLevel] < 2)
{
SendClientMessage(playerid, COLOR_GRAD1, "{FFFFFF}[{4FD359}RCRPR{FFFFFF}]: Ai nevoie de level 2 ca sa pui un contract !");
return 1;
}
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PlayerInfo[giveplayerid][pMember] == 14 && PlayerInfo[playerid][pMember] == 14)
{
SendClientMessage(playerid, COLOR_GREY, "{FFFFFF}[{4FD359}RCRPR{FFFFFF}]: Ne pare rau, dar nu poti pune un Contract pe un Hitman.");
return 1;
}
else if(PlayerInfo[giveplayerid][pLeader] == 14 && PlayerInfo[playerid][pMember] == 14)
{
SendClientMessage(playerid, COLOR_GREY, "{FFFFFF}[{4FD359}RCRPR{FFFFFF}]: Ne pare rau, dar nu poti pune un Contract pe un Hitman.");
return 1;
}
else if(PlayerInfo[giveplayerid][pMember] == 14||PlayerInfo[giveplayerid][pLeader] == 14)
{
SendClientMessage(playerid, COLOR_GREY, "{FFFFFF}[{4FD359}RCRPR{FFFFFF}]: Ne pare rau, dar nu poti pune un Contract pe un Hitman.");
return 1;
}
if(gTeam[giveplayerid] == 2 && moneys != 100000)
{
SendClientMessage(playerid, COLOR_GREY, "{FFFFFF}[{4FD359}RCRPR{FFFFFF}]: Un contract pe un Cops costa 100.000$.");
return 1;
}
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "{FFFFFF}[{4FD359}RCRPR{FFFFFF}]: Nu poti sa pui un contract pe tine insusi."); return 1; }
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney = GetPlayerMoney(playerid);
if (moneys > 0 && playermoney >= moneys)
{
GivePlayerMoney(playerid, (0 - moneys));
PlayerInfo[giveplayerid][pHeadValue]+=moneys;
format(string, sizeof(string), "{00A6FF}>>{FFFFFF} %s a pus un contract pe %s, cu %d$.",sendername, giveplayer, moneys);
SendFamilyMessage(8, COLOR_YELLOW, string);
format(string, sizeof(string), "{00A6FF}>>{FFFFFF} Ai pus un contract pe %s, cu %d$.",giveplayer, moneys);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Invalid transaction amount.");
}
}
}
else
{
format(string, sizeof(string), "{FFFFFF}[{4FD359}RCRPR{FFFFFF}]: Acest jucator nu este Online.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
}
return 1;
}
pawn Код:
|
if(strcmp(cmd,"/portable",true)==0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
{
if(ConnectedToPC[playerid] == 255)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "{FFFFFF}[{4FD359}Hard2Games{FFFFFF}]: Ai deconectat Laptop-ul.");
ConnectedToPC[playerid] = 0;
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
SendClientMessage(playerid, COLOR_LIGHTBLUE, "{FFFFFF}[{4FD359}Hard2Games{FFFFFF}]: Laptop-ul este Pornit.");
SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}|------|{FF0000} Hitman Agency {FFFFFF}|------|{FF0000}");
SendClientMessage(playerid, COLOR_YELLOW2, "");
SendClientMessage(playerid, COLOR_YELLOW2, "{00A6FF}>>{FFFFFF} News");
SendClientMessage(playerid, COLOR_YELLOW2, "{00A6FF}>>{FFFFFF} Contracts");
SendClientMessage(playerid, COLOR_YELLOW2, "{00A6FF}>>{FFFFFF} Givehit");
SendClientMessage(playerid, COLOR_YELLOW2, "{00A6FF}>>{FFFFFF} Ranks");
SendClientMessage(playerid, COLOR_YELLOW2, "{00A6FF}>>{FFFFFF} Logout");
SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}|------|{FF0000} Hitman Agency {FFFFFF}|------|{FF0000}");
ConnectedToPC[playerid] = 255;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{FFFFFF}[{4FD359}Hard2Games{FFFFFF}]: Ne pare rau, dar nu faci parte din factiunea Hitman Agency.");
return 1;
}
}
return 1;
}
if(strcmp(cmd,"/portable",true)==0)
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(specplayer, 10, cmdtext);
dcmd(specoff, 7, cmdtext);
new string[256];
new playermoney;
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new playername[MAX_PLAYER_NAME];
new cmd[256];
new tmp[256];
new giveplayerid, moneys, idx;
new idcar = GetPlayerVehicleID(playerid);
new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
cmd = strtok(cmdtext, idx);
if(strcmp(cmd,"/portable",true)==0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
{
if(ConnectedToPC[playerid] == 255)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "{FFFFFF}[{4FD359}Hard2Games{FFFFFF}]: Ai deconectat Laptop-ul.");
ConnectedToPC[playerid] = 0;
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
SendClientMessage(playerid, COLOR_LIGHTBLUE, "{FFFFFF}[{4FD359}Hard2Games{FFFFFF}]: Laptop-ul este Pornit.");
SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}|------|{FF0000} Hitman Agency {FFFFFF}|------|{FF0000}");
SendClientMessage(playerid, COLOR_YELLOW2, "");
SendClientMessage(playerid, COLOR_YELLOW2, "{00A6FF}>>{FFFFFF} News");
SendClientMessage(playerid, COLOR_YELLOW2, "{00A6FF}>>{FFFFFF} Contracts");
SendClientMessage(playerid, COLOR_YELLOW2, "{00A6FF}>>{FFFFFF} Givehit");
SendClientMessage(playerid, COLOR_YELLOW2, "{00A6FF}>>{FFFFFF} Ranks");
SendClientMessage(playerid, COLOR_YELLOW2, "{00A6FF}>>{FFFFFF} Logout");
SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}|------|{FF0000} Hitman Agency {FFFFFF}|------|{FF0000}");
ConnectedToPC[playerid] = 255;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{FFFFFF}[{4FD359}Hard2Games{FFFFFF}]: Ne pare rau, dar nu faci parte din factiunea Hitman Agency.");
}
}
return 1;
}
"unreachable code" error occurs when you put an "return" before the end of the function, you have not pasted ALL your OnPlayerCommandText, but you can fix it by yourself just checking for all "returns" in to your code and seeing if it is outside of an condition.
|
if(strcmp(cmd,"/portable",true)==0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
{
if(ConnectedToPC[playerid] == 255)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "{FFFFFF}[{4FD359}Hard2Games{FFFFFF}]: Ai deconectat Laptop-ul.");
ConnectedToPC[playerid] = 0;
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
SendClientMessage(playerid, COLOR_LIGHTBLUE, "{FFFFFF}[{4FD359}Hard2Games{FFFFFF}]: Laptop-ul este Pornit.");
SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}|------|{FF0000} Hitman Agency {FFFFFF}|------|{FF0000}");
SendClientMessage(playerid, COLOR_YELLOW2, "");
SendClientMessage(playerid, COLOR_YELLOW2, "{00A6FF}>>{FFFFFF} News");
SendClientMessage(playerid, COLOR_YELLOW2, "{00A6FF}>>{FFFFFF} Contracts");
SendClientMessage(playerid, COLOR_YELLOW2, "{00A6FF}>>{FFFFFF} Givehit");
SendClientMessage(playerid, COLOR_YELLOW2, "{00A6FF}>>{FFFFFF} Ranks");
SendClientMessage(playerid, COLOR_YELLOW2, "{00A6FF}>>{FFFFFF} Logout");
SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}|------|{FF0000} Hitman Agency {FFFFFF}|------|{FF0000}");
ConnectedToPC[playerid] = 255;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{FFFFFF}[{4FD359}Hard2Games{FFFFFF}]: Ne pare rau, dar nu faci parte din factiunea Hitman Agency.");
}
}
return 1;
}
55006: if(strcmp(cmd,"/portable",true)==0)
It means it can't reach that particular line, and all code below it. This obviously means that the error is in the code ABOVE that particular line.
|