Guest User

Evento Flecha

a guest
Oct 11th, 2010
430
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.49 KB | None | 0 0
  1. // filescript de Evento Flecha. By Chanfa
  2. //
  3. //  si desean encontrarme en el foro busquenme como 'cocolabush' en la seccion Español.
  4. //                                          ___________
  5. //      ____________________________________|||||||||||____________________________________
  6. //      ____________________________________INFORMACION____________________________________
  7. //                                          |||||||||||
  8. // 09/10/2010                               ¯¯¯¯¯¯¯¯¯¯¯
  9. //   Sistema de creación de flecha sobre determinado jugador
  10. //   Sistema de cambio portador al asesino
  11. //   Sistema de restriccion para la iniciación (solo los admins estan autorizados)
  12. //   Sistema simplificado para cambiar opciones visuales (offset y obj_flecha)
  13. //
  14. // 11/10/2010
  15. //   Corregido el "bug 3": El error consistia en que solo parte de los usuarios veian la flecha
  16. //   Sistema de cambio de color al iniciar y de restauracion del color anterior al finalizar el evento
  17. //   Agregado texto del evento
  18. //
  19. #include <a_samp>
  20. #define offset 2            // Cambiar por la altura buscada sobre el jugador portador
  21. #define obj_flecha 1318     // Cambiar por el ID del objeto que se quira hacer aparecer en la cabeza del portador (recomendado: 1318)
  22. forward Suplantar();
  23. new Flecha;
  24. new Portador;
  25. new Empezado = 0;
  26. new Suplente;
  27. new Color[MAX_PLAYERS];
  28. public OnFilterScriptInit()
  29. {
  30.     print("\n--------------------------------------");
  31.     print(" Evento Flecha [DM]\n |By Chanfa|");
  32.     print("--------------------------------------\n");
  33.     for(new i=0; i<MAX_PLAYERS; i++)
  34.     {
  35.         if(IsPlayerAdmin(i))
  36.         {
  37.        
  38.         }
  39.     }
  40.     return 1;
  41. }
  42. public Suplantar()
  43. {
  44.     Suplente = random(MAX_PLAYERS);
  45.     if(!IsPlayerConnected(Suplente)) { Suplantar(); return -1; }
  46.     if(IsPlayerNPC(Suplente)) { Suplantar(); return 0; }
  47.     AttachObjectToPlayer(Flecha, Suplente, 0, 0, offset, 0, 0, 0);
  48.     Portador = Suplente;
  49.     SetPlayerColor(Suplente, 0xFF4040FF);
  50.     return 1;
  51. }
  52. public OnPlayerDeath(playerid, killerid, reason)
  53. {
  54.     if(Empezado == 1)
  55.     {
  56.         if(killerid != INVALID_PLAYER_ID && playerid == Portador)
  57.         {
  58.             AttachObjectToPlayer(Flecha, killerid, 0, 0, offset, 0, 0, 0);
  59.             Portador = killerid;
  60.         }
  61.         else if(killerid == INVALID_PLAYER_ID && playerid == Portador)
  62.         {
  63.             SetPlayerColor(Portador, 0xFFFF4055);
  64.             Suplantar();
  65.         }
  66.     }
  67.     return 1;
  68. }
  69. public OnPlayerCommandText(playerid, cmdtext[])
  70. {
  71.     if (strcmp("/Empezar", cmdtext, true, 10) == 0 && IsPlayerAdmin(playerid))
  72.     {
  73.         if(Empezado == 0)
  74.         {
  75.             Flecha = CreateObject(obj_flecha, 0, 0, -100, 0.0, 0.0, 0);
  76.             AttachObjectToPlayer(Flecha, playerid, 0, 0, offset, 0, 0, 0);
  77.             SendClientMessageToAll(0xDEEE20FF, "Empieza la matanza!");
  78.             SendClientMessageToAll(0xDEEE20FF, "Aniquila al jugador que tiene la flecha.");
  79.             Portador = playerid;
  80.             for(new i=0; i<MAX_PLAYERS; i++)
  81.             {
  82.                 Color[i] = GetPlayerColor(i);
  83.                 SetPlayerColor(i, 0xFFFF4055);
  84.             }
  85.             SetPlayerColor(Portador, 0xFF4040FF);
  86.             Empezado = 1;
  87.         }
  88.         else
  89.         {
  90.             SendClientMessage(playerid, 0xDEEE20FF, "El evento ya comenzo.");
  91.         }
  92.         return 1;
  93.     }
  94.     if ((strcmp("/Finalizar", cmdtext, true, 10) == 0 || strcmp("/Terminar", cmdtext, true, 10) == 0) && IsPlayerAdmin(playerid))
  95.     {
  96.         if(Empezado == 1)
  97.         {
  98.             DestroyObject(Flecha);
  99.             SendClientMessageToAll(0xDEEE20FF, "Evento finalizado");
  100.             Empezado = 0;
  101.             for(new i=0; i<MAX_PLAYERS; i++)
  102.             {
  103.                 SetPlayerColor(i, Color[i]);
  104.             }
  105.         }
  106.         else
  107.         {
  108.             SendClientMessage(playerid, 0xDEEE20FF, "El evento no esta en progreso.");
  109.         }
  110.         return 1;
  111.     }
  112.     return 0;
  113. }
  114. public OnPlayerSpawn(playerid)
  115. {
  116.     if(Empezado == 1 && playerid == Portador)
  117.     {
  118.         AttachObjectToPlayer(Flecha, playerid, 0, 0, offset, 0, 0, 0);
  119.         SetPlayerColor(Portador, 0xFF4040FF);
  120.     }
  121.     return 1;
  122. }
  123. public OnPlayerDisconnect(playerid, reason)
  124. {
  125.     if(Empezado == 1 && playerid == Portador)
  126.     {
  127.         SetPlayerColor(Portador, 0xFFFF4055);
  128.         Suplantar();
  129.     }
  130. }
  131. public OnPlayerStreamIn(playerid, forplayerid)
  132. {
  133.     if(playerid == Portador)
  134.     {
  135.         new Float:x, Float:y, Float:z;
  136.         GetPlayerPos(forplayerid, x, y, z);
  137.         MoveObject(Flecha, x, y, z, 1000000);
  138.         AttachObjectToPlayer(Flecha, playerid, 0, 0, offset, 0, 0, 0);
  139.     }
  140.     return 1;
  141. }
Advertisement
Add Comment
Please, Sign In to add comment