Fitri_Fahim

Moneybag Event

Apr 16th, 2013
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 9.01 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. //created on 12/1/2013
  4.  
  5.  
  6. #include <a_samp>
  7. #include <sscanf2>
  8. #include <streamer>
  9. #include <foreach>
  10. #include <zcmd>
  11.  
  12.  
  13. #pragma tabsize 0 //you will get loose internation
  14.  
  15. #define COLOR_BRIGHTRED 0xE60000FF
  16. #define COLOR_GREY 0xAFAFAFAA
  17. #define COLOR_GREEN 0x33AA33AA
  18. #define COLOR_RED 0xAA3333AA
  19. #define COLOR_YELLOW 0xFFFF00AA
  20. #define COLOR_WHITE 0xFFFFFFAA
  21. #define COLOR_PURPLE 0x9900FFAA
  22. #define COLOR_BROWN 0x993300AA
  23. #define COLOR_ORANGE 0xFF9933AA
  24. #define COLOUR_PINK 0xFF00FFFF
  25. #define COLOUR_PURPLE 0x800080FF
  26. #define COLOUR_BLACK 0x000000FF
  27. #define COLOR_CYAN 0x99FFFFAA
  28. #define COLOR_TAN 0xFFFFCCAA
  29. #define COLOR_PINK 0xFF66FFAA
  30. #define COLOR_KHAKI 0x999900AA
  31. #define COLOR_LIME 0x99FF00AA
  32. #define COLOR_BLACK 0x000000AA
  33. #define COLOR_TURQ 0x00A3C0AA
  34. #define COLOR_LIGHTBLUE 0x33CCFFAA
  35. #define COLOR_DARKRED 0xAA993333
  36. #define COLOR_VIOLET 0x9955DEEE
  37. #define NICE_BLUE 0xa0d3ffAA
  38. #define GREEN 0x21DD00FF
  39. #define RED 0xE60000FF
  40. #define ADMIN_RED 0xFB0000FF
  41. #define YELLOW 0xFFFF00FF
  42. #define ORANGE 0xF97804FF
  43. #define LIGHTRED 0xFF8080FF
  44. #define LIGHTBLUE 0x00C2ECFF
  45. #define PURPLE 0xB360FDFF
  46. #define PLAYER_COLOR 0xFFFFFFFF
  47. #define BLUE 0x1229FAFF
  48. #define LIGHTGREEN 0x38FF06FF
  49. #define DARKPINK 0xE100E1FF
  50. #define DARKGREEN 0x008040FF
  51. #define ANNOUNCEMENT 0x00CACAFB
  52. #define COLOR_SYSTEM 0xEFEFF7AA
  53. #define NICESKY 0x99FFFFAA
  54. #define GRAY 0xCECECEFF
  55. #define red 0xE60000FF
  56. #define yellow 0xFFFF00FF
  57. #define COLOR_ANTIHAX 0xE60000FF
  58.  
  59. #define COLOR_LIGHTBLUE 0x33CCFFAA
  60. #define COLOR_RED 0xAA3333AA
  61. #define COLOR_GREY 0xAFAFAFAA
  62. #define COLOR_YELLOW 0xFFFF00AA
  63. #define COLOR_PINK 0xFF66FFAA
  64. #define COLOR_BLUE 0x0000BBAA
  65. #define COLOR_WHITE 0xFFFFFFAA
  66. #define COLOR_INDIGO 0x4B00B0AA
  67. #define COLOR_VIOLET 0x9955DEEE
  68. #define COLOR_LIGHTRED 0xFF99AADD
  69. #define COLOR_SEAGREEN 0x00EEADDF
  70. #define COLOR_GRAYWHITE 0xEEEEFFC4
  71. #define COLOR_LIGHTNEUTRALBLUE 0xabcdef66
  72. #define COLOR_GREENISHGOLD 0xCCFFDD56
  73. #define COLOR_LIGHTBLUEGREEN 0x0FFDD349
  74. #define COLOR_NEUTRALBLUE 0xABCDEF01
  75. #define COLOR_LIGHTCYAN 0xAAFFCC33
  76. #define COLOR_LEMON 0xDDDD2357
  77. #define COLOR_MEDIUMBLUE 0x63AFF00A
  78. #define COLOR_NEUTRAL 0xABCDEF97
  79. #define COLOR_NEUTRALGREEN 0x81CFAB00
  80. #define COLOR_DARKGREEN 0x12900BBF
  81. #define COLOR_DARKBLUE 0x300FFAAB
  82. #define COLOR_BLUEGREEN 0x46BBAA00
  83. #define COLOR_PINK 0xFF66FFAA
  84. #define COLOR_LIGHTBLUE 0x33CCFFAA
  85. #define COLOR_GRAD1 0xB4B5B7FF
  86. #define COLOR_GRAD2 0xBFC0C2FF
  87. #define COLOR_GREY 0xAFAFAFAA
  88. #define COLOR_GREEN 0x33AA33AA
  89. #define COLOR_RED 0xAA3333AA
  90. #define COLOR_YELLOW 0xFFFF00AA
  91. #define COLOR_WHITE 0xFFFFFFAA
  92. #define COLOR_BROWN 0x993300AA
  93. #define COLOR_CYAN 0x99FFFFAA
  94. #define COLOR_TAN 0xFFFFCCAA
  95. #define COLOR_PINK 0xFF66FFAA
  96. #define COLOR_KHAKI 0x999900AA
  97. #define COLOR_LIME 0x99FF00AA
  98. #define COLOR_SYSTEM 0xEFEFF7AA
  99. #define COLOR_GRAD2 0xBFC0C2FF
  100. #define COLOR_GRAD4 0xD8D8D8FF
  101. #define COLOR_GRAD6 0xF0F0F0FF
  102. #define COLOR_GRAD2 0xBFC0C2FF
  103. #define COLOR_GRAD3 0xCBCCCEFF
  104. #define COLOR_GRAD5 0xE3E3E3FF
  105. #define COLOR_GRAD1 0xB4B5B7FF
  106. #define COLOR_GILE 0x924161FF
  107. // ADDED 6-2-2012 Embed 0.3c
  108. #define COL_EASY           "{FFF1AF}"
  109. #define COL_WHITE          "{FFFFFF}"
  110. #define COL_BLACK          "{0E0101}"
  111. #define COL_GREY           "{C3C3C3}"
  112. #define COL_GREEN          "{6EF83C}"
  113. #define COL_RED            "{F81414}"
  114. #define COL_YELLOW         "{F3FF02}"
  115. #define COL_ORANGE         "{FFAF00}"
  116. #define COL_LIME           "{B7FF00}"
  117. #define COL_CYAN           "{00FFEE}"
  118. #define COL_LIGHTBLUE      "{00C0FF}"
  119. #define COL_BLUE           "{0049FF}"
  120. #define COL_MAGENTA        "{F300FF}"
  121. #define COL_VIOLET         "{B700FF}"
  122. #define COL_PINK           "{FF00EA}"
  123. #define COL_MARONE         "{A90202}"
  124. #define COL_CMD            "{B8FF02}"
  125. #define COL_PARAM          "{3FCD02}"
  126. #define COL_SERVER         "{AFE7FF}"
  127. #define COL_VALUE          "{A3E4FF}"
  128. #define COL_RULE           "{F9E8B7}"
  129. #define COL_RULE2          "{FBDF89}"
  130. #define COL_RWHITE         "{FFFFFF}"
  131. #define COL_LGREEN         "{C9FFAB}"
  132. #define COL_LRED           "{FFA1A1}"
  133. #define COL_LRED2          "{C77D87}"
  134. #define COLOR_FAHIM        "{FF8000}"
  135.  
  136. public OnFilterScriptInit()
  137. {
  138.     print("\n--------------------------------------");
  139.     print(" Moneybag System By Aryzal");
  140.     print("--------------------------------------\n");
  141.     return 1;
  142. }
  143.  
  144.  
  145. #if !defined isnull
  146.     #define isnull(%1) \
  147.                 ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
  148.  
  149.  
  150.  
  151. new eventcp ,
  152.     eventcppickup ,
  153.     Float:eventcpx,
  154.     Float:eventcpy,
  155.     Float:eventcpz ,
  156.     eventcpdaset ,
  157.     eventreward ,
  158.     Text3D:eventmtext,
  159.     eventstart ,
  160.     eventformattext[128];
  161.  
  162. CMD:createmb(playerid,params[])
  163. {
  164.    if(IsPlayerAdmin(playerid)) // This will check if the player is admin. (The code [if] checks IF something is true.
  165.     {
  166.      new Float:x,Float:y,Float:z , f[128] ,amount;
  167.      if(sscanf(params,"i",amount)) return  SendClientMessage(playerid,-1,"stynx usage /createmb [price reward(number only)]");
  168.      if(eventcpdaset == 1) return  SendClientMessage(playerid,-1,"| You Have Created One ! |");
  169.      else
  170.      {
  171.      GetPlayerPos(playerid,x,y,z);
  172.      eventreward = amount;
  173.      eventcpx = x;
  174.      eventcpy = y;
  175.      eventcpz = z;
  176.      eventcpdaset = 1;
  177.      format(f,sizeof(f),"you has set mb event cp at %d,%d,%d || reward : %d",x,y,z,amount);
  178.      SendClientMessage(playerid,-1,f);
  179.      }
  180.     }
  181.     else SendClientMessage(playerid, COLOR_RED, "ERROR:unknown command.. nice try use /help to see all commands"); // returning a err msg that he is not admin :L.
  182.     return 1; // you must i said it
  183. }
  184.  
  185. CMD:startmb(playerid,params[])
  186. {
  187.   if(IsPlayerAdmin(playerid)) // This will check if the player is admin. (The code [if] checks IF something is true.
  188.     {
  189.   new f[128];
  190.   if(isnull(params)) return SendClientMessage(playerid,-1,"stynx usage /startmb [name or words or clue or something nice xD]");
  191.   if(eventcpdaset == 0) return SendClientMessage(playerid,-1,"You Must Use /createmb to do this");
  192.   if(eventstart == 1)
  193.   {
  194.     format(f,128,"%s",eventformattext);
  195.     SendClientMessageToAll(-1,f);
  196.   }
  197.   if(eventstart == 0)
  198.   {
  199.     eventcppickup = CreateDynamicPickup(1550,1,eventcpx, eventcpy, eventcpz,-1,-1,-1,100.0);
  200.     eventcp = CreateDynamicCP(eventcpx, eventcpy, eventcpz,1,-1,-1,-1,1.0);
  201.     eventmtext = CreateDynamic3DTextLabel("> Here Is Moneybag<", 0xFF8040FF, eventcpx, eventcpy, eventcpz,3.0);
  202.     format(f,sizeof(f),"*** MoneyBagEvent(find the hidden moneybag) !!! at  {C9FFAB}%s{FFFFFF} |reward : %d ***={FF8040}REAL",params,eventreward);
  203.     eventformattext = f;
  204.     eventstart = 1;
  205.     SendClientMessageToAll(-1,f);
  206.      }
  207.     }
  208.     else SendClientMessage(playerid, COLOR_RED, "ERROR:unknown command.. nice try use /help to see all commands "); // returning a err msg that he is not admin :L.
  209.     return 1; // you must i said it
  210. }
  211.  
  212. CMD:gotomb(playerid,params[])
  213. {
  214.   if(IsPlayerAdmin(playerid)) // This will check if the player is admin. (The code [if] checks IF something is true.
  215.     {
  216.     SetPlayerPos(playerid,eventcpx, eventcpy+2, eventcpz);
  217.     }
  218.     else SendClientMessage(playerid, COLOR_RED, "ERROR:unknown command.. nice try use /help to see all commands "); // returning a err msg that he is not admin :L.
  219.     return 1; // you must i said it
  220. }
  221.  
  222. CMD:cancelmb(playerid,params[])
  223. {
  224.  if(IsPlayerAdmin(playerid)) // This will check if the player is admin. (The code [if] checks IF something is true.
  225.     {
  226.   if(eventcpdaset == 1)
  227.   {
  228.     eventcpdaset = 0;
  229.     eventstart = 0;
  230.     DestroyDynamicPickup(eventcppickup);
  231.     DestroyDynamicCP(eventcp);
  232.     DestroyDynamic3DTextLabel(eventmtext);
  233.     SendClientMessage(playerid,-1,"| kau da cancel event moneybags |");
  234.     }
  235.     else return SendClientMessage(playerid,-1,"you must create one moneybag to cancle it xD");
  236.      }
  237.     else SendClientMessage(playerid, COLOR_RED, "ERROR:unknown command.. nice try use /help to see all commands"); // returning a err msg that he is not admin :L.
  238.     return 1; // you must i said it
  239. }
  240.  
  241. public OnPlayerEnterDynamicCP(playerid, checkpointid)
  242. {
  243.   if(checkpointid == eventcp && IsValidDynamicCP(eventcp) && eventcpdaset == 1)
  244.   {
  245.     new f[128];
  246.     format(f,sizeof(f),"***%s has found the moneybag and won $%d (moneybag event over)***={FF8040}REAL ",GetName(playerid),eventreward);
  247.     SendClientMessageToAll(-1,f);
  248.     GivePlayerMoney(playerid,eventreward);
  249.     eventcpdaset = 0;
  250.     DestroyDynamicPickup(eventcppickup);
  251.     DestroyDynamicCP(eventcp);
  252.     DestroyDynamic3DTextLabel(eventmtext);
  253.     eventstart = 0;
  254.     PlaySoundForAll(36205 , 0.0, 0.0, 0.0);
  255.     return 1;
  256.   }
  257.   return 1;
  258. }
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265. PlaySoundForAll(soundid, Float:x, Float:y, Float:z)
  266. {
  267.     foreach(new i : Player)
  268.     {
  269.         if (IsPlayerConnected(i))
  270.         {
  271.             PlayerPlaySound(i, soundid, x, y, z);
  272.         }
  273.     }
  274. }
  275.  
  276. stock GetName(playerid)
  277. {
  278.     new
  279.         name[24];
  280.     GetPlayerName(playerid, name, sizeof(name));
  281.     //strreplace(name, '_', ' ';
  282.     return name;
  283. }
  284.  
  285. #endif
Add Comment
Please, Sign In to add comment