10.12.2011, 11:26
pawn Код:
if(strcmp(cmd, "/startlottery", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
if(LotteryNumber == 0)
{
tmp = mystrtok(cmdtext,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_GREY,".: Usage: /startlottery [LotteryNumber] [Price] :.");
return 1;
}
new lotnumb,price;
lotnumb = strval(tmp);
tmp = mystrtok(cmdtext,idx);
price = strval(tmp);
if(lotnumb < 1 || lotnumb > 150)
{
SendClientMessage(playerid,COLOR_ERROR,".: Error: You must insert a lottery number between 1 - 150");
return 1;
}
if(price < 1 || price > 500000)
{
SendClientMessage(playerid,COLOR_ERROR,".: Error: You must insert a price between 1 - 500,000");
return 1;
}
LotteryNumber = lotnumb;
LotteryPrice = price;
LotterySpent = 0;
SendClientMessageToAll(COLOR_LOT1,"[Lottery] The Lottery has been {66CCCC}started.\n {6699CC}Use {66CCCC}/lot [number] {6699CC}to practicipate and get a chance to win !
}
else
{
SendClientMessage(playerid,COLOR_ERROR,".: Error: A Lottery is already started :.");
}
}
}
return 1;
}