Advertisement
Guest User

plantação de maconha att

a guest
May 26th, 2017
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.62 KB | None | 0 0
  1. /***********************************
  2. Criado por Scorpion
  3. ************************************/
  4.  
  5. #define FILTERSCRIPT
  6. #include <a_samp>
  7. #include <zcmd>
  8. #include <DOF2>
  9. #include <streamer>
  10.  
  11. #define Plant "Plant/%s.ini"
  12.  
  13. //variaveis
  14.  
  15. enum checar{
  16. pNasceu,
  17. qMaconhas,
  18. sementes,
  19. Vendedor,
  20. lColher
  21. };
  22.  
  23. new Float:xx1[MAX_PLAYERS], Float:yy1[MAX_PLAYERS], Float:zz1[MAX_PLAYERS], Text3D:TextLabel[MAX_PLAYERS];
  24. new PlayerInfo[MAX_PLAYERS][checar];
  25. new p1[MAX_PLAYERS], p2[MAX_PLAYERS], p3[MAX_PLAYERS], p4[MAX_PLAYERS];
  26. new bool:Checar[MAX_PLAYERS];
  27.  
  28. //------------------------------------------------
  29.  
  30. public OnFilterScriptInit()
  31. {
  32. CreateActor(1, -1004.7302,-1076.6400,130.3164,88.4122);
  33. CreateObject(18259, -1006.71204, -1076.41211, 129.21440, 0.01930, -0.46160, -3.53840);
  34. Create3DTextLabel("Digite {00FF00}/ajudamaconha", -1, -1004.7302,-1076.6400,130.3164, 7, 0, 0);
  35. printf("\n-------->Plantacao de Maconha Iniciada<--------\n");
  36. return 1;
  37. }
  38.  
  39. public OnFilterScriptExit()
  40. {
  41. DOF2_Exit();
  42. return 1;
  43. }
  44.  
  45. public OnPlayerConnect(playerid)
  46. {
  47. if( !DOF2_FileExists(arquivo(playerid)) && !IsPlayerNPC(playerid) ){
  48. DOF2_CreateFile(arquivo(playerid));
  49. DOF2_SetInt( arquivo( playerid ), "Vendedor", 0);
  50. DOF2_SetInt( arquivo( playerid ), "qMaconhas", 0);
  51. DOF2_SetInt( arquivo( playerid ), "sementes", 0);
  52. DOF2_SaveFile();
  53. }
  54. PlayerInfo[playerid][pNasceu] = 0;
  55. Carregar(playerid);
  56. return 0;
  57. }
  58.  
  59. stock Carregar(playerid)
  60. {
  61. PlayerInfo[playerid][Vendedor] = DOF2_GetInt( arquivo(playerid), "Vendedor" );
  62. PlayerInfo[playerid][qMaconhas] = DOF2_GetInt( arquivo(playerid), "qMaconhas" );
  63. PlayerInfo[playerid][sementes] = DOF2_GetInt( arquivo(playerid), "sementes" );
  64. DOF2_SaveFile();
  65. return 1;
  66. }
  67.  
  68. public OnPlayerDisconnect(playerid, reason)
  69. {
  70. PlayerInfo[playerid][pNasceu] = 0;
  71. PlayerInfo[playerid][lColher] = 0;
  72. Checar[playerid] = false;
  73. DestroyDynamicObject(p1[playerid]);
  74. DestroyDynamicObject(p2[playerid]);
  75. DestroyDynamicObject(p3[playerid]);
  76. DestroyDynamicObject(p4[playerid]);
  77. Delete3DTextLabel(TextLabel[playerid]);
  78. Salvar(playerid);
  79. PlayerInfo[playerid][pNasceu] = 0;
  80. RemovePlayerAttachedObject(playerid, 3);
  81. return 0;
  82. }
  83.  
  84. stock Salvar(playerid)
  85. {
  86. DOF2_SetInt(arquivo(playerid), "Vendedor", PlayerInfo[playerid][Vendedor]);
  87. DOF2_SetInt(arquivo(playerid), "qMaconhas", PlayerInfo[playerid][qMaconhas]);
  88. DOF2_SetInt(arquivo(playerid), "sementes", PlayerInfo[playerid][sementes]);
  89. DOF2_SaveFile();
  90. return 1;
  91. }
  92.  
  93. public OnPlayerEnterCheckpoint(playerid)
  94. {
  95. if(Checar[playerid]){
  96. DisablePlayerCheckpoint(playerid);
  97. }
  98. return 0;
  99. }
  100.  
  101. CMD:vendermaconha(playerid)
  102. {
  103. new Float:pos[3], msg[128];
  104. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  105. if(PlayerInfo[playerid][Vendedor] == 0) return SendClientMessage(playerid, -1, "{FF0000}Você não é vendedor de maconha, digite /ajudamaconha!");
  106. if(PlayerInfo[playerid][qMaconhas] == 0) return SendClientMessage(playerid, -1, "{FF0000}Você não tem maconhas colhidas!");
  107. if(pos[0] >= -1011.1290 && pos[0] <= -1002.2682 && pos[1] <= -1070.0612 && pos[1] >= -1084.9889){
  108. new valor = PlayerInfo[playerid][qMaconhas] * 300;
  109. GivePlayerMoney(playerid, valor);
  110. format(msg, 128, "Você vendeu sua(s) maconha(s) e ganhou %d reais!", valor);
  111. SendClientMessage(playerid, 0x00FF00FF, msg);
  112. PlayerInfo[playerid][qMaconhas] = 0;
  113. }else{
  114. SendClientMessage(playerid, 0xFF0000FF, "Você não está na cabanda, digite /cabana para encontra-la!");
  115. }
  116. return 1;
  117. }
  118.  
  119. CMD:pegaremprego(playerid)
  120. {
  121. new Float:pos[3];
  122. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  123. if(PlayerInfo[playerid][Vendedor] == 1) return SendClientMessage(playerid, 0xFF0000FF, "Você já é vendedor de maconha!");
  124. if(pos[0] >= -1011.1290 && pos[0] <= -1002.2682 && pos[1] <= -1070.0612 && pos[1] >= -1084.9889){
  125. PlayerInfo[playerid][Vendedor] = 1;
  126. SendClientMessage(playerid, 0x00FF00FF, "Parabéns, agora você é um vendedor de maconhas!");
  127. }else{
  128. SendClientMessage(playerid, 0xFF0000FF, "Você não está na cabana, digite /cabana para encontra-la!");
  129. }
  130. return 1;
  131. }
  132.  
  133. CMD:pedircontas(playerid)
  134. {
  135. new Float:pos[3];
  136. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  137. if(PlayerInfo[playerid][Vendedor] == 0) return SendClientMessage(playerid, 0xFF0000FF, "Você não é vendedor de maconhas para usar este comando!");
  138. if(pos[0] >= -1011.1290 && pos[0] <= -1002.2682 && pos[1] <= -1070.0612 && pos[1] >= -1084.9889){
  139. PlayerInfo[playerid][Vendedor] = 0;
  140. SendClientMessage(playerid, 0x00FF00FF, "Emprego deixado com sucesso!");
  141. }else{
  142. SendClientMessage(playerid, 0xFF0000FF, "Você não está na cabana, digite /cabana para encontra-la!");
  143. }
  144. return 1;
  145. }
  146.  
  147. CMD:cabana(playerid)
  148. {
  149. SetPlayerCheckpoint(playerid, -1004.7302,-1076.6400,130.3164, 3.0);
  150. SendClientMessage(playerid, 0x00FF00FF, "CheckPoint criado! Siga a marcação vermelha em seu radar!");
  151. Checar[playerid] = true;
  152. return 1;
  153. }
  154.  
  155. CMD:comprarsementes(playerid)
  156. {
  157. new Float:pos[3];
  158. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  159. if(PlayerInfo[playerid][Vendedor] == 0) return SendClientMessage(playerid, -1, "{FF0000}Você não é vendedor de maconha, digite /ajudamaconha!");
  160. if(din(playerid) < 100) return SendClientMessage(playerid, -1, "{FF0000}Você não tem dinheiro para comprar sementes! valor 100R$");
  161. if(pos[0] >= -1011.1290 && pos[0] <= -1002.2682 && pos[1] <= -1070.0612 && pos[1] >= -1084.9889){
  162. GivePlayerMoney(playerid, -100);
  163. PlayerInfo[playerid][sementes] = PlayerInfo[playerid][sementes] + 5;
  164. SendClientMessage(playerid, 0x00FF00FF, "Você comprou 5 sementes! Agora você pode plantar!");
  165. }else{
  166. SendClientMessage(playerid, 0xFF0000FF, "Você não está na cabana, digite /cabana para encontra-la!");
  167. }
  168. return 1;
  169. }
  170.  
  171. CMD:plantarmaconha(playerid)
  172. {
  173. new msgmaconha[128];
  174. if(PlayerInfo[playerid][Vendedor] == 0) return SendClientMessage(playerid, -1, "{FF0000}Você não é vendedor de maconha, digite /ajudamaconha!");
  175. if(PlayerInfo[playerid][sementes] <= 0) return SendClientMessage(playerid, -1, "{FF0000}Você não tem sementes, digite /ajudamaconha!");
  176. if(PlayerInfo[playerid][pNasceu] != 2 && PlayerInfo[playerid][pNasceu] != 1){
  177. if(!IsPlayerInAnyVehicle(playerid)){
  178. GetPlayerPos(playerid, xx1[playerid], yy1[playerid], zz1[playerid]);
  179. if ( xx1[playerid] >= -1190.2493 && xx1[playerid] <= -1006.7014 && yy1[playerid] <= -915.4045 && yy1[playerid] >= -1062.7966 ){
  180. ApplyAnimation(playerid,"BOMBER","BOM_Plant_Loop",2.0,1,0,0,0,3000);
  181. SendClientMessage(playerid, -1, "{00FF00}Você acaba de plantar uma maconha!");
  182. p1[playerid] = CreateDynamicObject(822, xx1[playerid]+1, yy1[playerid]+1, 120, 0, 0, 0, 0, 0, 10000);
  183. p2[playerid] = CreateDynamicObject(822, xx1[playerid]-1, yy1[playerid]+1, 120, 0, 0, 0, 0, 0, 10000);
  184. p3[playerid] = CreateDynamicObject(822, xx1[playerid]-1, yy1[playerid]-1, 120, 0, 0, 0, 0, 0, 10000);
  185. p4[playerid] = CreateDynamicObject(822, xx1[playerid]+1, yy1[playerid]-1, 120, 0, 0, 0, 0, 0, 10000);
  186. PlayerInfo[playerid][pNasceu] = 1;
  187. format(msgmaconha, sizeof(msgmaconha), "{FFFFFF}Esta Plantação Pertence a\n{00FF00}%s", Name(playerid));
  188. TextLabel[playerid] = Create3DTextLabel(msgmaconha, -1, xx1[playerid], yy1[playerid], zz1[playerid], 60, 0, 0);
  189. GameTextForPlayer(playerid, "~g~PLANTANDO...", 1500, 1);
  190. PlayerInfo[playerid][sementes] --;
  191. }else{SendClientMessage(playerid, -1, "{FF0000}Você não está na area de plantação!");}
  192. }else{SendClientMessage(playerid, -1, "{FF0000}Você não pode plantar maconha em um veículo!");}
  193. }else{SendClientMessage(playerid, -1, "{FF0000}Você já tem uma plantação pendente!");}
  194. return 1;
  195. }
  196.  
  197. CMD:regar(playerid)
  198. {
  199. if(PlayerInfo[playerid][pNasceu] == 1){
  200. if(IsPlayerInRangeOfPoint(playerid, 3, xx1[playerid], yy1[playerid], zz1[playerid])){
  201. ApplyAnimation(playerid,"BOMBER","BOM_Plant_Loop",2.0,1,0,0,0,3000);
  202. MoveDynamicObject(p1[playerid], xx1[playerid]+1, yy1[playerid]+1, 128.68871, 0.05);
  203. MoveDynamicObject(p2[playerid], xx1[playerid]-1, yy1[playerid]+1, 128.68871, 0.05);
  204. MoveDynamicObject(p3[playerid], xx1[playerid]-1, yy1[playerid]-1, 128.68871, 0.05);
  205. MoveDynamicObject(p4[playerid], xx1[playerid]+1, yy1[playerid]-1, 128.68871, 0.05);
  206. SendClientMessage(playerid, 0x00FF00FF, "Você regou sua plantação, espere a plantação nascer!");
  207. GameTextForPlayer(playerid, "~g~REGADO", 2000, 1);
  208. PlayerInfo[playerid][pNasceu] = 2;
  209. PlayerInfo[playerid][lColher] = gettime() + 173;
  210. }else{SendClientMessage(playerid, -1, "{FF0000}Você não esta perto de suas plantações!");}
  211. }else{SendClientMessage(playerid, -1, "{FF0000}Você não tem plantações para regar!");}
  212. return 1;
  213. }
  214.  
  215. CMD:colhermaconha(playerid)
  216. {
  217. if(PlayerInfo[playerid][lColher] > gettime()) return SendClientMessage(playerid, -1, "{FF0000}Sua plantação ainda não nasceu ou você não tem plantações!");
  218. if(!IsPlayerInAnyVehicle(playerid)){
  219. if(IsPlayerInRangeOfPoint(playerid, 3, xx1[playerid], yy1[playerid], zz1[playerid])){
  220. if(PlayerInfo[playerid][pNasceu] == 2)
  221. {
  222. DestroyDynamicObject(p1[playerid]);
  223. DestroyDynamicObject(p2[playerid]);
  224. DestroyDynamicObject(p3[playerid]);
  225. DestroyDynamicObject(p4[playerid]);
  226. SendClientMessage(playerid, 0x00FF00FF, "Você colheu sua plantação, vá na cabana e digite /vendermaconha!");
  227. Delete3DTextLabel(TextLabel[playerid]);
  228. PlayerInfo[playerid][pNasceu] = 0;
  229. PlayerInfo[playerid][qMaconhas] ++;
  230. }else{SendClientMessage(playerid, -1, "{FF0000}Você não tem Plantações ou sua plantação ainda não nasceu!");}
  231. }else{SendClientMessage(playerid, -1, "{FF0000}Você não está perto da plantação!");}
  232. }else{SendClientMessage(playerid, -1, "{FF0000}Você não pode colher maconha em um veículo!");}
  233. return 1;
  234. }
  235.  
  236. CMD:infomaconha(playerid)
  237. {
  238. new txt[64], txt2[64], txt3[64], vr = PlayerInfo[playerid][pNasceu];
  239. switch(vr){
  240. case 0:{format(txt, 64, "Você não tem maconhas plantadas!");}
  241. case 1:{format(txt, 64, "Você tem uma maconha que precisa ser regada!");}
  242. case 2:{format(txt, 64, "Você tem uma maconha que está nascendo ou já nasceu!");}
  243. }
  244. SendClientMessage(playerid, -1, "--------------------------");
  245. SendClientMessage(playerid, 0xFFF000FF, txt);
  246. format(txt2, sizeof(txt2), "{FFF000}Você tem %d maconha(s) colhida(s)", PlayerInfo[playerid][qMaconhas]);
  247. format(txt3, sizeof(txt3), "{FFF000}Você tem %d semente(s)", PlayerInfo[playerid][sementes]);
  248. SendClientMessage(playerid, -1, txt2);
  249. SendClientMessage(playerid, -1, txt3);
  250. SendClientMessage(playerid, -1, "--------------------------");
  251. return 1;
  252. }
  253.  
  254. CMD:ajudamaconha(playerid)
  255. {
  256. SendClientMessage(playerid, -1, "Se você não é vendedor de maconha, vá até a cabana e digite /pegaremprego!");
  257. SendClientMessage(playerid, -1, "Para saber onde se encontra a cabana digite: {00FF00}/cabana");
  258. SendClientMessage(playerid, -1, "{00FF00}Comandos: {FFFFFF}/plantarmaconha, /colhermaconha, /infomaconha, /comprarsementes");
  259. return 1;
  260. }
  261.  
  262. stock Name(playerid)
  263. {
  264. new nome[MAX_PLAYER_NAME];
  265. GetPlayerName(playerid, nome, MAX_PLAYER_NAME);
  266. return nome;
  267. }
  268.  
  269. stock din(playerid)
  270. {
  271. new dinheiro;
  272. dinheiro = GetPlayerMoney(playerid);
  273. return dinheiro;
  274. }
  275.  
  276. stock arquivo(playerid)
  277. {
  278. new ArquivoPlayer[30];
  279. format(ArquivoPlayer, sizeof(ArquivoPlayer), Plant, Name(playerid));
  280. return ArquivoPlayer;
  281. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement