15.06.2014, 23:16
Guys,How to check if the player's number that he wants to choose is already taken by another player in these codes:
pawn Код:
COMMAND:lotto(playerid, params[])
{
new string[256], number;
if(sscanf(params, "d", number)) return SendClientMessage(playerid, -1, "Syntax: {FF9900}/lotto [1 - 80]");
if(LottoNumber[playerid] > 0) return SendClientMessage(playerid, -1, "You already have a lotto number.");
if(number < 1 || number > 80) return SendClientMessage(playerid, -1, "Invalid lotto number. Number must be between 1 and 80.");
if(LottoNum == 0) return SendClientMessage(playerid, -1, "There is not a lottery going on.");
else
{
format(string, sizeof(string), "You picked number %d for the lottery.", number);
SendClientMessage(playerid, -1, string);
LottoNumber[playerid] = number;
GivePlayerMoney(playerid, -100);
}
return 1;
}