22.06.2011, 19:05
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
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;
}