SA-MP Forums Archive
sscanf bug? - 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 bug? (/showthread.php?tid=377363)



sscanf bug? - fordawinzz - 13.09.2012

pawn Код:
command(lotto, playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new nr;
        if(sscanf(params, "i", nr)) return SendClientUsage(playerid, "USAGE: /lotto nr");
        playerVariables[playerid][pLotteryTicket] = nr;
        SendClientMessage(playerid,-1,sprintf("NR:%d",playerVariables[playerid][pLotteryTicket]));
        return 1;
    }
    return 1;
}
command(test3, playerid, params[])
{
    #pragma unused params
    if(IsPlayerConnected(playerid))
    {
        foreach(new i : Player) {
            SendClientMessage(playerid,-1,sprintf("ID %d has NR:%d",i, playerVariables[i][pLotteryTicket]));
        }
    }
    return 1;
}
I have those 2 commands, when I use the /lotto command and I set my number for example to 13, the other player has the same number as me. Is this a bug?

@cookiemonster: You didn't edited anything.


Re: sscanf bug? - C00K13M0N$73R - 13.09.2012

pawn Код:
command(lotto, playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new nr;
        if(sscanf(params, "i", nr)) return SendClientUsage(playerid, "USAGE: /lotto nr");
        playerVariables[playerid][pLotteryTicket] = nr;
        SendClientMessage(playerid,-1,sprintf("NR:%d",playerVariables[playerid][pLotteryTicket]));
        return 1;
    }
    return 1;
}
command(test3, playerid, params[])
{
    #pragma unused params
    if(IsPlayerConnected(playerid))
    {
        foreach(new i : Player) {
            SendClientMessage(playerid,-1,sprintf("ID %d has NR:%d",i, playerVariables[i][pLotteryTicket]));
        }
    }
    return 1;
}