04.10.2012, 10:20
Hello,i need a little help with my /lotto command.The problem is,if i type just /lotto it will automatically buy the number 0,how to fix this?I think params are working.
Thanks.
pawn Код:
CMD:lotto(playerid, params[])
{
if(!strlen(params)) return SendClientMessage(playerid,0xFF0000FF, "Pick a number between 1 and 50 with /lotto [50]");
new Num = strval(params);
if(GetPlayerMoney(playerid) <500) return SendClientMessage(playerid,0xAA3333AA, "You don't have 500$ to buy a lotto number.");
new strl[128];
format(strl, sizeof(strl), "Current Lotto Jackpot is {F70505}%d$", Jackpot);
SendClientMessage(playerid, COLOR_BLUE, strl);
if(Numbers[Num] == 1)
{
new str[75];
format(str, sizeof(str), "Lotto number %d is already taken,choose another.", Num);
SendClientMessage(playerid, 0xE21F1FFF, str);
return 1;
}
if(GetPVarInt(playerid, "LottoNumber") != 0) return SendClientMessage(playerid, ORANGE, "You have already selected a lotto number,good luck!");
Numbers[Num] = 1;
new str[140];
GivePlayerMoney(playerid, -TICKET_COST);
SetPVarInt(playerid, "LottoNumber", Num);
format(str, sizeof(str), "Lotto number %d bought! Good luck baby!", Num);
SendClientMessage(playerid, COLOR_WHITE, str);
format(str, sizeof(str), "Draws are held every %d minutes and the winners are announced on global chat. Current jackpot is ***%d$***", LOTTO_DRAW, Jackpot);
Jackpot = Jackpot + LOTTO_JACKPOT;
SendClientMessage(playerid, 0x62FF32FF, str);
return 1;
}