Help in converting(+rep)
#2

Use sscanf, It'll be easier
Код:
CMD:lotto(playerid, params[])
{
new number;
if (sscanf(params, "i", number)) return SendClientMessage(playerid, COLOR_RED, "SYNTAX: /lotto [number]");
if (LottoParticipant[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: You already have a lotto ticket");
if (GetPlayerMoney(playerid) < LOTTO_PRICE)  return SendClientMessage(playerid, COLOR_RED, "You don't have enough money");
if (number < 0 || number > 100) return SendClientMessage(playerid, COLOR_RED, "ERROR: Choose a number between 0 and 100");
if (NumberUsed[number] == 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: This number is already taken");

new strings[256];
format(strings, sizeof(strings), "You have purchased the lotto number %d and you have been charged $5000 for the ticket.", number);
SendClientMessage(playerid,COLOR_YELLOW,strings);
SendClientMessage(playerid,COLOR_YELLOW,"Draw will commence at 06:00 and 18:00.");
PlayerLottoGuess[playerid] = number;
LottoParticipant[playerid] = 1;
takeMoney(playerid,5000);

return 1;
}
Reply


Messages In This Thread
Help in converting(+rep) - by bugmenotlol - 23.07.2017, 15:54
Re: Help in converting(+rep) - by Ebisu - 23.07.2017, 16:03
Re: Help in converting(+rep) - by RomaNScripteR - 23.07.2017, 16:21
Re: Help in converting(+rep) - by bugmenotlol - 23.07.2017, 16:26

Forum Jump:


Users browsing this thread: 1 Guest(s)