Guest User

Untitled

a guest
Dec 10th, 2014
1,073
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.97 KB | None | 0 0
  1. // By Elm0P2! :3
  2.  
  3. #include <a_samp>
  4.  
  5. //SETTINGS
  6. #define maxgm 100000
  7.  
  8. #define SCM SendClientMessage
  9. #define SCMTA SendClientMessageToAll
  10. new gift1rl, gift2rl, gift3rl, g1t, g2t, g3t, moneyfromgift, gift1rtimer, gift2rtimer, gift3rtimer;
  11.  
  12. public OnFilterScriptInit()
  13. {
  14. print("\n--------------------------------------");
  15. print(" Xmas hi!");
  16. print("--------------------------------------\n");
  17. gift1rtimer = 0;
  18. gift2rtimer = 0;
  19. gift3rtimer = 0;
  20. CreateObject(19076, 1520.90198, -1713.63379, 12.29951, 0.00000, 0.00000, 315.76364);
  21. CreateObject(19054, 1522.82361, -1711.22693, 13.13421, 0.00000, 0.00000, 0.00000);
  22. CreateObject(19054, 1522.82361, -1711.22693, 13.13421, 0.00000, 0.00000, 0.00000);
  23. CreateObject(19055, 1523.31885, -1713.22461, 13.03749, 0.00000, 0.00000, 0.00000);
  24. CreateObject(19056, 1521.84973, -1715.16028, 13.21254, 0.00000, 0.00000, 0.00000);
  25. gift2rl = _:Create3DTextLabel("[GIFT]\n This gift is avaliable", 0x33CCFFAA, 1524.2633,-1713.2318,13.5469, 15.0, 0, 0);
  26. gift3rl = _:Create3DTextLabel("[GIFT]\n This gift is avaliable", 0x33CCFFAA, 1522.8707,-1710.2765,13.5469, 15.0, 0, 0);
  27. gift1rl = _:Create3DTextLabel("[GIFT]\n This gift is avaliable", 0x33CCFFAA, 1521.7090,-1716.0947,13.5469, 40.0, 0, 0);
  28. return 1;
  29. }
  30.  
  31. public OnPlayerCommandText(playerid, cmdtext[])
  32. {
  33. if (strcmp("/giftinfo", cmdtext, true, 10) == 0)
  34. {
  35. new string[128];
  36. if(gift1rtimer == 0 && gift2rtimer == 0 && gift3rtimer ==0) return SCM(playerid, -1, "All gifts are ready!!");
  37. if(gift1rtimer != 0)
  38. {
  39. format(string,sizeof string,"Gift 1 will be ready in %d minutes",gift1rtimer);
  40. SCM(playerid, -1, string);
  41. }
  42. if(gift2rtimer != 0)
  43. {
  44. format(string,sizeof string,"Gift 2 will be ready in %d minutes",gift2rtimer);
  45. SCM(playerid, -1, string);
  46. }
  47. if(gift3rtimer != 0)
  48. {
  49. format(string,sizeof string,"Gift 3 will be ready in %d minutes",gift3rtimer);
  50. SCM(playerid, -1, string);
  51. }
  52. return 1;
  53. }
  54. if (strcmp("/opengift", cmdtext, true, 10) == 0)
  55. {
  56. moneyfromgift=random(maxgm);
  57. new string[256];
  58. if(IsPlayerInRangeOfPoint(playerid, 2.0, 1522.82361, -1711.22693, 13.13421))
  59. {
  60. if(gift1rtimer != 0) return SCM(playerid, -1, "That gift isnt ready!");
  61. GivePlayerMoney(playerid, moneyfromgift);
  62. format(string,sizeof string,"You opened gift and found %d $",moneyfromgift);
  63. SCM(playerid, -1, string);
  64. gift1rtimer = 30;
  65. Update3DTextLabelText(Text3D:gift3rl, 0x33CCFFAA, "[GIFT]\n This gift is not avaliable");
  66. g1t = SetTimer("GiftTimer1", 60000, true);
  67. }
  68. if(IsPlayerInRangeOfPoint(playerid, 2.0, 1523.31885, -1713.22461, 13.03749))
  69. {
  70. if(gift2rtimer != 0) return SCM(playerid, -1, "That gift isnt ready!");
  71. format(string,sizeof string,"You opened gift and found %d $",moneyfromgift);
  72. SCM(playerid, -1, string);
  73. GivePlayerMoney(playerid, moneyfromgift);
  74. gift2rtimer = 30;
  75. Update3DTextLabelText(Text3D:gift2rl, 0x33CCFFAA, "[GIFT]\n This gift is not avaliable");
  76. g2t = SetTimer("GiftTimer2", 60000, true);
  77. }
  78. if(IsPlayerInRangeOfPoint(playerid, 2.0, 1521.84973, -1715.16028, 13.21254))
  79. {
  80. if(gift3rtimer != 0) return SCM(playerid, -1, "That gift isnt ready!");
  81. format(string,sizeof string,"You opened gift and found %d $",moneyfromgift);
  82. SCM(playerid, -1, string);
  83. GivePlayerMoney(playerid, moneyfromgift);
  84. gift3rtimer = 30;
  85. Update3DTextLabelText(Text3D:gift1rl, 0x33CCFFAA, "[GIFT]\n This gift is not avaliable");
  86. g3t = SetTimer("GiftTimer3", 60000, true);
  87. }
  88. return 1;
  89. }
  90. if (strcmp("/teleport", cmdtext, true, 10) == 0)
  91. {
  92. SetPlayerPos(playerid, 1535.5300,-1713.3191,13.5469);
  93. SCM(playerid, -1, "Hohoho, Santa teleported you to tree");
  94. return 1;
  95. }
  96. if (strcmp("/resetgifts", cmdtext, true, 10) == 0)
  97. {
  98. if(!IsPlayerAdmin(playerid)) return SCM(playerid, 0x33CCFFAA, "Only admins!");
  99. SCMTA(-1, "Admin restarted gifts hurry!");
  100. Update3DTextLabelText(Text3D:gift3rl,0x33CCFFAA, "[GIFT]\n This gift is avaliable");
  101. Update3DTextLabelText(Text3D:gift2rl, 0x33CCFFAA, "[GIFT]\n This gift is avaliable");
  102. Update3DTextLabelText(Text3D:gift1rl, 0x33CCFFAA, "[GIFT]\n This gift is avaliable");
  103. KillTimer(g1t);
  104. KillTimer(g2t);
  105. KillTimer(g3t);
  106. gift1rtimer = 0, gift2rtimer = 0, gift3rtimer = 0;
  107. return 1;
  108. }
  109. return 0;
  110. }
  111.  
  112. forward GiftTimer1();
  113. public GiftTimer1()
  114. {
  115. if(gift1rtimer == 0)
  116. {
  117. KillTimer(g1t);
  118. Update3DTextLabelText(Text3D:gift3rl,0x33CCFFAA, "[GIFT]\n This gift is avaliable");
  119. }
  120. if(gift1rtimer != 0)
  121. {
  122. gift1rtimer--;
  123. }
  124. }
  125. forward GiftTimer2();
  126. public GiftTimer2()
  127. {
  128. if(gift1rtimer == 0)
  129. {
  130. KillTimer(g2t);
  131. Update3DTextLabelText(Text3D:gift2rl, 0x33CCFFAA, "[GIFT]\n This gift is avaliable");
  132. }
  133. if(gift2rtimer != 0)
  134. {
  135. gift2rtimer--;
  136. }
  137. }
  138. forward GiftTimer3();
  139. public GiftTimer3()
  140. {
  141. if(gift3rtimer == 0)
  142. {
  143. KillTimer(g3t);
  144. Update3DTextLabelText(Text3D:gift1rl, 0x33CCFFAA, "[GIFT]\n This gift is avaliable");
  145. }
  146. if(gift3rtimer != 0)
  147. {
  148. gift3rtimer--;
  149. }
  150. }
Advertisement
Add Comment
Please, Sign In to add comment