sscanf bug?
#1

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.
Reply
#2

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


Forum Jump:


Users browsing this thread: 1 Guest(s)