Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // filescript de Evento Flecha. By Chanfa
- //
- // si desean encontrarme en el foro busquenme como 'cocolabush' en la seccion Español.
- // ___________
- // ____________________________________|||||||||||____________________________________
- // ____________________________________INFORMACION____________________________________
- // |||||||||||
- // 09/10/2010 ¯¯¯¯¯¯¯¯¯¯¯
- // Sistema de creación de flecha sobre determinado jugador
- // Sistema de cambio portador al asesino
- // Sistema de restriccion para la iniciación (solo los admins estan autorizados)
- // Sistema simplificado para cambiar opciones visuales (offset y obj_flecha)
- //
- // 11/10/2010
- // Corregido el "bug 3": El error consistia en que solo parte de los usuarios veian la flecha
- // Sistema de cambio de color al iniciar y de restauracion del color anterior al finalizar el evento
- // Agregado texto del evento
- //
- #include <a_samp>
- #define offset 2 // Cambiar por la altura buscada sobre el jugador portador
- #define obj_flecha 1318 // Cambiar por el ID del objeto que se quira hacer aparecer en la cabeza del portador (recomendado: 1318)
- forward Suplantar();
- new Flecha;
- new Portador;
- new Empezado = 0;
- new Suplente;
- new Color[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Evento Flecha [DM]\n |By Chanfa|");
- print("--------------------------------------\n");
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- if(IsPlayerAdmin(i))
- {
- }
- }
- return 1;
- }
- public Suplantar()
- {
- Suplente = random(MAX_PLAYERS);
- if(!IsPlayerConnected(Suplente)) { Suplantar(); return -1; }
- if(IsPlayerNPC(Suplente)) { Suplantar(); return 0; }
- AttachObjectToPlayer(Flecha, Suplente, 0, 0, offset, 0, 0, 0);
- Portador = Suplente;
- SetPlayerColor(Suplente, 0xFF4040FF);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(Empezado == 1)
- {
- if(killerid != INVALID_PLAYER_ID && playerid == Portador)
- {
- AttachObjectToPlayer(Flecha, killerid, 0, 0, offset, 0, 0, 0);
- Portador = killerid;
- }
- else if(killerid == INVALID_PLAYER_ID && playerid == Portador)
- {
- SetPlayerColor(Portador, 0xFFFF4055);
- Suplantar();
- }
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/Empezar", cmdtext, true, 10) == 0 && IsPlayerAdmin(playerid))
- {
- if(Empezado == 0)
- {
- Flecha = CreateObject(obj_flecha, 0, 0, -100, 0.0, 0.0, 0);
- AttachObjectToPlayer(Flecha, playerid, 0, 0, offset, 0, 0, 0);
- SendClientMessageToAll(0xDEEE20FF, "Empieza la matanza!");
- SendClientMessageToAll(0xDEEE20FF, "Aniquila al jugador que tiene la flecha.");
- Portador = playerid;
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- Color[i] = GetPlayerColor(i);
- SetPlayerColor(i, 0xFFFF4055);
- }
- SetPlayerColor(Portador, 0xFF4040FF);
- Empezado = 1;
- }
- else
- {
- SendClientMessage(playerid, 0xDEEE20FF, "El evento ya comenzo.");
- }
- return 1;
- }
- if ((strcmp("/Finalizar", cmdtext, true, 10) == 0 || strcmp("/Terminar", cmdtext, true, 10) == 0) && IsPlayerAdmin(playerid))
- {
- if(Empezado == 1)
- {
- DestroyObject(Flecha);
- SendClientMessageToAll(0xDEEE20FF, "Evento finalizado");
- Empezado = 0;
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- SetPlayerColor(i, Color[i]);
- }
- }
- else
- {
- SendClientMessage(playerid, 0xDEEE20FF, "El evento no esta en progreso.");
- }
- return 1;
- }
- return 0;
- }
- public OnPlayerSpawn(playerid)
- {
- if(Empezado == 1 && playerid == Portador)
- {
- AttachObjectToPlayer(Flecha, playerid, 0, 0, offset, 0, 0, 0);
- SetPlayerColor(Portador, 0xFF4040FF);
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(Empezado == 1 && playerid == Portador)
- {
- SetPlayerColor(Portador, 0xFFFF4055);
- Suplantar();
- }
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- if(playerid == Portador)
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(forplayerid, x, y, z);
- MoveObject(Flecha, x, y, z, 1000000);
- AttachObjectToPlayer(Flecha, playerid, 0, 0, offset, 0, 0, 0);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment