Lottery!
#1

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 ?
Reply
#2

You probably save every player's lotto number in a variable, so just loop through all players and check if it was used.
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)