SA-MP Forums Archive
God warning - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: God warning (/showthread.php?tid=72359)



God warning - [KML]Dabug - 08.04.2009

Yesterday i made this command if(strcmp(cmd, "/godon", true) == 0) {
SendPlayerFormattedText(playerid,"God:ON to turn off do /godoff",0);
SetPlayerHealth(playerid,1000.0);
return 1;

}

if( strcmp( cmdtext, "/adminskin", true) == 0 )
SetPlayerSkin(playerid, 294);
return 1;


if(strcmp(cmd, "/godoff", true) == 0) {
SendPlayerFormattedText(playerid,"God:OFF to turn off do /godon",0);
SetPlayerHealth(playerid,100.0);
return 1;

}


and made without any errors but today when i compiled it i got

C:\Documents and Settings\Adminisondre\Desktop\coding\gamemodes\lvd m.pwn(15 : warning 225: unreachable code
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.



EDIT: THE WARNING IS IN GODOFF COMMAND IF I REMOVE IT IT WILL JUST COME WARNING ON /KILL THEN /GODON



Re: God warning - 13th - 08.04.2009

curly-brackets are missing from the /adminskin commands IF statement. "return 1;" is the unreachable code.

EDIT: You should also decide if you are going to use cmd or cmdtext


Re: God warning - Nubotron - 08.04.2009

No what is unreachable is all code after the return


Re: God warning - 13th - 08.04.2009

Quote:
Originally Posted by Nubotron
No what is unreachable is all code after the return
ah, yes indeed


Re: God warning - [KML]Dabug - 08.04.2009

How can i fix it?


Re: God warning - 13th - 08.04.2009

Quote:
Originally Posted by [KML
Dabug ]
How can i fix it?
Since the problem is missing curly braces (or curly brackets), you might want to try adding them..


Re: God warning - [KML]Dabug - 08.04.2009

i will try


Re: God warning - [KML]Dabug - 08.04.2009

Lol, signatured