Warning 255: 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 255: Unreachable Code (
/showthread.php?tid=392217)
Warning 255: Unreachable Code -
goviscrap - 13.11.2012
I need help with my Warning 255: Unreachable Code
Warnings:
Код:
C:\Users\Nicklas\Desktop\PRP\gamemodes\PRP.pwn(43566) : warning 225: unreachable code
C:\Users\Nicklas\Desktop\PRP\gamemodes\PRP.pwn(43584) : warning 225: unreachable code
CODE:
Код:
Line 43566: {
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[20];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
return 1;
}
And Second Warning line 43584 Starts on: if(strcmp(cmd, "/accent", true) == 0)...
Код:
if(strcmp(cmd, "/accent", true) == 0)
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[16];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /accent [accent type] (set your accent as 'none' for no accent)");
return 1;
}
strmid(Accent[playerid], result, 0, strlen(result), 255);
format(string, sizeof(string), "You have changed your accent to '%s'.", Accent[playerid]);
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}
Re: Warning 255: Unreachable Code -
NumbSkull - 13.11.2012
those are the lines that are unreachable the problem is befor it there is a return or an else preventing script from getting to the lines you have shown
Re: Warning 255: Unreachable Code -
DaRk_RaiN - 13.11.2012
You must have messed used brackets or return at some point