Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Lotto()
- {
- new winner = random(100);
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- if(pInfo[i][LotteryNumber] == winner)
- {
- new PlayerName[MAX_PLAYER_NAME], string[256];
- GetPlayerName(i, PlayerName, MAX_PLAYER_NAME);
- format(string,sizeof(string),"%s won the lottery with number %d! He'll receive $50000,-",PlayerName, winner);
- SendClientMessageToAll(COLOR_GOLD, " ");
- SendClientMessageToAll(COLOR_GOLD, "<<<!!!!And we have a winner!!!!>>>");
- SendClientMessageToAll(COLOR_SILVER, string);
- SendClientMessageToAll(COLOR_GOLD, "<<<!!!!Congratulations!!!!>>>");
- SendClientMessageToAll(COLOR_GOLD, " ");
- print(string);
- GivePlayerMoney(i, 50000);
- pInfo[i][LotteryNumber] = 0;
- return 1;
- }
- new string[256];
- format(string,sizeof(string),"The winning number was %d, to bad nobody picked it.", winner);
- SendClientMessageToAll(COLOR_GOLD, " ");
- SendClientMessageToAll(COLOR_GOLD, "<<<!!!!Lotto: No winner>>>");
- SendClientMessageToAll(COLOR_SILVER, string);
- print(string);
- SendClientMessageToAll(COLOR_GOLD, "<<<!!!!Better luck next time!!!!>>>");
- SendClientMessageToAll(COLOR_GOLD, " ");
- pInfo[i][LotteryNumber] = -1;
- return 1;
- }
- }
- dcmd_lotto(playerid, params[])
- {
- if(pInfo[playerid][LotteryNumber] >= 0)
- {
- SendClientMessage(playerid, COLOR_RED, "You already picked a lottery number, try again in the next round.");
- return 1;
- }
- if(!strlen(params))
- {
- SendClientMessage(playerid, COLOR_RED, "USAGE: /lotto [number]");
- return 1;
- }
- if(!IsNumeric(params))
- {
- SendClientMessage(playerid, COLOR_RED, "USAGE: /lotto [number]");
- return 1;
- }
- if(strval(params) < 1 || strval(params) > 100)
- {
- SendClientMessage(playerid, COLOR_RED, "USAGE: /lotto [number] [1-100]");
- return 1;
- }
- print("1-1");
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- if(pInfo[i][LotteryNumber] == strval(params))
- {
- print("1-3");
- SendClientMessage(playerid, COLOR_RED, "This number has already been chosen, please pick another one.");
- print("1-4");
- return 1;
- }
- }
- print("0");
- pInfo[playerid][LotteryNumber] = strval(params);
- print("1");
- new string[256];
- print("2");
- format(string, sizeof(string), "You chose %d as your lottery number, the winning number will be revealed every 15 minutes.", strval(params));
- print("3");
- SendClientMessage(playerid, COLOR_GOLD, string);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement