Advertisement
Guest User

Untitled

a guest
Apr 18th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.80 KB | None | 0 0
  1. 1.1 - Coordenada Criada.
  2.  
  3. Code:
  4. AddPlayerClass(78,1208.1812,-2068.6694,69.0078,91.1575,0,0,0,0,0,0); // Esquerda Abaixo
  5. AddPlayerClass(78,1122.5748,-1994.9491,69.0078,92.7242,0,0,0,0,0,0); // Direita Acima
  6. Essas São as Coordenadas Que Criamos Usando o Vídeo.
  7.  
  8. Vamos Usar a Função:
  9.  
  10. Code:
  11. GangZoneCreate(MinX, MinY, MaxX, MaxY);
  12. // Ou Seja, a Menor Coordenada X e Y, e maior Coordenada X,Y.
  13.  
  14. Agora vamos pegar nossa coordenada e bota-lá no GangZoneCreate Ficando.
  15.  
  16. Code:
  17. GangZoneCreate(1122.5748, -2068.6694, 1208.1812, -1994.9491);
  18. Verifique Agora a Coordenada X,Y Do Nosso Vídeo e a GangZoneCreate a cima.
  19.  
  20. pronto, criamos nossa primeira GangZone, agora vamos dar continuidade...
  21.  
  22. 1.2 - Criando a GangZone
  23.  
  24. Bote Isso no Topo do Seu GameMode:
  25. Code:
  26. new Dominando[MAX_PLAYERS]; // Usaremos Quando o Player For Dominar
  27. new GZCasarao; // Da Nome a Nossa GZ
  28. new donoCasarao; // Define quem é o dono da GZ
  29. new GuerranoCasarao; // Se Estiver Em Guerra o Casarao.
  30. new ProvocoCasarao[MAX_PLAYERS]; // Se Ele der /do no casarão.
  31. new TempoGuerraCasarao; // Tempo Para Dominar/
  32. forward GuerraCasarao(playerid); // Public de Dominar.
  33. new CelulasJFS[128]; // new Que Iremos usar Para Nossas format.
  34. new NomeJFS[MAX_PLAYER_NAME]; // Pegará o Nome do Player ^^
  35. Depois de Definir, Vamos Definir Para Quando Algum Player Entrar no Servidor, Setar a Cor da GangZone.
  36.  
  37. Bote Isso Abaixo No OnPlayerConnect.
  38. Code:
  39. if(donoConstrucao == 0) // Se o DonoCasarao For 0, é Branca, de Ninguem.
  40. {
  41. GangZoneShowForPlayer(playerid, GZConstrucao, 0xC0C0C0AA); // GangZone de Cor Normal ( Branca ).
  42. }
  43. if(donoConstrucao == 1) // Se o DonoCasarao For 1, é Dos Vagos.
  44. {
  45. GangZoneShowForPlayer(playerid, GZConstrucao, CorVagos); // GangZone de Cor Vagos ( Amarela )
  46. }
  47. if(donoConstrucao == 2) // Se o DonoCasarao For 2, é Dos Grove.
  48. {
  49. GangZoneShowForPlayer(playerid, GZConstrucao,CorGrove); // GangZone de Cor Grove ( Verde )
  50. }
  51.  
  52. Bote Isso Abaixo no OnPlayerDisconnect
  53.  
  54. Code:
  55. if(ProvocoConstrucao[playerid] == 1) // Se o Player Estiver Domindo ( /do ), se ele sair, a GZ Ficará Branca Denovo, Assim Podendo Dominar Denovo.
  56. {
  57. // Essas Funções Abaixo Reseta a GangZone, Porque o Player que estavá dominando saiu, a GZ Volta ao seu estado de início.
  58. GangZoneStopFlashForAll(GZCasarao); // Para Fazer a GangZone Parar de Piscar.
  59. GangZoneShowForAll(GZCasarao, 0xFFFFFF96); // GangZone Voltará a Ficar Branca.
  60. GuerranoCasarao = 0; // Setando Para poder dominar.
  61. ProvocoCasarao[playerid] = 0; // Setando Para poder dominar.
  62. donoCasarao = 0; // Setando para o dono 0 ( ninguem ).
  63. Dominando[playerid] = 0; // Setando que ninguem está dominando.
  64. KillTimer(TempoGuerraCasarao); // Destroi o SetTimer Criado Para Dominar a GZ
  65. }
  66.  
  67. Se Você Quiser Por Essa Parte, é a mesma coisa que a gente fez em cima, só que, se o Player Morrer ele é resetado, se você quiser por para quando o player morrer, resetar bote na public OnPlayerDeath:
  68.  
  69. Code:
  70. if(ProvocoConstrucao[playerid] == 1) // Se o Player Estiver Domindo ( /do ), se ele Morrer, a GZ Ficará Branca Denovo, Assim Podendo Dominar Denovo.
  71. {
  72. // Essas Funções Abaixo Reseta a GangZone, Porque o Player que estavá dominando e morreu, a GZ Volta ao seu estado de início.
  73. GangZoneStopFlashForAll(GZCasarao); // Para Fazer a GangZone Parar de Piscar.
  74. GangZoneShowForAll(GZCasarao, 0xFFFFFF96); // GangZone Voltará a Ficar Branca.
  75. GuerranoCasarao = 0; // Setando Para poder dominar.
  76. ProvocoCasarao[playerid] = 0; // Setando Para poder dominar.
  77. donoCasarao = 0; // Setando para o dono 0 ( ninguem ).
  78. Dominando[playerid] = 0; // Setando que ninguem está dominando.
  79. KillTimer(TempoGuerraCasarao); // Destroi o SetTimer Criado Para Dominar a GZ
  80. }
  81.  
  82. Agora no OnGameModeInit, Bote o Código Abaixo, Que Criará nossa GangZone.
  83.  
  84. Code:
  85. GZCasarao = GangZoneCreate(1122.5748, -2068.6694, 1208.1812, -1994.9491);
  86. // a GangZoneCreate foi o que a gente criou no nosso vídeo, e demos o nome a ela.
  87.  
  88. Pronto Criamos a Nossa GZ e as funções, Agora Vamos Criar o Comando.
  89.  
  90. 1.3 - Criando o Comando.
  91.  
  92. Code:
  93. if(strcmp(cmdtext, "/dominar", true) == 0 || strcmp(cmdtext, "/do", true) == 0) // Ou /dominar ou /do ^^
  94. {
  95. if(MinhaGang[playerid] == Vagos) // se for vagos
  96. {
  97. if(!IsPlayerInCasarao(playerid)) return SendClientMessage(playerid, -1, "Você não está em nenhum território!");
  98. if(Dominando[playerid] == 1) return SendClientMessage(playerid, -1, "Você Já Está Dominando um Territorio.");
  99. if(GuerranoCasarao == 1) return SendClientMessage(playerid, -1, "Já está tendo uma guerra nesse territorio.");
  100. GetPlayerName(playerid, NomeJFS, MAX_PLAYER_NAME); // pegando o nome do player
  101. format(CelulasJFS, sizeof(CelulasJFS), "%s e os Vagos Estão Dominando o Casarão",NomeJFS); // mensagem ao dominar
  102. SendClientMessageToAll(CorVagos, CelulasJFS); // para todos a mensagem.
  103. SendClientMessage(playerid, -1, "Fique esperto, Todos os Terroristas Foi Avisados!");
  104. SendClientMessage(playerid, -1, "Espere 1 minuto para dominar está area.");
  105. GangZoneFlashForAll(GZCasarao, CorVagos); // Ficar piscando para todos.
  106. Dominando[playerid] = 1; // setando o 'DOMINANDO' Para 1.
  107. ProvocoCasarao[playerid] = 1; // setando o 'ProvocoCasarao' Para 1.
  108. GuerranoCasarao = 1; // setando o 'GuerranoCasarao ' Para 1.
  109. TempoGuerraCasarao = SetTimerEx("GuerraCasarao", 60000, 0, "i", playerid); // SetTimer Até dominar ( 1 MIN )
  110. return true;
  111. }
  112. if(MinhaGang[playerid] == Grove) // se for grove
  113. {
  114. if(!IsPlayerInCasarao(playerid)) return SendClientMessage(playerid, -1, "Você não está em nenhum território!");
  115. if(Dominando[playerid] == 1) return SendClientMessage(playerid, -1, "Você Já Está Dominando um Territorio.");
  116. if(GuerranoCasarao == 1) return SendClientMessage(playerid, -1, "Já está tendo uma guerra nesse territorio.");
  117. GetPlayerName(playerid, NomeJFS, MAX_PLAYER_NAME); // getando o nome do player.
  118. format(CelulasJFS, sizeof(CelulasJFS), "%s e os Grove Estão Dominando o Casarão",NomeJFS); // mensagem
  119. SendClientMessageToAll(CorGrove, CelulasJFS); // mensagem a cima para todos
  120. SendClientMessage(playerid, -1, "Fique esperto, Todos os Terroristas Foi Avisados!");
  121. SendClientMessage(playerid, -1, "Espere 1 minuto para dominar está area.");
  122. GangZoneFlashForAll(GZCasarao, CorGrove);// Ficar piscando para todos.
  123. Dominando[playerid] = 1; // setando o 'DOMINANDO' Para 1.
  124. ProvocoCasarao[playerid] = 1; // setando o 'ProvocoCasarao' Para 1.
  125. GuerranoCasarao = 1; // setando o 'GuerranoCasarao ' Para 1.
  126. TempoGuerraCasarao = SetTimerEx("GuerraCasarao", 60000, 0, "i", playerid);// SetTimer Até dominar ( 1 MIN )
  127. return true;
  128. }
  129. return true;
  130. }
  131.  
  132. 1.4 - Completando o Timer SetTimerEx.
  133.  
  134. Agora Bote no Final do GameMode, Quando Dominar:
  135.  
  136. Code:
  137. public GuerraCasarao(playerid)
  138. {
  139. if(MinhaGang[playerid] == Vagos)
  140. {
  141. if(ProvocoCasarao[playerid] == 1)
  142. {
  143. if(IsPlayerInCasarao(playerid))
  144. {
  145. GetPlayerName(playerid, NomeJFS, MAX_PLAYER_NAME);
  146. format(CelulasJFS, sizeof(CelulasJFS), "%s e os Vagos Dominaram a GangZone do Casarão.",NomeJFS);
  147. SendClientMessageToAll(CorVagos, CelulasJFS);
  148. SendClientMessage(playerid, -1, "Você Dominou a GangZone do Casarão.");
  149. GangZoneStopFlashForAll(GZCasarao);
  150. GangZoneShowForAll(GZCasarao, CorVagos);
  151. Dominando[playerid] = 0;
  152. ProvocoCasarao[playerid] = 0;
  153. GuerranoCasarao = 0;
  154. donoCasarao = 1;
  155. KillTimer(TempoGuerraCasarao);
  156. return true;
  157. }
  158. else
  159. {
  160. SendClientMessage(playerid, CorVagos, "Você não está na Construção Abandonada.");
  161. Dominando[playerid] = 0;
  162. GangZoneStopFlashForAll(GZCasarao);
  163. GangZoneShowForAll(GZCasarao, 0xFFFFFF96);
  164. ProvocoCasarao[playerid] = 0;
  165. GuerranoCasarao = 0;
  166. donoCasarao = 0;
  167. KillTimer(TempoGuerraCasarao);
  168. return true;
  169. }
  170. }
  171. return true;
  172. }
  173. if(MinhaGang[playerid] == Grove)
  174. {
  175. if(ProvocoCasarao[playerid] == 1)
  176. {
  177. if(IsPlayerInCasarao(playerid))
  178. {
  179. GetPlayerName(playerid, NomeJFS, MAX_PLAYER_NAME);
  180. format(CelulasJFS, sizeof(CelulasJFS), "%s e os Grove Dominaram o Casarão.",NomeJFS);
  181. SendClientMessageToAll(CorGrove, CelulasJFS);
  182. SendClientMessage(playerid, -1, "Você dominou o Casarão.");
  183. GangZoneStopFlashForAll(GZCasarao);
  184. GangZoneShowForAll(GZCasarao, CorGrove);
  185. Dominando[playerid] = 0;
  186. ProvocoCasarao[playerid] = 0;
  187. GuerranoCasarao = 0;
  188. donoCasarao = 2;
  189. KillTimer(TempoGuerraCasarao);
  190. return true;
  191. }
  192. else
  193. {
  194. SendClientMessage(playerid, CorGrove, "Você não está na Construção Abandonada.");
  195. Dominando[playerid] = 0;
  196. GangZoneStopFlashForAll(GZCasarao);
  197. GangZoneShowForAll(GZCasarao, 0xFFFFFF96);
  198. ProvocoCasarao[playerid] = 0;
  199. GuerranoCasarao = 0;
  200. donoCasarao = 0;
  201. KillTimer(TempoGuerraCasarao);
  202. return true;
  203. }
  204. }
  205. return true;
  206. }
  207. return true;
  208. }
  209. 1.5 - Finazilando o IsPlayerInCasarao.
  210.  
  211. Se Lembra da Coordenada Que Criamos Lá no Começo ?
  212. Code:
  213. GangZoneCreate(1122.5748, -2068.6694, 1208.1812, -1994.9491);
  214.  
  215. Então Basta Fazer o Seguinte.
  216. No Final do Seu GameMode, Bote:
  217. Code:
  218. stock IsPlayerInCasarao(playerid)
  219. {
  220. new Float:x,Float:y,Float:z;
  221. GetPlayerPos(playerid, x, y, z);
  222. if(x >= 1122.5748 && y >= -2068.6694 && x <= 1208.1812 && y <= -1994.9491) return true;
  223. else return false;
  224. }
  225.  
  226. Ou Seja, Basta Aplicar na Ordem Que Está na GangZoneCreate.
  227.  
  228. Pronto Terminou o Nosso Tutorial, Caso Queria Um Code Sem Erros, é Pegando Normalmente, Abaixo um FilterScript Criado Por Mim:
  229.  
  230. Code:
  231. #include <a_samp>
  232.  
  233. new Dominando[MAX_PLAYERS];
  234. new GZCasarao;
  235. new donoCasarao;
  236. new GuerranoCasarao;
  237. new ProvocoCasarao[MAX_PLAYERS];
  238. new TempoGuerraCasarao;
  239. forward GuerraCasarao(playerid);
  240. new CelulasJFS[128];
  241. new NomeJFS[MAX_PLAYER_NAME];
  242.  
  243. //========================
  244. //S istema de Gang Criado
  245. new MinhaGang[MAX_PLAYERS];
  246. #define Vagos 1
  247. #define Grove 2
  248. #define CorGrove 0x00FF00C8
  249. #define CorVagos 0xFFFF00C8
  250. //=========================
  251.  
  252. public OnFilterScriptInit()
  253. {
  254. print("\n--------------------------------------");
  255. print("FS GangZ5one Casarão Por Jonathan Feitosa Carregado.");
  256. print("--------------------------------------\n");
  257. return 1;
  258. }
  259.  
  260. public OnFilterScriptExit()
  261. {
  262. print("\n--------------------------------------");
  263. print("FS GangZone Casarão Por Jonathan Feitosa Descarregado..");
  264. print("--------------------------------------\n");
  265. return 1;
  266. }
  267.  
  268. main()
  269. {
  270. print("\n----------------------------------");
  271. print("Criado Por: Jonathan Feitosa");
  272. print("----------------------------------\n");
  273. }
  274.  
  275. public OnGameModeInit()
  276. {
  277. GZCasarao = GangZoneCreate(1122.5748, -2068.6694, 1208.1812, -1994.9491);
  278. return 1;
  279. }
  280.  
  281. public OnPlayerConnect(playerid)
  282. {
  283. MinhaGang[playerid] = Grove;
  284. if(donoCasarao == 0)
  285. {
  286. GangZoneShowForPlayer(playerid, GZCasarao, 0xC0C0C0AA);
  287. }
  288. if(donoCasarao == 1)
  289. {
  290. GangZoneShowForPlayer(playerid, GZCasarao, CorVagos);
  291. }
  292. if(donoCasarao == 2)
  293. {
  294. GangZoneShowForPlayer(playerid, GZCasarao,CorGrove);
  295. }
  296. return 1;
  297. }
  298.  
  299. public OnPlayerDisconnect(playerid, reason)
  300. {
  301. if(ProvocoCasarao[playerid] == 1)
  302. {
  303.  
  304. GangZoneStopFlashForAll(GZCasarao);
  305. GangZoneShowForAll(GZCasarao, 0xFFFFFF96);
  306. GuerranoCasarao = 0;
  307. ProvocoCasarao[playerid] = 0;
  308. donoCasarao = 0;
  309. Dominando[playerid] = 0;
  310. KillTimer(TempoGuerraCasarao);
  311. }
  312. return 1;
  313. }
  314.  
  315. public OnPlayerDeath(playerid, killerid, reason)
  316. {
  317. if(ProvocoCasarao[playerid] == 1)
  318. {
  319.  
  320. GangZoneStopFlashForAll(GZCasarao);
  321. GangZoneShowForAll(GZCasarao, 0xFFFFFF96);
  322. GuerranoCasarao = 0;
  323. ProvocoCasarao[playerid] = 0;
  324. donoCasarao = 0;
  325. Dominando[playerid] = 0;
  326. KillTimer(TempoGuerraCasarao);
  327. }
  328. return 1;
  329. }
  330.  
  331. public OnPlayerCommandText(playerid, cmdtext[])
  332. {
  333. if(strcmp(cmdtext, "/dominar", true) == 0 || strcmp(cmdtext, "/do", true) == 0) // Ou /dominar ou /do ^^
  334. {
  335. if(MinhaGang[playerid] == Vagos)
  336. {
  337. if(!IsPlayerInCasarao(playerid)) return SendClientMessage(playerid, -1, "Você não está em nenhum território!");
  338. if(Dominando[playerid] == 1) return SendClientMessage(playerid, -1, "Você Já Está Dominando um Territorio.");
  339. if(GuerranoCasarao == 1) return SendClientMessage(playerid, -1, "Já está tendo uma guerra nesse territorio.");
  340. GetPlayerName(playerid, NomeJFS, MAX_PLAYER_NAME);
  341. format(CelulasJFS, sizeof(CelulasJFS), "%s e os Vagos Estão Dominando o Casarão",NomeJFS);
  342. SendClientMessageToAll(CorVagos, CelulasJFS);
  343. SendClientMessage(playerid, -1, "Fique esperto, Todos os Terroristas Foi Avisados!");
  344. SendClientMessage(playerid, -1, "Espere 1 minuto para dominar está area.");
  345. GangZoneFlashForAll(GZCasarao, CorVagos);
  346. Dominando[playerid] = 1;
  347. ProvocoCasarao[playerid] = 1;
  348. GuerranoCasarao = 1;
  349. TempoGuerraCasarao = SetTimerEx("GuerraCasarao", 60000, 0, "i", playerid);
  350. return true;
  351. }
  352. if(MinhaGang[playerid] == Grove)
  353. {
  354. if(!IsPlayerInCasarao(playerid)) return SendClientMessage(playerid, -1, "Você não está em nenhum território!");
  355. if(Dominando[playerid] == 1) return SendClientMessage(playerid, -1, "Você Já Está Dominando um Territorio.");
  356. if(GuerranoCasarao == 1) return SendClientMessage(playerid, -1, "Já está tendo uma guerra nesse territorio.");
  357. GetPlayerName(playerid, NomeJFS, MAX_PLAYER_NAME);
  358. format(CelulasJFS, sizeof(CelulasJFS), "%s e os Grove Estão Dominando o Casarão",NomeJFS);
  359. SendClientMessageToAll(CorVagos, CelulasJFS);
  360. SendClientMessage(playerid, -1, "Fique esperto, Todos os Terroristas Foi Avisados!");
  361. SendClientMessage(playerid, -1, "Espere 1 minuto para dominar está area.");
  362. GangZoneFlashForAll(GZCasarao, CorGrove);
  363. Dominando[playerid] = 1;
  364. ProvocoCasarao[playerid] = 1;
  365. GuerranoCasarao = 1;
  366. TempoGuerraCasarao = SetTimerEx("GuerraCasarao", 60000, 0, "i", playerid);
  367. return true;
  368. }
  369. return true;
  370. }
  371. if(strcmp(cmdtext, "/virarvagos", true) == 0)
  372. {
  373. MinhaGang[playerid] = Vagos;
  374. return true;
  375. }
  376. if(strcmp(cmdtext, "/virargrove", true) == 0)
  377. {
  378. MinhaGang[playerid] = Grove;
  379. return true;
  380. }
  381. return false;
  382. }
  383.  
  384. public GuerraCasarao(playerid)
  385. {
  386. if(MinhaGang[playerid] == Vagos)
  387. {
  388. if(ProvocoCasarao[playerid] == 1)
  389. {
  390. if(IsPlayerInCasarao(playerid))
  391. {
  392. GetPlayerName(playerid, NomeJFS, MAX_PLAYER_NAME);
  393. format(CelulasJFS, sizeof(CelulasJFS), "%s e os Vagos Dominaram a GangZone do Casarão.",NomeJFS);
  394. SendClientMessageToAll(CorVagos, CelulasJFS);
  395. SendClientMessage(playerid, -1, "Você Dominou a GangZone do Casarão.");
  396. GangZoneStopFlashForAll(GZCasarao);
  397. GangZoneShowForAll(GZCasarao, CorVagos);
  398. Dominando[playerid] = 0;
  399. ProvocoCasarao[playerid] = 0;
  400. GuerranoCasarao = 0;
  401. donoCasarao = 1;
  402. KillTimer(TempoGuerraCasarao);
  403. return true;
  404. }
  405. else
  406. {
  407. SendClientMessage(playerid, CorVagos, "Você não está na Construção Abandonada.");
  408. Dominando[playerid] = 0;
  409. GangZoneStopFlashForAll(GZCasarao);
  410. GangZoneShowForAll(GZCasarao, 0xFFFFFF96);
  411. ProvocoCasarao[playerid] = 0;
  412. GuerranoCasarao = 0;
  413. donoCasarao = 0;
  414. KillTimer(TempoGuerraCasarao);
  415. return true;
  416. }
  417. }
  418. return true;
  419. }
  420. if(MinhaGang[playerid] == Grove)
  421. {
  422. if(ProvocoCasarao[playerid] == 1)
  423. {
  424. if(IsPlayerInCasarao(playerid))
  425. {
  426. GetPlayerName(playerid, NomeJFS, MAX_PLAYER_NAME);
  427. format(CelulasJFS, sizeof(CelulasJFS), "%s e os Grove Dominaram o Casarão.",NomeJFS);
  428. SendClientMessageToAll(CorGrove, CelulasJFS);
  429. SendClientMessage(playerid, -1, "Você dominou o Casarão.");
  430. GangZoneStopFlashForAll(GZCasarao);
  431. GangZoneShowForAll(GZCasarao, CorGrove);
  432. Dominando[playerid] = 0;
  433. ProvocoCasarao[playerid] = 0;
  434. GuerranoCasarao = 0;
  435. donoCasarao = 2;
  436. KillTimer(TempoGuerraCasarao);
  437. return true;
  438. }
  439. else
  440. {
  441. SendClientMessage(playerid, CorGrove, "Você não está na Construção Abandonada.");
  442. Dominando[playerid] = 0;
  443. GangZoneStopFlashForAll(GZCasarao);
  444. GangZoneShowForAll(GZCasarao, 0xFFFFFF96);
  445. ProvocoCasarao[playerid] = 0;
  446. GuerranoCasarao = 0;
  447. donoCasarao = 0;
  448. KillTimer(TempoGuerraCasarao);
  449. return true;
  450. }
  451. }
  452. return true;
  453. }
  454. return true;
  455. }
  456.  
  457. stock IsPlayerInCasarao(playerid)
  458. {
  459. new Float:x,Float:y,Float:z;
  460. GetPlayerPos(playerid, x, y, z);
  461. if(x >= 1122.5748 && y >= -2068.6694 && x <= 1208.1812 && y <= -1994.9491) return true;
  462. else return false;
  463. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement