SA-MP Forums Archive
Sscanf ID 0 Issue - 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)
+--- Thread: Sscanf ID 0 Issue (/showthread.php?tid=304837)



Sscanf ID 0 Issue - Shockey HD - 20.12.2011

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]


Re: Sscanf ID 0 Issue - JamesC - 20.12.2011

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


Re: Sscanf ID 0 Issue - Shockey HD - 20.12.2011

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;
}



Re: Sscanf ID 0 Issue - JamesC - 20.12.2011

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.


Re: Sscanf ID 0 Issue - Tee - 20.12.2011

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.


Re: Sscanf ID 0 Issue - Shockey HD - 21.12.2011

Would another version of SAMP need to be downloaded?


Re: Sscanf ID 0 Issue - Tee - 21.12.2011

No, just the 0.3d release version.