1
0

growing.inc 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. CMD:checkweed(playerid, params[])
  2. {
  3. new weed = IsPlayerNearWeed(playerid);
  4. if(weed == -1) return SendClientMessage(playerid, COLOR_GREY, "You are not near any plants.");
  5. ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant_In", 4.0, 0, 0, 0, 0, 0);
  6. new str[128];
  7. format(str, sizeof(str), "* %s inspects the weed plant.", PlayerICName(playerid));
  8. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  9. format(str, sizeof(str), "This plant has %d weed grams.", WeedInfo[weed][WeedGrams]);
  10. SendClientMessage(playerid, COLOR_GREEN, str);
  11. return 1;
  12. }
  13. CMD:pickweed(playerid, params[])
  14. {
  15. new weed = IsPlayerNearWeed(playerid), str[128];
  16. if(weed == -1) return SendClientMessage(playerid, COLOR_GREY, "You are not near any plants.");
  17. if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_GREY, "You must be on foot to pick weed.");
  18. if(GotPlant[playerid] >= 1)
  19. {
  20. if(OldWeedX[playerid] != 0.0 && OldWeedY[playerid] != 0.0)
  21. {
  22. if(!IsPlayerInRangeOfPoint(playerid, 120.0, OldWeedX[playerid], OldWeedY[playerid], OldWeedZ[playerid]))
  23. {
  24. format(str, sizeof(str), "Teleport: [%d]%s is potentially Teleport Pickweeding.", playerid, PlayerICName(playerid));
  25. UpdateWarnings(str);
  26. return 1;
  27. }
  28. }
  29. }
  30. if(PlayerTied[playerid] || PlayerCuffed[playerid] || PlayerTazed[playerid] || PlayerFrozen[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You can't do that at this time.");
  31. if(WeedPickTimer[playerid])
  32. return SendClientMessage(playerid, COLOR_GREY, "You must wait 3 seconds before picking weed again.");
  33. if(WeedInfo[weed][WeedTime] < 2)
  34. return SendClientMessage(playerid, COLOR_GREY, "This plant is not ready to be picked, please wait at least 2 minutes for it to grow.");
  35. GetPlayerPos(playerid, WeedPickPosition[playerid][PosX], WeedPickPosition[playerid][PosY], WeedPickPosition[playerid][PosZ]);
  36. WeedPickTimer[playerid] = 1;
  37. format(str, sizeof(str), "* %s begins picking a weed plant.", PlayerICName(playerid));
  38. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  39. SetTimerEx("Timer_WeedPick", 7000, 0, "ii", playerid, weed);
  40. return 1;
  41. }
  42. CMD:plantweed(playerid, params[])
  43. {
  44. new str[128];
  45. if(PlayerInfo[playerid][pPotSeeds] < 10) return SendClientMessage(playerid, COLOR_GREY, "You need 10 seeds to plant your weed.");
  46. if(PlayerInfo[playerid][pPlantTime] > 0)
  47. {
  48. format(str, sizeof(str), "Please wait %d seconds before planting weed again.", PlayerInfo[playerid][pPlantTime]);
  49. return SendClientMessage(playerid, COLOR_GREY, str);
  50. }
  51. for(new weed = 0; weed < sizeof(WeedInfo); weed++)
  52. {
  53. if(WeedInfo[weed][WeedPlanted] == 0)
  54. {
  55. new Float:X2, Float:Y2, Float:Z2, Float:V;
  56. GetPlayerVelocity(playerid, X2, Y2, Z2);
  57. V = floatsqroot(floatpower(X2, 2) + floatpower(Y2, 2) + floatpower(Z2, 2));
  58. if(V > 0.05)
  59. {
  60. SendClientMessage(playerid, COLOR_GREY, "You must stop moving to plant your seeds.");
  61. return 1;
  62. }
  63. if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_GREY, "You must be on foot to plant your seeds.");
  64. if(GetPlayerInterior(playerid) != 0) return SendClientMessage(playerid, COLOR_GREY, "You must be outside to plant your seeds.");
  65. if(GetPlayerVirtualWorld(playerid) != 0) return SendClientMessage(playerid, COLOR_GREY, "You must not be in a virtual world to plant your seeds.");
  66. if(PlayerInfo[playerid][pJob] == 4 || PlayerInfo[playerid][pDonateRank] >= 3)
  67. {
  68. GetPlayerPos(playerid, X2, Y2, Z2);
  69. new playername[MAX_PLAYER_NAME];
  70. GetPlayerICName(playerid, playername, 24);
  71. ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant_In", 4.0, 0, 0, 0, 0, 0);
  72. weedObject[weed] = CreateDynamicObject(3409, X2, Y2, Z2 -2, 0, 0, 0);
  73. Streamer_Update(playerid);
  74. PlayerInfo[playerid][pPlantTime] = 1200;
  75. if(PlayerInfo[playerid][pAdmin] >= 1337)
  76. {
  77. PlayerInfo[playerid][pPlantTime] = 0;
  78. }
  79. WeedInfo[weed][WeedX] = X2;
  80. WeedInfo[weed][WeedY] = Y2;
  81. WeedInfo[weed][WeedZ] = Z2;
  82. WeedInfo[weed][WeedTime] = 0;
  83. WeedInfo[weed][WeedGrams] = 0;
  84. WeedInfo[weed][WeedPlanted] = 1;
  85. strmid(WeedInfo[weed][WeedPlanter], playername, 0, strlen(playername), 50);
  86. format(str, sizeof(str), "* %s plants some seeds.", PlayerICName(playerid));
  87. ProxDetector(30.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  88. SendClientMessage(playerid, COLOR_GREEN, "You have planted your seeds! Every minute, your plant will make one gram of weed.");
  89. SendClientMessage(playerid, COLOR_GREEN, "If your plant isn't picked within 70 minutes, it will rot and you will lose it.");
  90. SendClientMessage(playerid, COLOR_GREEN, "Also remember that anyone can /pickweed if they find your plant, so be careful.");
  91. PlayerInfo[playerid][pPotSeeds] -= 10;
  92. break;
  93. }
  94. else return SendClientMessage(playerid, COLOR_GREY, "You are not a Drug Dealer/Gold VIP.");
  95. }
  96. }
  97. return 1;
  98. }
  99. // Admin cmds
  100. CMD:setwt(playerid, params[])
  101. {
  102. if(PlayerInfo[playerid][pAdmin] < 1337)
  103. return AdmErrorMsg;
  104. new weedid, time;
  105. if(sscanf(params, "ii", weedid, time))
  106. return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setwt [ID] [time]");
  107. WeedInfo[weedid][WeedTime] = time;
  108. new str[128];
  109. format(str, sizeof(str), "You have set weedid %d time to %d.", weedid, time);
  110. SendClientMessage(playerid, COLOR_GRAD1, str);
  111. return 1;
  112. }