[HELP]Unreachable Code?
#1

This is the command:

Код:
dcmd_slap(playerid,params[]) {
    if(IsPlayerCommandLevel(playerid,"slap")) {
   		if(!strlen(params)) return SendClientMessage(playerid,red,"Usage: /slap [playerid] [reason]");
        new tmp[256],Index; tmp = strtok(params,Index);
	   	new id; if(!IsNumeric(tmp)) id = ReturnPlayerID(tmp); else id = strval(tmp);
		if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID && id != playerid) {
			    new string[256],name[24],ActionName[24]; GetPlayerName(playerid,name,24); GetPlayerName(id,ActionName,24);
			    if(!strlen(params[strlen(tmp)+1])) format(string,256,"[INFO]: %s [ID:%d] has been slapped by %s [ID:%d] for: No Reason Given",ActionName,id,name,playerid);
				else format(string,256,"[INFO]: %s [ID:%d] has been slapped by %s [ID:%d] for: %s)",ActionName,id,name,playerid,params[strlen(tmp)+1]);
		    	return SendClientMessageToAll(yellow,string);
		    	new Float:x, Float:y, Float:z;GetPlayerPos(id, x,y,z); //Line 374
		    	return SetPlayerPos(id, x,y,z+5);
		} else return SendClientMessage(playerid,red,"ERROR: You cannot slap yourself or a disconnected player.");
	} else return SendLevelErrorMessage(playerid,"slap");
}
And this is the error I get:
Код:
C:\Users\User\Documents\samp\filterscripts\XtremeAdmin2test.pwn(374) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:           2456 bytes
Code size:           153480 bytes
Data size:           205888 bytes
Stack/heap size:      16384 bytes; estimated max. usage=5316 cells (21264 bytes)
Total requirements:  378208 bytes

1 Warning.
Reply
#2

pawn Код:
dcmd_slap(playerid,params[])
{
    if(IsPlayerCommandLevel(playerid,"slap"))
    {
        if(!strlen(params)) return SendClientMessage(playerid,red,"Usage: /slap [playerid] [reason]");
        new tmp[256],Index; tmp = strtok(params,Index);
        new id; if(!IsNumeric(tmp)) id = ReturnPlayerID(tmp); else id = strval(tmp);
        if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID && id != playerid)
        {
                new string[256],name[24],ActionName[24]; GetPlayerName(playerid,name,24); GetPlayerName(id,ActionName,24);
                if(!strlen(params[strlen(tmp)+1]))
                    format(string,256,"[INFO]: %s [ID:%d] has been slapped by %s [ID:%d] for: No Reason Given",ActionName,id,name,playerid);
                else
                    format(string,256,"[INFO]: %s [ID:%d] has been slapped by %s [ID:%d] for: %s)",ActionName,id,name,playerid,params[strlen(tmp)+1]);
                SendClientMessageToAll(yellow,string);
               
                new Float:x, Float:y, Float:z;GetPlayerPos(id, x,y,z); //Line 374
                return SetPlayerPos(id, x,y,z+5);
               
        }
        else
            return SendClientMessage(playerid,red,"ERROR: You cannot slap yourself or a disconnected player.");
    }
    else
        return SendLevelErrorMessage(playerid,"slap");
}
Should work.
Reply
#3

- nvm (see post above)
Reply
#4

Thanks, it worked! What was wrong with it?
Reply
#5

Compare - The only thing I did was removing "return" from SendClientMessage.
Reply
#6

Oh! Thank mate!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)