Advertisement
Guest User

Untitled

a guest
Jul 12th, 2010
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. #define FILTERSCRIPT
  2.  
  3. #include <a_samp>
  4.  
  5. #if defined FILTERSCRIPT
  6.  
  7. #define COLOR_PINK 0xFF66FFAA
  8. #define COLOR_GREEN 0x18FF18FF
  9. #define COLOR_BLUE 0x0000FFFF
  10. #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  11. new Horse[MAX_PLAYERS];
  12. public OnFilterScriptInit()
  13. {
  14. print("\n--------------------------------------");
  15. print(" Horse Bets by WillsuckformoneY");
  16. print("--------------------------------------\n");
  17. return 1;
  18. }
  19.  
  20. public OnFilterScriptExit()
  21. {
  22. return 1;
  23. }
  24.  
  25. #endif
  26.  
  27. public OnPlayerDisconnect(playerid, reason)
  28. {
  29. Horse[playerid]=0;
  30. return 1;
  31. }
  32.  
  33. public OnPlayerCommandText(playerid, cmdtext[])
  34. {
  35. dcmd(hbet, 4, cmdtext);
  36. return 0;
  37. }
  38.  
  39. dcmd_hbet(playerid, params[]) {
  40. new Index, tmp[256]; tmp=strtok(params, Index);
  41. if(!strlen(tmp)||strval(tmp)<1||strval(tmp)>3) return SendClientMessage(playerid,COLOR_PINK,"FAIL! Do /Bet [1 - 3]");
  42. switch(strval(tmp))
  43. {
  44. case 1:
  45. {
  46. SendClientMessage(playerid, COLOR_BLUE, "You Selected Horse 1");
  47. GivePlayerMoney(playerid, -100);
  48. SetTimerEx("BETS", 60000, 0, "d", playerid);
  49. Horse[playerid]=1;
  50. }
  51. case 2:
  52. {
  53. SendClientMessage(playerid, COLOR_BLUE, "You Selected Horse 2");
  54. GivePlayerMoney(playerid, -200);
  55. SetTimerEx("BETS", 60000, 0, "d", playerid);
  56. Horse[playerid]=2;
  57. }
  58. case 3:
  59. {
  60. SendClientMessage(playerid, COLOR_BLUE, "You Selected Horse 3");
  61. GivePlayerMoney(playerid, -300);
  62. SetTimerEx("BETS", 60000, 0, "d", playerid);
  63. Horse[playerid]=3;
  64. }
  65. }
  66. return 1;
  67. }
  68.  
  69. forward BETS(playerid);
  70. public BETS(playerid)
  71. {
  72. new Num;
  73. Num=random(3)+1;
  74. if(Num==Horse[playerid])
  75. {
  76. switch(Horse[playerid])
  77. {
  78. case 1: { GivePlayerMoney(playerid, 200); SendClientMessage(playerid, COLOR_PINK, "Congratulations, You won $200 From your Horse Bet"); }
  79. case 2: { GivePlayerMoney(playerid, 400); SendClientMessage(playerid, COLOR_PINK, "Congratulations, You won $400 From your Horse Bet"); }
  80. case 3: { GivePlayerMoney(playerid, 600); SendClientMessage(playerid, COLOR_PINK, "Congratulations, You won $600 From your Horse Bet"); }
  81. }
  82. }
  83. else
  84. {
  85. SendClientMessage(playerid, COLOR_GREEN, "Sorry! You did NOT win From your Horse Bet, Better luck next time!!");
  86. }
  87. return 1;
  88. }
  89.  
  90.  
  91. strtok(const string[], &index)
  92. {
  93. new length = strlen(string);
  94. while ((index < length) && (string[index] <= ' '))
  95. {
  96. index++;
  97. }
  98.  
  99. new offset = index;
  100. new result[20];
  101. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  102. {
  103. result[index - offset] = string[index];
  104. index++;
  105. }
  106. result[index - offset] = EOS;
  107. return result;
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement