Guest User

Untitled

a guest
Jun 16th, 2012
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.50 KB | None | 0 0
  1. #define FILTERSCRIPT
  2. #include <a_samp>
  3. #include <ZCMD>
  4. #include <sscanf2>
  5. #include <streamer>
  6.  
  7. #define COLOR_GREEN 0x008000AA
  8. #define COLOR_GREY 0xAFAFAFAA
  9. #define COLOR_YELLOW 0xDABB3E00
  10.  
  11. enum wInfo
  12. {
  13. wPlanted,
  14. wTime,
  15. wObject,
  16. Float:wX,
  17. Float:wY,
  18. Float:wZ,
  19. wWeed
  20. };
  21.  
  22. new WeedInfo[50][wInfo];
  23.  
  24. stock GetName(playerid)
  25. {
  26. new Name[MAX_PLAYER_NAME];
  27. if(IsPlayerConnected(playerid))
  28. {
  29. GetPlayerName(playerid, Name, sizeof(Name));
  30. }
  31. return Name;
  32. }
  33.  
  34. stock DrugLimitLeft(playerid,type)
  35. {
  36. new amountcheck,amount;
  37. switch(type)
  38. {
  39. case 1: // Weed
  40. {
  41. amountcheck = WeedInfo[playerid][wWeed];
  42. }
  43. }
  44. amount = 50 - amountcheck;
  45. return amount;
  46. }
  47.  
  48. stock DrugLimit(playerid,amount,type)
  49. {
  50. new amountcheck;
  51. switch(type)
  52. {
  53. case 1: // Weed
  54. {
  55. amountcheck = amount + WeedInfo[playerid][wWeed];
  56. }
  57. }
  58. if(amountcheck < 51)
  59. {
  60. return 1;
  61. }
  62. return 0;
  63. }
  64.  
  65. public OnFilterScriptInit()
  66. {
  67. print("\n--------------------------------------");
  68. print(" Blank Filterscript by your name here");
  69. print("--------------------------------------\n");
  70. return 1;
  71. }
  72.  
  73. public OnFilterScriptExit()
  74. {
  75. return 1;
  76. }
  77.  
  78.  
  79. main()
  80. {
  81.  
  82. }
  83.  
  84.  
  85. COMMAND:drugs(playerid, params[])
  86. {
  87. new usage[128], type[128], targetid, amount, string[128];
  88. if(sscanf(params, "s[128]S(none)[128]U(999)I(0)", usage, type, targetid, amount)) SendClientMessage(playerid, COLOR_GREEN, "USAGE: /drugs [use/give/plant/pick/combine]");
  89. else
  90. {
  91. if(strcmp(usage, "use", true) == 0) if(strcmp(type, "none", true) == 0) return SendClientMessage(playerid, COLOR_GREEN, "USAGE: /drugs [use] [cocaine/crack/weed]");
  92. if(strcmp(usage, "give", true) == 0) if(targetid == 999 || amount == 0) return SendClientMessage(playerid, COLOR_GREEN, "USAGE: /drugs [give] [cocaine/crack/weed] [playerid] [amount]");
  93. if(strcmp(usage, "plant", true) == 0)
  94. {
  95. if (GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You must be on foot to use this.");
  96. if (GetPlayerInterior(playerid) != 0) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You must be outside to use this.");
  97. for(new weed = 0; weed < sizeof(WeedInfo); weed++)
  98. {
  99. if(WeedInfo[weed][wPlanted] == 0 && WeedInfo[weed][wTime] == 0)
  100. {
  101. new Float:X,Float:Y,Float:Z;
  102. ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
  103. GetPlayerPos(playerid, X, Y, Z);
  104. WeedInfo[weed][wObject] = CreateDynamicObject(3409, X, Y, Z-2.0, 0, 0, 0, 0);
  105. WeedInfo[weed][wX] = X;
  106. WeedInfo[weed][wY] = Y;
  107. WeedInfo[weed][wZ] = Z;
  108. WeedInfo[weed][wTime] = 60;
  109. WeedInfo[weed][wPlanted] = 1;
  110. SendClientMessage(playerid,COLOR_GREEN,"INFO: You have planted your weed plant it will be ready to /drugs pick in 'X amount' of time.");
  111. return 1;
  112. }
  113. }
  114. }
  115. else if(strcmp(usage, "pick", true) == 0)
  116. {
  117. if (GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You must be on foot to use this.");
  118. for(new weed = 0; weed < sizeof(WeedInfo); weed++)
  119. {
  120. if(IsPlayerInRangeOfPoint(playerid,2.0,WeedInfo[weed][wX],WeedInfo[weed][wY],WeedInfo[weed][wZ]))
  121. {
  122. if(WeedInfo[weed][wPlanted] == 1 && WeedInfo[weed][wX] != 0.0 && WeedInfo[weed][wY] != 0.0 && WeedInfo[weed][wZ] != 0.0)
  123. {
  124. if (WeedInfo[weed][wTime] >= 0) return SendClientMessage(playerid, COLOR_YELLOW, "INFO: This plant is not ready to be picked yet.");
  125. if (DrugLimit(playerid,30,1))
  126. {
  127. format(string, sizeof(string), "INFO: You cannot hold this amount of weed grams in your hand, can only hold %d more grams.", DrugLimitLeft(playerid,1));
  128. SendClientMessage(playerid, COLOR_GREY, string);
  129. return 1;
  130. }
  131. ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
  132. DestroyDynamicObject(WeedInfo[weed][wObject]);
  133. WeedInfo[weed][wX] = 0.0;
  134. WeedInfo[weed][wY] = 0.0;
  135. WeedInfo[weed][wZ] = 0.0;
  136. WeedInfo[weed][wPlanted] = 0;
  137. SendClientMessage(playerid,COLOR_GREEN,"INFO: You have picked up this plant.");
  138. return 1;
  139. }
  140. }
  141. }
  142. }
  143. }
  144. return 1;
  145. }
  146.  
  147.  
  148. COMMAND:drughelp(playerid, params[])
  149. {
  150. SendClientMessage(playerid, COLOR_GREY, "USAGE: /drugs");
  151. return 1;
  152. }
Advertisement
Add Comment
Please, Sign In to add comment