showing lotto ticket only for 1st player (ID 0)
#1

me again with ID 0

when ID other then ID 0 buys a ticket,it shows up on textdraw and everythings seems ok, BUT when ID 0 buys ticket, it changes to HIS number so if I bought number 24 and ID 0 is buying after me number 7, the number 7 will replace my number on textdraw

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);

    if(IsPlayerInRangeOfPoint(playerid, 2.0, -2161.1206,640.3578,1052.3817))
    if (strcmp(cmd, "/buyticket", true) == 0) //so I buy ticket
    {
            new dir[256];
            dir = strtok(cmdtext, idx);
                if (!strlen(dir))
                {
                    SendClientMessage(playerid, COLOR_RED, "USE: /buyticket [number]");
                    return 1;
                }
            new number = strval(dir);
            new interior = GetPlayerInterior(playerid);
            if (interior == 1)
            {
                if (LottoParticipant[playerid] == 1)
                {
                    SendClientMessage(playerid, COLOR_RED, "U alrdy took ticket!");
                }
                else
                {
                    if (GetPlayerMoney(playerid) >= LOTTO_PRICE)
                    {
                        if (number > 0 && number < 100)
                        {
                            if (NumberUsed[number] == 0)
                            {
                                new string[256];
                                format(string, sizeof(string), "~y~Ticket number: ~r~%d", number);
                                                                TextDrawSetString(listic, string);
                                TextDrawShowForPlayer(playerid, listic);     //so text draw show up,and if player ID is other the 0,it shows correct number until player which has ID number 0 buy ticket,then all other players see only his ticket number?

                                PlayerLottoGuess[playerid] = number;
                                LottoParticipant[playerid] = 1;
                                GivePlayerMoney(playerid, -LOTTO_PRICE);
                            }
                            else
                            {
                                SendClientMessage(playerid, COLOR_RED, "Alrdy bought.");
                            }

                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_RED, "Wrong number.");
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_RED, "No money.");
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "Only buy at lottery.");
            }

    return 1;
    }

    return 0;
}
Reply
#2

anyone?
Reply
#3

|
|
|
\/
Reply
#4

Quote:
Originally Posted by Unknown_Killer
Посмотреть сообщение
u should make a loop for each player
Wrong. You need to make a textdraw for each player.

new Text:listic[MAX_PLAYERS]
Reply
#5

finally made it,thank you man

I added [MAX_PLAYERS] to textdraw like you said and used this code where need it:

for(new playerid; playerid<MAX_PLAYERS; playerid++)
{
// your script here
}

ty
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)