head shoot system
#1

Hola , estoy con el sistema de headshot pero nose porquй pero no funciona,

pawn Код:
#define TIMER_INTERVAL 150
new maxPlayers;
OnFilterScriptInit:
pawn Код:
public OnFilterScriptInit()
{
fogueo = 0;
maxPlayers = GetMaxPlayers();
SetTimer("CheckHeadShot", TIMER_INTERVAL, 1);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
if(fogueo == 1)
{
if(GetPVarInt(playerid, "Headshotted") == 1)
{
SetPVarInt(playerid, "Headshotted", 0);
}
}
return 1;
}

forward CheckHeadShot();

public CheckHeadShot()
{
if(fogueo == 1)
{
new index;
for(new playerid; playerid < maxPlayers; playerid++)
{
if(IsPlayerConnected(playerid))
{
index = GetPlayerAnimationIndex(playerid);
if(index == 1173 || index == 1175 || index == 1177 || index == 1178)
{
SetPVarInt(playerid, "Headshotted", 1);
SetPlayerHealth(playerid, 0);
}
}
}
}
return 1;
}
Aparte de eso tengo un comando que activa "fogueo".

la cosa es que pawn no me da ningun error pero cuando activo "fogueo" y doy en la cabeza no muere xDDD
Reply
#2

pawn Код:
if(fogueo == 1)
{
new index;
index = GetPlayerAnimationIndex(playerid);
if(index == 1173 || index == 1175 || index == 1177 || index == 1178)
{
SetPVarInt(playerid, "Headshotted", 1);
SetPlayerHealth(playerid, 0);
}
}
Eso ponlo en OnPlayerTakeDamage, y asegurate que la var de fogueo se active en el propio FS, ya que si es el GM fogueo seguirб siendo 0 en el FS. Lo del timer puedes quitarlo, es mбs eficiente de esta forma.
Reply
#3

Se debe utilizar la variable fogueo como un array unidimensional, ejemplo:

pawn Код:
static fogueo[MAX_PLAYERS];

fogueo[playerid] ==1 .........
PD: Su variable solo funciona con un solo jugador y me imagino que para usted testearlo deben ser 2 jugadores como minimo.

Un saludo.
Reply
#4

em... lo primero no funciona y lo segundo no lo he entendido mucho xDDDD

(llevo 4 meses sin hacer nada y se me olvida todo)
Reply
#5

pon todo el sistema de headshot que tienes
Reply
#6

pawn Код:
#include <a_samp>

#define TIMER_INTERVAL 150
#define amarillo 0xE7F016C8

new fogueo;
new maxPlayers;

public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp("/fogueo", cmdtext, true, 9) == 0)
  {
    if(fogueo == 0)
    {
    fogueo = 1;
    SendClientMessage(playerid, amarillo, "Ahora todas tus balas SON de Fogueo");
    }
    else
    {
    if(fogueo == 1)
    {
    fogueo = 0;
    SendClientMessage(playerid, amarillo, "Ahora todas tus balas NO son de Fogueo");
    }
    }
    return 1;
  }
  return 0;
}

public OnFilterScriptInit()
{
fogueo = 0;
maxPlayers = GetMaxPlayers();
SetTimer("CheckHeadShot", TIMER_INTERVAL, 1);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
if(fogueo == 1)
{
if(GetPVarInt(playerid, "Headshotted") == 1)
{
SetPVarInt(playerid, "Headshotted", 0);
}
}
return 1;
}

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(fogueo == 1)
    {
     if(issuerid != INVALID_PLAYER_ID)
     {
        ApplyAnimation(playerid,"ped","gas_cwr",4.1,0,1,1,0,0);
        static Float:SacarVida;
        GetPlayerHealth(playerid, SacarVida);
        SetPlayerHealth(playerid, SacarVida-1);
     }

     }
    return 1;
}

forward CheckHeadShot();

public CheckHeadShot()
{
if(fogueo == 1)
{
new index;
for(new playerid; playerid < maxPlayers; playerid++)
{
if(IsPlayerConnected(playerid))
{
index = GetPlayerAnimationIndex(playerid);
if(index == 1173 || index == 1175 || index == 1177 || index == 1178)
{
SetPVarInt(playerid, "Headshotted", 1);
SetPlayerHealth(playerid, 0);
}
}
}
}
return 1;
}
Reply
#7

prueba asi

pawn Код:
#include <a_samp>

#define amarillo 0xE7F016C8

new fogueo;

public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp("/fogueo", cmdtext, true, 9) == 0)
  {
    if(fogueo == 0)
    {
    fogueo = 1;
    SendClientMessage(playerid, amarillo, "Ahora todas tus balas SON de Fogueo");
    }
    else if(fogueo == 1)
    {
    fogueo = 0;
    SendClientMessage(playerid, amarillo, "Ahora todas tus balas NO son de Fogueo");
    }
    return 1;
  }
  return 0;
}

public OnPlayerDeath(playerid, killerid, reason)
{
if(fogueo == 0)
{
if(GetPVarInt(playerid, "Headshotted") == 1)
{
SetPVarInt(playerid, "Headshotted", 0);
}
}
return 1;
}

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
     if(fogueo == 1)
     {
     if(issuerid != INVALID_PLAYER_ID)
     {
        ApplyAnimation(playerid,"ped","gas_cwr",4.1,0,1,1,0,0);
        static Float:SacarVida;
        GetPlayerHealth(playerid, SacarVida);
        SetPlayerHealth(playerid, SacarVida-1);
     }
     }
     if(fogueo == 0)
     {
     new index;
     if(IsPlayerConnected(playerid))
     {
     index = GetPlayerAnimationIndex(playerid);
     if(index == 1173 || index == 1175 || index == 1177 || index == 1178)
     {
     SetPVarInt(playerid, "Headshotted", 1);
     SetPlayerHealth(playerid, 0);
     }
     }
     }
    return 1;
}
Reply
#8

pawn Код:
#include <a_samp>

#define amarillo 0xE7F016C8

static fogueo[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp("/fogueo", cmdtext, true, 9) == 0)
  {
    if(fogueo[playerid] == 0)
    {
    fogueo[playerid] = 1;
    SendClientMessage(playerid, amarillo, "Ahora todas tus balas SON de Fogueo");
    }
    else
    {
    if(fogueo[playerid] == 1)
    {
    fogueo[playerid] = 0;
    SendClientMessage(playerid, amarillo, "Ahora todas tus balas NO son de Fogueo");
    }
    }
    return 1;
  }
  return 0;
}

public OnPlayerDeath(playerid, killerid, reason)
{
if(fogueo[playerid] == 1)
{
if(GetPVarInt(playerid, "Headshotted") == 1)
{
SetPVarInt(playerid, "Headshotted", 0);
}
}
return 1;
}

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
     if(fogueo[playerid] == 1)
     {
     if(issuerid != INVALID_PLAYER_ID)
     {
        ApplyAnimation(playerid,"ped","gas_cwr",4.1,0,1,1,0,0);
        static Float:SacarVida;
        GetPlayerHealth(playerid, SacarVida);
        SetPlayerHealth(playerid, SacarVida-1);
        new index;
        if(IsPlayerConnected(playerid))
        {
        index = GetPlayerAnimationIndex(playerid);
        if(index == 1173 || index == 1175 || index == 1177 || index == 1178)
        {
     SetPVarInt(playerid, "Headshotted", 1);
     SetPlayerHealth(playerid, 0);
     }
     }
     }
     }
     return 1;
}
asн?
Reply
#9

gas_cwr es una de las anims que recibe el index?
Reply
#10

si, pero ahora no va nada xDDD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)