Little Help after Buying Lotto
#1

Problem is the when I do /lotto I automatically get ticket 0. But I did not put any value? What could be the problem?


pawn Код:
dcmd_lotto(playerid, params[])
{
    if(!strlen(params))
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Usage: /lotto [1-100]");
        new str[75];
        format(str, sizeof(str), "{FF9900}>> Current Jackpot is $%d", Jackpot);
        SendClientMessage(playerid, 0xFFFFFFFF, str);
    }
    new Num = strval(params);
    if(Numbers[Num] == 1)
    {
        new str[75];
        format(str, sizeof(str), "{FF0000}>> Lotto number %d is already taken", Num);
        SendClientMessage(playerid, 0xFFFFFFFF, str);
        return 1;
    }
    if(GetPVarInt(playerid, "LottoNumber") != 0) return SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You have already got a lotto number");
    SetPVarInt(playerid, "LottoNumber", Num);
    Numbers[Num] = 1;
    GivePlayerMoney(playerid, -TICKET_COST);
    new str[100];
    format(str, sizeof(str), ">> Lotto ticket brought! You now have number %d for the next draw", Num);
    SendClientMessage(playerid, 0xFFFFFFFF, str);
    format(str, sizeof(str), ">> Draws are held every %d minutes and the winners are announced. Current Jackpot is $%d", LOTTO_DRAW, Jackpot);
    Jackpot = Jackpot + LOTTO_JACKPOT;
    SendClientMessage(playerid, 0xFFFFFFFF, str);
    return 1;
}
Reply
#2

I can't understand this scripting way that way is tooooooo old use sscanf its better
Reply
#3

Replace the if(!strlen(params))
with if(!strlen(params) > 0)
Might this is what you mean.
Reply
#4

Quote:
Originally Posted by Gangster-rocks
Посмотреть сообщение
I can't understand this scripting way that way is tooooooo old use sscanf its better
.... That way you will never become like ****** lol
Reply
#5

Lol and you will never become like him :P
Reply
#6

I don't have to.
Reply
#7

Im sorry for disturbing you guys. I solve the first part.

I did is adding return..

But why is that after buying 1 ticket, I could still buy another one?

pawn Код:
if(!strlen(params))
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Usage: /lotto [1-100]");
        new str[75];
        format(str, sizeof(str), "{FF9900}>> Current Jackpot is $%d", Jackpot);
        return SendClientMessage(playerid, 0xFFFFFFFF, str);
    }
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)