Problem with ID2
#1

I've got a sereous annoying problem, on my server, whenever a player with ID2 logs in, I can't do anything to ID2, saying "Invalid Player Specified". I tried some new versions of sscanf, no changes. I'd apreciate and rep+ any sort of help. Thank you.
Reply
#2

We haven't code... We Can't help you i think
Reply
#3

When you're checking if the player is valid or not, I suggest you to do something like this:
PHP код:
//CMD
//..
..
..
...
...
//
new giveplayerid//The target.
if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1"Invalid player specified"); 
Reply
#4

For an example, here's one of the commands(credits go to NGG):

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

    new Float:plocx,Float:plocy,Float:plocz;
    if (IsPlayerConnected(giveplayerid))
    {
        if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin])
        {
            SendClientMessageEx(playerid, COLOR_WHITE, "You can't perform this action on an equal or higher level administrator.");
            return 1;
        }
        if (PlayerInfo[playerid][pAdmin] >= 2)
        {
            if(GetPlayerState(giveplayerid) == PLAYER_STATE_SPECTATING)
            {
                SendClientMessageEx(playerid, COLOR_GRAD2, "That player is spectating someone.");
                return 1;
            }
            GetPlayerPos(playerid, plocx, plocy, plocz);
            Streamer_UpdateEx(giveplayerid, plocx, plocy, plocz);
            SetPVarInt(playerid, "BeingTeleported", 1);
            SetPlayerVirtualWorld(giveplayerid, PlayerInfo[playerid][pVW]);

            PlayerInfo[giveplayerid][pLocal] = PlayerInfo[playerid][pLocal];

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

            SendClientMessageEx(giveplayerid, 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;
}
Thing is, the command works perfectly, but whenever I try to TP a player with ID2, it gives me the message,
" Invalid Player Specified."
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)