Lottery! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Lottery! (
/showthread.php?tid=517781)
Lottery! -
AnonScripter - 06.06.2014
hey i made a lotto command using ZCMD, part of the command:
pawn Код:
if(sscanf(params, "i", lottonum)) return SendClientMessage(playerid, COLOR_WHITE, "/lotto [0 - 100]");
how to make a message like: "Sorry this lotto number has been taken by someone"
How to check the taken nums ?
Re: Lottery! -
xo - 06.06.2014
You probably save every player's lotto number in a variable, so just loop through all players and check if it was used.
Re: Lottery! -
ball - 06.06.2014
You have to save player numbers in variable and reset it at the end of lottery
Код:
new playaNumber[MAX_PLAYERS];
//OnPlayerConnect
playaNumber[playerid] = -1;
//command
for(new i; i != MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && playaNumber[i] == lottonum) //someone got this number, return something
}
//rest of code
But remember to reset this variable for all players (use loop) at the end of lottery