17.12.2009, 20:20
How do i add a variable to this script witch gives them an else "you can only try once!" ?
Here is script..
Trying to make a lotto script!
But i dont want them guessing the lotto number spamming the command like..
/lotto 1
/lotto 2
/lotto 3
and so on..
Here is script..
pawn Код:
if (strcmp("/lotto", cmd, true) == 0)
{
new tmp[256], cmdid, string[256], pname[MAX_PLAYER_NAME];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, red, "USAGE: /Lotto (number)");
cmdid = strval(tmp);
if(cmdid < answer || cmdid > answer)
{
SendClientMessage(playerid, red, "Not a winner! bummer! 15000$ Has been taken for the lotto ticket!");
GivePlayerMoney(playerid, -15000);
}
if(cmdid == answer && answered == 0)
{
new RandomCash = random(125000)+25000;
new month, day, year;
getdate(year, month, day);
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s has won $%d from the lottery! Winning Number: %d !", pname,GetPlayersOnline() + RandomCash,cmdid);
SendClientMessageToAll(green, string);
print(string);
new File:mw = fopen("lottowins.txt", io_append);
format(string, sizeof string, "%s Has won $%d On %d/%d/%d from lotto! Winning Number: %d--\r\n",pname,GetPlayersOnline() + RandomCash,month,day,year,score,cmdid);
fwrite(mw, string);
fclose(mw);
answered = 1;
SetPlayerScore(playerid, GetPlayerScore(playerid) + score);
GivePlayerMoney(playerid, GetPlayersOnline() + RandomCash);
score = 0;
//money = 0;
return 1;
}
else if(cmdid == answer && answered == 1)
{
SendClientMessage(playerid, red, "Lotto has already been won!");
}
return 1;
}
But i dont want them guessing the lotto number spamming the command like..
/lotto 1
/lotto 2
/lotto 3
and so on..