Advertisement
LifeAdvanced

Explodirstrcmp

Nov 12th, 2012
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.38 KB | None | 0 0
  1. /*
  2.  
  3.  
  4.  
  5. * Forum Samp *
  6.  
  7.  
  8. ********************************************
  9.  
  10.  
  11. Sistema de Invadir DP e Explodir Celas
  12.  
  13.  
  14. By: Life_Advanced
  15.  
  16. Não Retira os Créditos Aproveita !
  17.  
  18.  
  19. *********************************************
  20.  
  21.  
  22.  
  23. */
  24.  
  25. //*********************
  26. #include a_samp
  27. // Os Codigos pode ta meio estranho mais vai dar pra entender um Pouco !
  28.  
  29. //*********************
  30. new explodiracela[MAX_PLAYERS];
  31. new invadirporta[MAX_PLAYERS];
  32. new PortaoDP;
  33. new cela1;
  34. new cela2;
  35.  
  36. //**************************
  37. forward InvadirPortao(playerid);
  38. forward UsarPorta(playerid);
  39. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  40. forward PortaoReformado();
  41. forward explodircela1(playerid);
  42. forward explodircela2(playerid);
  43. forward UsarCela(playerid);
  44. forward reformarcela1();
  45. forward reformarcela2();
  46.  
  47. //*********************
  48. #define ForPlayers(%1) for(new %1 = 0; %1 < MAX_PLAYERS; %1++) if(IsPlayerConnected(%1) && !IsPlayerNPC(%1))
  49.  
  50. //*******************
  51. public OnFilterScriptInit()
  52. {
  53. print("\n(*********************************************)");
  54. print(" Sistema de Explodir e Invadir DP: Life_Advanced ");
  55. print(" Não retire os créditos !! ");
  56. print("(*********************************************)\n");
  57. //*********
  58. PortaoDP = CreateObject( 985 , 247.005905 , 72.448440 , 1003.640625 , 0.000000 , 0.000000 , 1260.000000 );
  59. //*********
  60. Create3DTextLabel("Para invadir a DP\n{FF0000}/invadirdp",-1,245.24836731,72.30346680,1004.05560303,7.0,0);
  61. //*********
  62. CreateObject(1654,245.24836731,72.30346680,1004.05560303,0.00000000,0.00000000,0.00000000);
  63. //*********
  64. Create3DTextLabel("Para explodir a cela\n{FF0000}/explodircelas",-1,266.41387939,88.43037415,1001.51251221,7.0,0);
  65. //*********
  66. Create3DTextLabel("Para explodir a cela\n{FF0000}/explodircelas",-1,266.39843750,83.92252350,1001.50115967,7.0,0);
  67. //*********
  68. cela1 = CreateObject(2930,266.37335205,83.79895782,1002.67590332,0.00000000,0.00000000,0.00000000);
  69. //*********
  70. cela2 = CreateObject(2930,266.36856079,88.33088684,1002.67590332,0.00000000,0.00000000,0.00000000);
  71. //*********
  72. CreateObject(1654,245.24836731,72.30346680,1004.05560303,0.00000000,0.00000000,0.00000000);
  73. //*********
  74. CreateObject(1654,266.41387939,88.43037415,1001.51251221,0.00000000,0.00000000,84.92492676);
  75. //*********
  76. CreateObject(1654,266.39843750,83.92252350,1001.50115967,0.00000000,0.00000000,84.92431641);
  77. return 1;
  78. }
  79.  
  80. //**************************[ Invadir DP ]************************
  81. public OnPlayerCommandText(playerid, cmdtext[])
  82. {
  83. if(strcmp(cmdtext,"/invadirdp", true) == 0)
  84. {
  85. new string[100];
  86. if(invadirporta[playerid] == 1) return SendClientMessage(playerid, -1, "Você já invadiu a DP, deve esperar 1 Minuto.");
  87. if(!PlayerToPoint(15.0, playerid, 247.005905,72.448440,1003.640625)) return SendClientMessage(playerid, -1, "Não está no local Certo pra Invadir DP !");
  88. format(string, sizeof(string), "O{89898b} %s {f5f3f0}está tentando invadir a DP",Nome(playerid));
  89. SendClientMessageToAll(-1, string);
  90. SendClientMessage(playerid, -1, "Aguarde 10 Segundos para invadir a DP.");
  91. SetTimerEx("InvadirPortao", 10000, 0, "i", playerid); // 10 Segundos !!!
  92. SetTimer("UsarPorta", 60000, 0); // 60 Segundos !!!
  93. invadirporta[playerid] = 1;
  94. return 1;
  95. }
  96. if(strcmp(cmdtext,"/ls", true) == 0)
  97. {
  98. if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1, "Não está connectado pra usar esse comando !");
  99. SetPlayerPos(playerid, 1539.6094,-1694.4749,13.5469);
  100. SendClientMessage(playerid, -1, "DP/LS {FF00FF}Pronto !");
  101. SetPlayerInterior(playerid, 0);
  102. return 1;
  103. }
  104. //*****************[ Explodir Celas ]******************* // Arrume da sua vontade !
  105. if(strcmp(cmdtext,"/explodircelas", true) == 0)
  106. {
  107. new string[100];
  108. if (explodiracela[playerid] == 1) return SendClientMessage(playerid, -1, "Você já explodiu a cela, deve esperar 3 minutos.");
  109. if(PlayerToPoint(15.0, playerid, 266.37335205,83.79895782,1002.67590332))
  110. {
  111. format(string, sizeof(string), "O{89898b} %s {f5f3f0}está explodindo a cela nº1",Nome(playerid));
  112. SendClientMessageToAll(-1, string);
  113. SendClientMessage(playerid, -1, "Aguarde 10 Segundos para explodir a cela.");
  114. SetTimerEx("explodircela1", 10000, 0, "i", playerid); // 10 Segundos pra ...
  115. SetTimer("UsarCela", 60000, 0); // Explodir Nova.... 60 segundos = 1 Minuto
  116. explodiracela[playerid] = 1;
  117. return 1;
  118. }
  119. else if(PlayerToPoint(15.0, playerid, 266.36856079,88.33088684,1002.67590332))
  120. {
  121. format(string, sizeof(string), "O{89898b} %s {f5f3f0}está explodindo a cela nº2",Nome(playerid));
  122. SendClientMessageToAll(-1, string);
  123. SendClientMessage(playerid, -1, "Aguarde 10 Segundos para explodir a cela.");
  124. SetTimerEx("explodircela2", 10000, 0, "i", playerid); // 10 Segundos ...
  125. SetTimer("UsarCela", 60000, 0); // Explodir Nova.... 60 segundos = 1 Minuto
  126. explodiracela[playerid] = 1;
  127. return 1;
  128. }
  129. }
  130. return 1;
  131. }
  132. //******************************
  133. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  134. {
  135. if(IsPlayerConnected(playerid))
  136. {
  137. new Float:oldposx, Float:oldposy, Float:oldposz;
  138. new Float:tempposx, Float:tempposy, Float:tempposz;
  139. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  140. tempposx = (oldposx -x);
  141. tempposy = (oldposy -y);
  142. tempposz = (oldposz -z);
  143. if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  144. {
  145. return true;
  146. }
  147. }
  148. return 0;
  149. }
  150.  
  151. //*****************************
  152. stock Nome(playerid)
  153. {
  154. new Name[MAX_PLAYERS];
  155. GetPlayerName(playerid, Name, sizeof(Name));
  156. return Name;
  157. }
  158.  
  159. //****************************
  160. public UsarPorta(playerid)
  161. {
  162. invadirporta[playerid] = 0;
  163. }
  164.  
  165. //*************************
  166. public explodircela1(playerid)
  167. {
  168. new string[256];
  169. if(!PlayerToPoint(30.0, playerid, 266.37335205,83.79895782,1002.67590332))
  170. {
  171. format(string, sizeof(string), "O{89898b} %s {f5f3f0}não conseguiu explodir a cela.",Nome(playerid));
  172. SendClientMessageToAll(-1, string);
  173. explodiracela[playerid] = 1;
  174. return 1;
  175. }
  176. ForPlayers(i)
  177. {
  178. if(PlayerToPoint(30.0, playerid, 266.37335205,83.79895782,1002.67590332))
  179. {
  180. format(string, sizeof(string), "O{89898b} %s {f5f3f0}conseguiu explodir a cela.",Nome(playerid));
  181. SendClientMessageToAll(-1, string);
  182. DestroyObject(cela1);
  183. CreateExplosion(266.37335205,83.79895782,1002.67590332,12,1.0);
  184. explodiracela[playerid] = 1;
  185. SetTimer("reformarcela1", 30000, 0);
  186. return 1;
  187. }
  188. }
  189. return 1;
  190. }
  191.  
  192. //****************************
  193. public explodircela2(playerid)
  194. {
  195. new playername[MAX_PLAYER_NAME];
  196. new string[256];
  197. GetPlayerName(playerid,playername,sizeof(playername));
  198. if(!PlayerToPoint(30.0, playerid, 266.36856079,88.33088684,1002.67590332))
  199. {
  200. format(string, sizeof(string), "O{89898b} %s {f5f3f0}não conseguiu explodir a cela.",playername);
  201. SendClientMessageToAll(-1, string);
  202. explodiracela[playerid] = 1;
  203. return 1;
  204. }
  205. ForPlayers(i)
  206. {
  207. if(PlayerToPoint(30.0, playerid, 266.36856079,88.33088684,1002.67590332))
  208. {
  209. format(string, sizeof(string), "O{89898b} %s {f5f3f0}conseguiu explodir a cela.",playername);
  210. SendClientMessageToAll(-1, string);
  211. DestroyObject(cela2);
  212. CreateExplosion(266.36856079,88.33088684,1002.67590332,12,1.0);
  213. explodiracela[playerid] = 1;
  214. SetTimer("reformarcela2", 30000, 0);
  215. return 1;
  216. }
  217. }
  218. return 1;
  219. }
  220.  
  221. //*************************
  222. public InvadirPortao(playerid)
  223. {
  224. new string[256];
  225. if(!PlayerToPoint(30.0, playerid, 247.005905,72.448440,1003.640625))
  226. {
  227. format(string, sizeof(string), "O{89898b} %s {f5f3f0}não conseguiu invadir a DP",Nome(playerid));
  228. SendClientMessageToAll(-1, string);
  229. invadirporta[playerid] = 1;
  230. return 1;
  231. }
  232. ForPlayers(i)
  233. {
  234. if(PlayerToPoint(30.0, playerid, 247.005905,72.448440,1003.640625))
  235. {
  236. format(string, sizeof(string), "O{89898b} %s {f5f3f0}invadiu a DP",Nome(playerid));
  237. SendClientMessageToAll(-1, string);
  238. DestroyObject(PortaoDP);
  239. DestroyObject(PortaoDP);
  240. CreateExplosion(247.005905,72.448440,1003.640625,12,1.0);
  241. invadirporta[playerid] = 1;
  242. SetTimer("PortaoReformado", 30000, 1); // 30 Segundos !!!
  243. return 1;
  244. }
  245. }
  246. return 1;
  247. }
  248.  
  249. //***********************
  250. public PortaoReformado()
  251. {
  252. PortaoDP = CreateObject(985,247.005905,72.448440,1003.640625,0,0,0);
  253. SendClientMessageToAll(0x33FF00FF, "Portao Reformado");
  254. }
  255.  
  256. //***********************
  257. public UsarCela(playerid)
  258. {
  259. explodiracela[playerid] = 0;
  260. }
  261.  
  262. //********************
  263. public reformarcela1()
  264. {
  265. cela1 = CreateObject(2930,266.37335205,83.79895782,1002.67590332,0.00000000,0.00000000,0.00000000);
  266. SendClientMessageToAll(0x33FF00FF, "Cela Reformada");
  267. }
  268.  
  269. //*******************
  270. public reformarcela2()
  271. {
  272. cela2 = CreateObject(2930,266.36856079,88.33088684,1002.67590332,0.00000000,0.00000000,0.00000000);
  273. SendClientMessageToAll(0x33FF00FF, "Cela Reformada");
  274. }
  275. //*****************************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement