Advertisement
LifeAdvanced

Explodir

Nov 12th, 2012
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 9.29 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. #include    zcmd
  28. // Os Codigos pode ta meio estranho mais vai dar pra entender um Pouco !
  29.  
  30. //*********************
  31. new explodiracela[MAX_PLAYERS];
  32. new invadirporta[MAX_PLAYERS];
  33. new PortaoDP;
  34. new cela1;
  35. new cela2;
  36.  
  37. //**************************
  38. forward InvadirPortao(playerid);
  39. forward UsarPorta(playerid);
  40. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  41. forward PortaoReformado();
  42. forward explodircela1(playerid);
  43. forward explodircela2(playerid);
  44. forward UsarCela(playerid);
  45. forward reformarcela1();
  46. forward reformarcela2();
  47.  
  48. //*********************
  49. #define ForPlayers(%1) for(new %1 = 0; %1 < MAX_PLAYERS; %1++) if(IsPlayerConnected(%1) && !IsPlayerNPC(%1))
  50.  
  51. //*******************
  52. public OnFilterScriptInit()
  53. {
  54.     print("\n(*********************************************)");
  55.     print(" Sistema de Explodir e Invadir DP: Life_Advanced ");
  56.     print("            Não retire os créditos !!            ");
  57.     print("(*********************************************)\n");
  58.     //*********
  59.     PortaoDP = CreateObject( 985 , 247.005905 , 72.448440 , 1003.640625 , 0.000000 , 0.000000 , 1260.000000 );
  60.     //*********
  61.     Create3DTextLabel("Para invadir a DP\n{FF0000}/invadirdp",-1,245.24836731,72.30346680,1004.05560303,7.0,0);
  62.     //*********
  63.     CreateObject(1654,245.24836731,72.30346680,1004.05560303,0.00000000,0.00000000,0.00000000);
  64.     //*********
  65.     Create3DTextLabel("Para explodir a cela\n{FF0000}/explodircelas",-1,266.41387939,88.43037415,1001.51251221,7.0,0);
  66.     //*********
  67.     Create3DTextLabel("Para explodir a cela\n{FF0000}/explodircelas",-1,266.39843750,83.92252350,1001.50115967,7.0,0);
  68.     //*********
  69.     cela1 = CreateObject(2930,266.37335205,83.79895782,1002.67590332,0.00000000,0.00000000,0.00000000);
  70.     //*********
  71.     cela2 = CreateObject(2930,266.36856079,88.33088684,1002.67590332,0.00000000,0.00000000,0.00000000);
  72.     //*********
  73.     CreateObject(1654,245.24836731,72.30346680,1004.05560303,0.00000000,0.00000000,0.00000000);
  74.     //*********
  75.     CreateObject(1654,266.41387939,88.43037415,1001.51251221,0.00000000,0.00000000,84.92492676);
  76.     //*********
  77.     CreateObject(1654,266.39843750,83.92252350,1001.50115967,0.00000000,0.00000000,84.92431641);
  78.     return 1;
  79. }
  80.  
  81. //**************************[ Invadir DP ]************************
  82. CMD:invadirdp(playerid, params[])       // By: Life
  83. {
  84.     new string[100];
  85.     if(invadirporta[playerid] == 1) return SendClientMessage(playerid, -1, "Você já invadiu a DP, deve esperar 1 Minuto.");
  86.     if(!PlayerToPoint(15.0, playerid, 247.005905,72.448440,1003.640625)) return SendClientMessage(playerid, -1, "Não está no local Certo pra Invadir DP !");
  87.     format(string, sizeof(string), "O{89898b} %s {f5f3f0}está tentando invadir a DP",Nome(playerid));
  88.     SendClientMessageToAll(-1, string);
  89.     SendClientMessage(playerid, -1, "Aguarde 10 Segundos para invadir a DP.");
  90.     SetTimerEx("InvadirPortao", 10000, 0, "i", playerid);    // 10 Segundos !!!
  91.     SetTimer("UsarPorta", 60000, 0);    // 60 Segundos !!!
  92.     invadirporta[playerid] = 1;
  93.     return 1;
  94. }
  95.  
  96. CMD:ls(playerid, params[])
  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.  
  105. //*****************[ Explodir Celas ]*******************        // Arrume da sua vontade !
  106. CMD:explodircelas(playerid, params[])
  107. {
  108.     new string[100];
  109.     if (explodiracela[playerid] == 1) return SendClientMessage(playerid, -1, "Você já explodiu a cela, deve esperar 3 minutos.");
  110.     if(PlayerToPoint(15.0, playerid, 266.37335205,83.79895782,1002.67590332))
  111.     {
  112.         format(string, sizeof(string), "O{89898b} %s {f5f3f0}está explodindo a cela nº1",Nome(playerid));
  113.         SendClientMessageToAll(-1, string);
  114.         SendClientMessage(playerid, -1, "Aguarde 10 Segundos para explodir a cela.");
  115.         SetTimerEx("explodircela1", 10000, 0, "i", playerid);   // 10 Segundos pra ...
  116.         SetTimer("UsarCela", 60000, 0); // Explodir Nova....    60 segundos = 1 Minuto
  117.         explodiracela[playerid] = 1;
  118.         return 1;
  119.     }
  120.     else if(PlayerToPoint(15.0, playerid, 266.36856079,88.33088684,1002.67590332))
  121.     {
  122.         format(string, sizeof(string), "O{89898b} %s {f5f3f0}está explodindo a cela nº2",Nome(playerid));
  123.         SendClientMessageToAll(-1, string);
  124.         SendClientMessage(playerid, -1, "Aguarde 10 Segundos para explodir a cela.");
  125.         SetTimerEx("explodircela2", 10000, 0, "i", playerid);   // 10 Segundos ...
  126.         SetTimer("UsarCela", 60000, 0);        // Explodir Nova....    60 segundos = 1 Minuto
  127.         explodiracela[playerid] = 1;
  128.         return 1;
  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