#1

Error:
Код:
C:\Users\Linus\Desktop\T\PZG\gamemodes\PZG.pwn(57754) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.

line:
pawn Код:
new Float:plocx,Float:plocy,Float:plocz;

The whole code of the cmd:
pawn Код:
CMD:gotoid(playerid, params[])
{
    new giveplayerid;
    sscanf(params, "u", playerid); return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gotoid [playerid]");

    new Float:plocx,Float:plocy,Float:plocz;
    if (IsPlayerConnected(giveplayerid))
    {
        if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid, -1, "You must be on Admin Duty to use this Command!");
        if (PlayerInfo[playerid][pAdmin] >= 2)
        {
            if(GetPlayerState(giveplayerid) == PLAYER_STATE_SPECTATING)
            {
                SendClientMessageEx(playerid, COLOR_GRAD2, "That player is spectating someone.");
                return 1;
            }
            if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
            {
                SendClientMessageEx(playerid, COLOR_GRAD2, "You can not do this while spectating.");
                return 1;
            }
            GetPlayerPos(giveplayerid, plocx, plocy, plocz);
            SetPlayerVirtualWorld(playerid, PlayerInfo[giveplayerid][pVW]);
            Streamer_UpdateEx(playerid, plocx, plocy, plocz);

            if (GetPlayerState(playerid) == 2)
            {
                new tmpcar = GetPlayerVehicleID(playerid);
                SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
                TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
            }
            else
            {
                SetPlayerPos(playerid,plocx,plocy+2, plocz);
                SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
                SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
            }

            SendClientMessageEx(playerid, COLOR_GRAD1, "   You have been teleported!");
        }
        else
        {
            SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
        }

    }
    else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
    return 1;
}
Reply
#2

Replace:
pawn Код:
sscanf(params, "u", playerid); return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gotoid [playerid]");
With:
pawn Код:
if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gotoid [playerid]");
EDIT: @Below users: Don't use playerid there (in sscanf) because it will mess it up.
Reply
#3

PHP код:
if(sscanf(params"u"playerid)) return SendClientMessageEx(playeridCOLOR_WHITE"USAGE: /gotoid [playerid]"); 
//Edit: Konstantinos was faster
Reply
#4

pawn Код:
if(sscanf(params, "u", playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gotoid [playerid]");
#EDIT: LoL
Reply
#5

pawn Код:
CMD:gotoid(playerid, params[])
{
    new giveplayerid;
    if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gotoid [playerid]");

    new Float:plocx,Float:plocy,Float:plocz;
    if (IsPlayerConnected(giveplayerid))
    {
        if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid, -1, "You must be on Admin Duty to use this Command!");
        if (PlayerInfo[playerid][pAdmin] >= 2)
        {
            if(GetPlayerState(giveplayerid) == PLAYER_STATE_SPECTATING)
            {
                SendClientMessageEx(playerid, COLOR_GRAD2, "That player is spectating someone.");
                return 1;
            }
            if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
            {
                SendClientMessageEx(playerid, COLOR_GRAD2, "You can not do this while spectating.");
                return 1;
            }
            GetPlayerPos(giveplayerid, plocx, plocy, plocz);
            SetPlayerVirtualWorld(playerid, PlayerInfo[giveplayerid][pVW]);
            Streamer_UpdateEx(playerid, plocx, plocy, plocz);

            if (GetPlayerState(playerid) == 2)
            {
                new tmpcar = GetPlayerVehicleID(playerid);
                SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
                TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
            }
            else
            {
                SetPlayerPos(playerid,plocx,plocy+2, plocz);
                SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
                SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
            }

            SendClientMessageEx(playerid, COLOR_GRAD1, "   You have been teleported!");
        }
        else
        {
            SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
        }

    }
    else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
    return 1;
}
EDIT: Lol, 4 replies xD
Reply
#6

thanks
Reply
#7

If you replaced it with:
pawn Код:
if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gotoid [playerid]");
then it'd be impossible to get the same warning. That's the solution to fix it.

I'm sure you just added it below the line which gave the warning instead of replacing it.

EDIT: I need 2 more minutes to reply again..

Quote:
Originally Posted by LemonPunch
Посмотреть сообщение
what if i got the new version of sscanf? i got a bug with some admin commands and its written "Invalid player specified" it happends if i got the newest version of sscanf.
Actually that would happen if you use older versions. Make sure you update both sscanf2.inc and sscanf.dll (for windows) or sscanf.so (for linux).
Reply
#8

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
If you replaced it with:
pawn Код:
if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gotoid [playerid]");
then it'd be impossible to get the same warning. That's the solution to fix it.
what if i got the new version of sscanf? i got a bug with some admin commands and its written "Invalid player specified" it happends if i got the newest version of sscanf.
Reply
#9

Quote:
Originally Posted by LemonPunch
Посмотреть сообщение
what if i got the new version of sscanf? i got a bug with some admin commands and its written "Invalid player specified" it happends if i got the newest version of sscanf.
Might be or read the parameters like what does 'u' specify or what does 'i' specify in the sscanf topic ...

You might be not knowing how to use it . If you think you should update sscanf then update it..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)