Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2011
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.21 KB | None | 0 0
  1. // Includes
  2. #include <a_samp>
  3.  
  4. #define DIALOG_LOTTO 400
  5. #define DIALOG_LOTTOHELP 401
  6.  
  7. #define COLOR_RED 0x0000FFFF
  8. #define COLOR_GREEN 0x0FFF00FF
  9. #define COLOR_WHITE 0xFFFFFFFF
  10. #define COLOR_YELLOW 0xFFFA00FF
  11.  
  12. #pragma unused RandJackpot
  13. #pragma unused RandomLottoNumber
  14.  
  15. new RandomLottoNumber[100];
  16. new pLottoNumber[MAX_PLAYERS];
  17. new RandJackpot[][1] = {
  18. {124757},
  19. {1200000},
  20. {500000},
  21. {305478},
  22. {485001},
  23. {1500000},
  24. {80001},
  25. {788900}
  26. };
  27. new Jackpot;
  28. new bool:Gespielt[MAX_PLAYERS];
  29.  
  30. forward LottoStart();
  31. forward LottoMessage();
  32.  
  33. public OnFilterScriptInit()
  34. {
  35. print("\n--------------------------------------");
  36. print(" Lotto System German by Lazoking");
  37. print("--------------------------------------\n");
  38.  
  39. SetTimer("LottoStart",600000,1); // Lotto wird immer in 10 Minuten gestartet.
  40. SetTimer("LottoMessage",540000,1);
  41. return 1;
  42. }
  43.  
  44. public OnFilterScriptExit()
  45. {
  46. return 1;
  47. }
  48.  
  49. public OnPlayerConnect(playerid)
  50. {
  51. pLottoNumber[playerid] = 102;
  52. Gespielt[playerid] = false;
  53. return 1;
  54. }
  55.  
  56. public OnPlayerDisconnect(playerid, reason)
  57. {
  58. return 1;
  59. }
  60.  
  61. public OnPlayerSpawn(playerid)
  62. {
  63. return 1;
  64. }
  65.  
  66. public OnPlayerDeath(playerid, killerid, reason)
  67. {
  68. return 1;
  69. }
  70.  
  71. public OnVehicleSpawn(vehicleid)
  72. {
  73. return 1;
  74. }
  75.  
  76. public OnVehicleDeath(vehicleid, killerid)
  77. {
  78. return 1;
  79. }
  80.  
  81. public OnPlayerText(playerid, text[])
  82. {
  83. return 1;
  84. }
  85.  
  86. public OnPlayerCommandText(playerid, cmdtext[])
  87. {
  88. if (strcmp("/lotto", cmdtext, true, 10) == 0)
  89. {
  90. new pMoney = GetPlayerMoney(playerid);
  91. if(pMoney >= 500)
  92. {
  93. if(Gespielt[playerid] == false)
  94. {
  95. ShowPlayerDialog(playerid,DIALOG_LOTTO,DIALOG_STYLE_INPUT,"Lotto spielen","Geben Sie das gewünschte Lotto Zahl (zwischen 1-100)","Spielen","Abbrechen");
  96. }
  97. if(Gespielt[playerid] == true)
  98. {
  99. new str[128];
  100. format(str,sizeof(str),"Sie haben schon Lotto gespielt. Lotto Zahl: %d",pLottoNumber);
  101. SendClientMessage(playerid,COLOR_RED,str);
  102. }
  103. }
  104. else {
  105. SendClientMessage(playerid,COLOR_RED,"Sie haben nicht genügend Geld. ($500)");
  106. }
  107. return 1;
  108. }
  109. if (strcmp("/lottohelp", cmdtext, true, 10) == 0)
  110. {
  111. 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","");
  112. }
  113. return 0;
  114. }
  115.  
  116. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  117. {
  118. return 1;
  119. }
  120.  
  121. public OnPlayerExitVehicle(playerid, vehicleid)
  122. {
  123. return 1;
  124. }
  125.  
  126. public OnPlayerStateChange(playerid, newstate, oldstate)
  127. {
  128. return 1;
  129. }
  130.  
  131. public OnPlayerEnterCheckpoint(playerid)
  132. {
  133. return 1;
  134. }
  135.  
  136. public OnPlayerLeaveCheckpoint(playerid)
  137. {
  138. return 1;
  139. }
  140.  
  141. public OnPlayerEnterRaceCheckpoint(playerid)
  142. {
  143. return 1;
  144. }
  145.  
  146. public OnPlayerLeaveRaceCheckpoint(playerid)
  147. {
  148. return 1;
  149. }
  150.  
  151. public OnRconCommand(cmd[])
  152. {
  153. return 1;
  154. }
  155.  
  156. public OnPlayerRequestSpawn(playerid)
  157. {
  158. return 1;
  159. }
  160.  
  161. public OnObjectMoved(objectid)
  162. {
  163. return 1;
  164. }
  165.  
  166. public OnPlayerObjectMoved(playerid, objectid)
  167. {
  168. return 1;
  169. }
  170.  
  171. public OnPlayerPickUpPickup(playerid, pickupid)
  172. {
  173. return 1;
  174. }
  175.  
  176. public OnVehicleMod(playerid, vehicleid, componentid)
  177. {
  178. return 1;
  179. }
  180.  
  181. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  182. {
  183. return 1;
  184. }
  185.  
  186. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  187. {
  188. return 1;
  189. }
  190.  
  191. public OnPlayerSelectedMenuRow(playerid, row)
  192. {
  193. return 1;
  194. }
  195.  
  196. public OnPlayerExitedMenu(playerid)
  197. {
  198. return 1;
  199. }
  200.  
  201. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  202. {
  203. return 1;
  204. }
  205.  
  206. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  207. {
  208. return 1;
  209. }
  210.  
  211. public OnRconLoginAttempt(ip[], password[], success)
  212. {
  213. return 1;
  214. }
  215.  
  216. public OnPlayerUpdate(playerid)
  217. {
  218. return 1;
  219. }
  220.  
  221. public OnPlayerStreamIn(playerid, forplayerid)
  222. {
  223. return 1;
  224. }
  225.  
  226. public OnPlayerStreamOut(playerid, forplayerid)
  227. {
  228. return 1;
  229. }
  230.  
  231. public OnVehicleStreamIn(vehicleid, forplayerid)
  232. {
  233. return 1;
  234. }
  235.  
  236. public OnVehicleStreamOut(vehicleid, forplayerid)
  237. {
  238. return 1;
  239. }
  240.  
  241. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  242. {
  243. if(dialogid == DIALOG_LOTTO)
  244. {
  245. if(response == 1)
  246. {
  247. if(strval(inputtext) > 100 || strval(inputtext) <= 0)
  248. {
  249. SendClientMessage(playerid,COLOR_RED,"Bitte geben Sie eine gültige Lotto Zahl ein. (1-100)");
  250. }
  251. else {
  252. for(new i=0; i<MAX_PLAYERS; i++)
  253. {
  254. if(pLottoNumber[i] == strval(inputtext))
  255. {
  256. SendClientMessage(playerid,COLOR_RED,"Die Zahl wurde schon vergeben. Bitte probieren Sie andere Zahl.");
  257. }
  258. else
  259. {
  260. new str[128];
  261. format(str,sizeof(str),"Sie haben erfolgreich Lotto gespielt. Lotto Zahl: %d",strval(inputtext));
  262. Gespielt[playerid] = true;
  263. pLottoNumber[playerid] = strval(inputtext);
  264. }
  265. }
  266. }
  267. }
  268. if(response == 0)
  269. {
  270. SendClientMessage(playerid,COLOR_RED,"Lotto wurde nicht Gespiel. (Abgebrochen)");
  271. }
  272. }
  273. return 1;
  274. }
  275.  
  276. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  277. {
  278. return 1;
  279. }
  280.  
  281. public LottoMessage()
  282. {
  283. new rand = random(sizeof(RandJackpot));
  284. Jackpot = rand;
  285.  
  286. new str[128], string[128];
  287. format(str,sizeof(str),"Das heutige Jackpot ist : %d",Jackpot);
  288. format(string,sizeof(string),"~w~Jackpot: ~g~%d",Jackpot);
  289. SendClientMessageToAll(COLOR_GREEN,"Schreiben Sie /lotto um Lotto für $500 zu spielen. Hilfe: /lottohelp");
  290. SendClientMessageToAll(COLOR_GREEN,str);
  291. GameTextForAll(string,5000,3);
  292. return 1;
  293. }
  294.  
  295. public LottoStart()
  296. {
  297. new rand = random(sizeof(RandomLottoNumber));
  298. for(new i=0; i<MAX_PLAYERS; i++)
  299. {
  300. if(rand == pLottoNumber[i])
  301. {
  302. GivePlayerMoney(i,Jackpot);
  303. SendClientMessage(i,COLOR_GREEN,"Herzlichen Glückwunsch, sie haben das Lotto gewonnen.");
  304. new str[128];
  305. format(str,sizeof(str),"~w~Lotto Winner: ~g~%s~n~~w~Lotto Zahl: ~g~%d",i,rand);
  306. GameTextForAll(str,7000,3);
  307. pLottoNumber[i] = 102;
  308. Gespielt[i] = false;
  309. } else {
  310. GameTextForAll("~w~Lotto: ~r~No Winner",5000,3);
  311. }
  312. }
  313. return 1;
  314. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement