Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Includes
- #include <a_samp>
- #define DIALOG_LOTTO 400
- #define DIALOG_LOTTOHELP 401
- #define COLOR_RED 0x0000FFFF
- #define COLOR_GREEN 0x0FFF00FF
- #define COLOR_WHITE 0xFFFFFFFF
- #define COLOR_YELLOW 0xFFFA00FF
- #pragma unused RandJackpot
- #pragma unused RandomLottoNumber
- new RandomLottoNumber[100];
- new pLottoNumber[MAX_PLAYERS];
- new RandJackpot[][1] = {
- {124757},
- {1200000},
- {500000},
- {305478},
- {485001},
- {1500000},
- {80001},
- {788900}
- };
- new Jackpot;
- new bool:Gespielt[MAX_PLAYERS];
- forward LottoStart();
- forward LottoMessage();
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Lotto System German by Lazoking");
- print("--------------------------------------\n");
- SetTimer("LottoStart",600000,1); // Lotto wird immer in 10 Minuten gestartet.
- SetTimer("LottoMessage",540000,1);
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- pLottoNumber[playerid] = 102;
- Gespielt[playerid] = false;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/lotto", cmdtext, true, 10) == 0)
- {
- new pMoney = GetPlayerMoney(playerid);
- if(pMoney >= 500)
- {
- if(Gespielt[playerid] == false)
- {
- ShowPlayerDialog(playerid,DIALOG_LOTTO,DIALOG_STYLE_INPUT,"Lotto spielen","Geben Sie das gewünschte Lotto Zahl (zwischen 1-100)","Spielen","Abbrechen");
- }
- if(Gespielt[playerid] == true)
- {
- new str[128];
- format(str,sizeof(str),"Sie haben schon Lotto gespielt. Lotto Zahl: %d",pLottoNumber);
- SendClientMessage(playerid,COLOR_RED,str);
- }
- }
- else {
- SendClientMessage(playerid,COLOR_RED,"Sie haben nicht genügend Geld. ($500)");
- }
- return 1;
- }
- if (strcmp("/lottohelp", cmdtext, true, 10) == 0)
- {
- ShowPlayerDialog(playerid,DIALOG_LOTTOHELP,DIALOG_STYLE_MSGBOX,"{FFFFFF}Lotto Hilfe","{FFFFFF}-Schreiben Sie /lotto um Lotto zu spielen.\n\n-Es kostet nur $500\n\nImmer wieder in 10 Minuten wird Lotto gestartet.","OK","");
- }
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- return 1;
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- return 1;
- }
- public OnPlayerStreamOut(playerid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamOut(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_LOTTO)
- {
- if(response == 1)
- {
- if(strval(inputtext) > 100 || strval(inputtext) <= 0)
- {
- SendClientMessage(playerid,COLOR_RED,"Bitte geben Sie eine gültige Lotto Zahl ein. (1-100)");
- }
- else {
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- if(pLottoNumber[i] == strval(inputtext))
- {
- SendClientMessage(playerid,COLOR_RED,"Die Zahl wurde schon vergeben. Bitte probieren Sie andere Zahl.");
- }
- else
- {
- new str[128];
- format(str,sizeof(str),"Sie haben erfolgreich Lotto gespielt. Lotto Zahl: %d",strval(inputtext));
- Gespielt[playerid] = true;
- pLottoNumber[playerid] = strval(inputtext);
- }
- }
- }
- }
- if(response == 0)
- {
- SendClientMessage(playerid,COLOR_RED,"Lotto wurde nicht Gespiel. (Abgebrochen)");
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- public LottoMessage()
- {
- new rand = random(sizeof(RandJackpot));
- Jackpot = rand;
- new str[128], string[128];
- format(str,sizeof(str),"Das heutige Jackpot ist : %d",Jackpot);
- format(string,sizeof(string),"~w~Jackpot: ~g~%d",Jackpot);
- SendClientMessageToAll(COLOR_GREEN,"Schreiben Sie /lotto um Lotto für $500 zu spielen. Hilfe: /lottohelp");
- SendClientMessageToAll(COLOR_GREEN,str);
- GameTextForAll(string,5000,3);
- return 1;
- }
- public LottoStart()
- {
- new rand = random(sizeof(RandomLottoNumber));
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- if(rand == pLottoNumber[i])
- {
- GivePlayerMoney(i,Jackpot);
- SendClientMessage(i,COLOR_GREEN,"Herzlichen Glückwunsch, sie haben das Lotto gewonnen.");
- new str[128];
- format(str,sizeof(str),"~w~Lotto Winner: ~g~%s~n~~w~Lotto Zahl: ~g~%d",i,rand);
- GameTextForAll(str,7000,3);
- pLottoNumber[i] = 102;
- Gespielt[i] = false;
- } else {
- GameTextForAll("~w~Lotto: ~r~No Winner",5000,3);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement