Sscanf ID 0 Issue
#1

When i use an command, ID 0 is seems to always be bugged. When i use a command like /goto or /sethealth or /setarmor and my ID is 0, If i type ID 1, It will change ID's 0 Health or Armor.

Added Video:

[ame]http://www.youtube.com/watch?v=iXV3b7idJQ8[/ame]
Reply
#2

How can we help if you don't show us the command itself?
Reply
#3

Its not the command is i though i explained.

pawn Код:
Here are some Commands.

CMD:goto(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] >=5)
    {
        new id,Float:X,Float:Y,Float:Z,pName[MAX_PLAYER_NAME],string[126],iName[MAX_PLAYER_NAME],string2[126];
        if (unformat(params, "u",id))SendClientMessage(playerid,COLOR_RED,"Usage: /Goto [ID]");
        if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "System: Invalid ID");
        else
        {
            new vWorld = GetPlayerVirtualWorld(id);
            SetPlayerVirtualWorld(playerid,vWorld);
            new Interior = GetPlayerInterior(id);
            SetPlayerInterior(playerid,Interior);
            GetPlayerPos(id,X,Y,Z);
            SetPlayerPos(playerid,X,Y,Z);
            GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
            format(string,128,"Admin %s has teleported to you",pName);
            SendClientMessage(id,COLOR_ORANGE,string);
            GetPlayerName(id, iName, MAX_PLAYER_NAME);
            format(string2,128,"You have gone to %s",iName);
            SendClientMessage(id,COLOR_ORANGE,string2);
        }
    }
    return 1;
}


CMD:gethere(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] >=5)
    {
        new id,Float:X,Float:Y,Float:Z,pName[MAX_PLAYER_NAME],string[126],iName[MAX_PLAYER_NAME],string2[126];
        if (unformat(params, "u",id))SendClientMessage(playerid,COLOR_RED,"Usage: /Gethere [ID]");
        if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "System: Invalid ID");
        else
        {
            new vWorld = GetPlayerVirtualWorld(playerid);
            SetPlayerVirtualWorld(id,vWorld);
            new Interior = GetPlayerInterior(playerid);
            SetPlayerInterior(id,Interior);
            GetPlayerPos(playerid,X,Y,Z);
            SetPlayerPos(id,X,Y,Z);
            GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
            format(string,128,"Admin %s has teleported you",pName);
            SendClientMessage(id,COLOR_ORANGE,string);
            GetPlayerName(id, iName, MAX_PLAYER_NAME);
            format(string2,128,"You have Gotten to %s",iName);
            SendClientMessage(id,COLOR_ORANGE,string2);
        }
    }
    return 1;
}
Reply
#4

pawn Код:
if (unformat(params, "u",id)) return SendClientMessage(playerid,COLOR_RED,"Usage: /Goto [ID]");
You need to either return (exit the function) with a SendClientMessage or create a logical flow of operation. The code above is the easy way of doing it. Even though you send the message, the rest of the function is processed, and since id will default to 0 which is a valid Player ID, it will execute for them.
Reply
#5

It has nothing to do with his commands. The Update 4 of sscanf 2.0 was made to work only with 0.3d (ONLY) not 0.3d R2. I had this problem sometime yesterday when my server was on 0.3d R2 so I downgraded it to 0.3d. That should be your solution.
Reply
#6

Would another version of SAMP need to be downloaded?
Reply
#7

No, just the 0.3d release version.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)