[AJUDA]Head Shot
#1

ola a todos,bem,eu tenho um outro sistema de headshot aki,mas ele so da head shot com a sniper.
aki esta o codigo:
pawn Код:
#include <a_samp>

#define SERVER_MAX_PLAYERS 500

new RecentlyShot[SERVER_MAX_PLAYERS];

public OnFilterScriptInit()
{
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    RecentlyShot[playerid] = 0;
    return 1;
}

public OnPlayerUpdate(playerid)
{

    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE && newkeys & KEY_HANDBRAKE) {
        if(RecentlyShot[playerid] == 0) {
            RecentlyShot[playerid] = 1;
            SetTimerEx("AntiSpam", 1000, false, "d", playerid);
            if(GetPlayerWeapon(playerid) == 22 || GetPlayerWeapon(playerid) == 23 || GetPlayerWeapon(playerid) == 24 || GetPlayerWeapon(playerid) == 25 || GetPlayerWeapon(playerid) == 26 || GetPlayerWeapon(playerid) == 27 || GetPlayerWeapon(playerid) == 28 || GetPlayerWeapon(playerid) == 29 || GetPlayerWeapon(playerid) == 30 || GetPlayerWeapon(playerid) == 31 || GetPlayerWeapon(playerid) == 32 || GetPlayerWeapon(playerid) == 33 || GetPlayerWeapon(playerid) == 34 || GetPlayerWeapon(playerid) == 38) {
                new Float:blahx, Float:blahy, Float:blahz;
                HeadshotCheck(playerid, blahx, blahy, blahz);
                return 1;
            }
            return 1;
        }
        return 1;
    }
    return 1;
}

forward AntiSpam(playerid);
public AntiSpam(playerid) {
    RecentlyShot[playerid] = 0;
    return 1;
}

stock PlayerName(playerid) {
    new name[24];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}

stock HeadshotCheck(playerid, &Float:x, &Float:y, &Float:z)
{
    new Float:fx,Float:fy,Float:fz;
    GetPlayerCameraFrontVector(playerid, fx, fy, fz);

    new Float:cx,Float:cy,Float:cz;
    GetPlayerCameraPos(playerid, cx, cy, cz);

    for(new Float:i = 0.0; i < 50; i = i + 0.5)
    {
        x = fx * i + cx;
        y = fy * i + cy;
        z = fz * i + cz;

        #if defined SHOWPATH
        CreatePickup(1239, 4, x, y, z, -1);
        #endif

        for(new player = 0; player < SERVER_MAX_PLAYERS; player ++)
        {
            if(IsPlayerConnected(playerid))
            {
                if(player != playerid)
                {
                    if(GetPlayerSpecialAction(player) == SPECIAL_ACTION_DUCK)
                    {
                        if(IsPlayerInRangeOfPoint(player, 0.3, x, y, z))
                        {
                            GameTextForPlayer(playerid, "~r~HEADSHOT!", 2000, 6);
                            GameTextForPlayer(player, "~r~HEADSHOT!", 2000, 6);

                            SetPlayerHealth(player, 0.0);
                            CallRemoteFunction("OnPlayerDeath", "ddd", player, playerid, 34);
                        }
                    }
                    else
                    {
                        if(IsPlayerInRangeOfPoint(player, 0.3, x, y, z - 0.7))
                        {

                            GameTextForPlayer(playerid, "~r~HEADSHOT!", 2000, 6);
                            GameTextForPlayer(player, "~r~HEADSHOT!", 2000, 6);

                            SetPlayerHealth(player, 0.0);
                            CallRemoteFunction("OnPlayerDeath", "ddd", player, playerid, 34);
                        }
                    }
                }
            }
        }
    }
    return 1;
}
como podem ver nesta parte do codigo,eu tentei setar as armas,para dar head shot:
pawn Код:
if(GetPlayerWeapon(playerid) == 22 || GetPlayerWeapon(playerid) == 23 || GetPlayerWeapon(playerid) == 24 || GetPlayerWeapon(playerid) == 25 || GetPlayerWeapon(playerid) == 26 || GetPlayerWeapon(playerid) == 27 || GetPlayerWeapon(playerid) == 28 || GetPlayerWeapon(playerid) == 29 || GetPlayerWeapon(playerid) == 30 || GetPlayerWeapon(playerid) == 31 || GetPlayerWeapon(playerid) == 32 || GetPlayerWeapon(playerid) == 33 || GetPlayerWeapon(playerid) == 34 || GetPlayerWeapon(playerid) == 38)
mas nao deu certo,continua dando head shot so com a sniper,as outras armas nao funcionam.
o codigo que eu baixei,original,nesta parte dos ids das armas,tem apenas um id,que eh o da sniper:
pawn Код:
if(GetPlayerWeapon(playerid) == 34)
eh o id da sniper,eu tentei adicionar mais ids das armas,mas continua so a sniper dando head shot,eu ja tentei tambem com o tag && mas nao deu certo tambem.
como eu arrumo? por favor me ajudem,estou tentando arrumar isso a meses!
desde ja muitissimo obrigado.
Reply
#2

Tenta este aн
https://sampforum.blast.hk/showthread.php?tid=138791
Jб usei esse aн uma vez jб e gostei.

Espero ter ajudado =}
Reply
#3

Quote:
Originally Posted by Miqueias Barros
Посмотреть сообщение
Tenta este aн
https://sampforum.blast.hk/showthread.php?tid=138791
Jб usei esse aн uma vez jб e gostei.

Espero ter ajudado =}
nao obrigado,eu quero arrumar eh este meu sistema mesmo
alguem ai pode me ajudar por favor?
Reply
#4

Quote:
Originally Posted by Detonador
Посмотреть сообщение
nao obrigado,eu quero arrumar eh este meu sistema mesmo
alguem ai pode me ajudar por favor?
Cara ele te ofereceu ajuda e com um FS jб pronto, tu pode ficar tentando mil vezes que o erro persistir, baixa um jб pronto, https://sampforum.blast.hk/showthread.php?tid=138791

Desculpe, mais se nгo quiser, fica ai sem ajuda mesmo, nуs 2 tento te ajudar, mais se nгo quer...

Mais outra, eu acho que ninguйm vai te ajudar a resolver seu pawno ai, ele deve te passar o mesmo link para vocк vбrias vezes ou nem deve responder, desculpe pela resposta, mais й a verdade


@EDIT

Mais qualquer coisa, torзo ai pra tu conseguir
Reply
#5

pawn Код:
#include <a_samp>

#define SERVER_MAX_PLAYERS 500

new RecentlyShot[SERVER_MAX_PLAYERS];

new WeaponsTipe[]=
{
    22,
    23,
    24,
    25,
    26,
    27,
    28,
    29,
    30,
    31,
    32,
    33,
    34,
    38
};

public OnPlayerSpawn(playerid)
{
    RecentlyShot[playerid] = 0;
    return 1;
}

public OnPlayerUpdate(playerid)
{

    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE && newkeys & KEY_HANDBRAKE) {
        if(RecentlyShot[playerid] == 0) {
            RecentlyShot[playerid] = 1;
            SetTimerEx("AntiSpam", 1000, false, "d", playerid);
            if(GetPlayerWeapon(playerid) == 22 || GetPlayerWeapon(playerid) == 23 || GetPlayerWeapon(playerid) == 24 || GetPlayerWeapon(playerid) == 25 || GetPlayerWeapon(playerid) == 26 || GetPlayerWeapon(playerid) == 27 || GetPlayerWeapon(playerid) == 28 || GetPlayerWeapon(playerid) == 29 || GetPlayerWeapon(playerid) == 30 || GetPlayerWeapon(playerid) == 31 || GetPlayerWeapon(playerid) == 32 || GetPlayerWeapon(playerid) == 33 || GetPlayerWeapon(playerid) == 34 || GetPlayerWeapon(playerid) == 38) {
                new Float:blahx, Float:blahy, Float:blahz;
                HeadshotCheck(playerid, blahx, blahy, blahz);
                return 1;
            }
            return 1;
        }
        return 1;
    }
    return 1;
}

forward AntiSpam(playerid);
public AntiSpam(playerid) {
    RecentlyShot[playerid] = 0;
    return 1;
}

stock PlayerName(playerid) {
    new name[24];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
stock IsValidWeaponForHeadShot(playerid)
{
    for(new i; i < 64; ++i)
    {
        if(GetPlayerWeapon(playerid) == WeaponsTipe[i])
        {
            return true;
        }
    }
    return false;
}
stock HeadshotCheck(playerid, &Float:x, &Float:y, &Float:z)
{
    new Float:fx,Float:fy,Float:fz;
    GetPlayerCameraFrontVector(playerid, fx, fy, fz);

    new Float:cx,Float:cy,Float:cz;
    GetPlayerCameraPos(playerid, cx, cy, cz);

    for(new Float:i = 0.0; i < 50; i = i + 0.5)
    {
        x = fx * i + cx;
        y = fy * i + cy;
        z = fz * i + cz;

        #if defined SHOWPATH
        CreatePickup(1239, 4, x, y, z, -1);
        #endif

        for(new player = 0; player < SERVER_MAX_PLAYERS; player ++)
        {
            if(IsPlayerConnected(playerid))
            {
                if(player != playerid)
                {
                    if(GetPlayerSpecialAction(player) == SPECIAL_ACTION_DUCK)
                    {
                        if(IsValidWeaponForHeadShot(playerid))
                        {
                            if(IsPlayerInRangeOfPoint(player, 0.3, x, y, z))
                            {
                                GameTextForPlayer(playerid, "~r~HEADSHOT!", 2000, 6);
                                GameTextForPlayer(player, "~r~HEADSHOT!", 2000, 6);

                                SetPlayerHealth(player, 0.0);
                                CallRemoteFunction("OnPlayerDeath", "ddd", player, playerid, GetPlayerWeapon(playerid));
                            }
                        }
                    }
                    else
                    {
                        if(IsValidWeaponForHeadShot(playerid))
                        {
                            if(IsPlayerInRangeOfPoint(player, 0.3, x, y, z - 0.7))
                            {

                                GameTextForPlayer(playerid, "~r~HEADSHOT!", 2000, 6);
                                GameTextForPlayer(player, "~r~HEADSHOT!", 2000, 6);

                                SetPlayerHealth(player, 0.0);
                                CallRemoteFunction("OnPlayerDeath", "ddd", player, playerid, 34);
                            }
                        }
                    }
                }
            }
        }
    }
    return 1;
}

dei uma editada legal, as armas que quer para dar headshot, coloque na array 'WeaponsTipe'.

Abraзos.
Reply
#6

Quote:
Originally Posted by TheGarfield
Посмотреть сообщение
pawn Код:
#include <a_samp>

#define SERVER_MAX_PLAYERS 500

new RecentlyShot[SERVER_MAX_PLAYERS];

new WeaponsTipe[]=
{
    22,
    23,
    24,
    25,
    26,
    27,
    28,
    29,
    30,
    31,
    32,
    33,
    34,
    38
};

public OnPlayerSpawn(playerid)
{
    RecentlyShot[playerid] = 0;
    return 1;
}

public OnPlayerUpdate(playerid)
{

    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE && newkeys & KEY_HANDBRAKE) {
        if(RecentlyShot[playerid] == 0) {
            RecentlyShot[playerid] = 1;
            SetTimerEx("AntiSpam", 1000, false, "d", playerid);
            if(GetPlayerWeapon(playerid) == 22 || GetPlayerWeapon(playerid) == 23 || GetPlayerWeapon(playerid) == 24 || GetPlayerWeapon(playerid) == 25 || GetPlayerWeapon(playerid) == 26 || GetPlayerWeapon(playerid) == 27 || GetPlayerWeapon(playerid) == 28 || GetPlayerWeapon(playerid) == 29 || GetPlayerWeapon(playerid) == 30 || GetPlayerWeapon(playerid) == 31 || GetPlayerWeapon(playerid) == 32 || GetPlayerWeapon(playerid) == 33 || GetPlayerWeapon(playerid) == 34 || GetPlayerWeapon(playerid) == 38) {
                new Float:blahx, Float:blahy, Float:blahz;
                HeadshotCheck(playerid, blahx, blahy, blahz);
                return 1;
            }
            return 1;
        }
        return 1;
    }
    return 1;
}

forward AntiSpam(playerid);
public AntiSpam(playerid) {
    RecentlyShot[playerid] = 0;
    return 1;
}

stock PlayerName(playerid) {
    new name[24];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
stock IsValidWeaponForHeadShot(playerid)
{
    for(new i; i < 64; ++i)
    {
        if(GetPlayerWeapon(playerid) == WeaponsTipe[i])
        {
            return true;
        }
    }
    return false;
}
stock HeadshotCheck(playerid, &Float:x, &Float:y, &Float:z)
{
    new Float:fx,Float:fy,Float:fz;
    GetPlayerCameraFrontVector(playerid, fx, fy, fz);

    new Float:cx,Float:cy,Float:cz;
    GetPlayerCameraPos(playerid, cx, cy, cz);

    for(new Float:i = 0.0; i < 50; i = i + 0.5)
    {
        x = fx * i + cx;
        y = fy * i + cy;
        z = fz * i + cz;

        #if defined SHOWPATH
        CreatePickup(1239, 4, x, y, z, -1);
        #endif

        for(new player = 0; player < SERVER_MAX_PLAYERS; player ++)
        {
            if(IsPlayerConnected(playerid))
            {
                if(player != playerid)
                {
                    if(GetPlayerSpecialAction(player) == SPECIAL_ACTION_DUCK)
                    {
                        if(IsValidWeaponForHeadShot(playerid))
                        {
                            if(IsPlayerInRangeOfPoint(player, 0.3, x, y, z))
                            {
                                GameTextForPlayer(playerid, "~r~HEADSHOT!", 2000, 6);
                                GameTextForPlayer(player, "~r~HEADSHOT!", 2000, 6);

                                SetPlayerHealth(player, 0.0);
                                CallRemoteFunction("OnPlayerDeath", "ddd", player, playerid, GetPlayerWeapon(playerid));
                            }
                        }
                    }
                    else
                    {
                        if(IsValidWeaponForHeadShot(playerid))
                        {
                            if(IsPlayerInRangeOfPoint(player, 0.3, x, y, z - 0.7))
                            {

                                GameTextForPlayer(playerid, "~r~HEADSHOT!", 2000, 6);
                                GameTextForPlayer(player, "~r~HEADSHOT!", 2000, 6);

                                SetPlayerHealth(player, 0.0);
                                CallRemoteFunction("OnPlayerDeath", "ddd", player, playerid, 34);
                            }
                        }
                    }
                }
            }
        }
    }
    return 1;
}

dei uma editada legal, as armas que quer para dar headshot, coloque na array 'WeaponsTipe'.

Abraзos.
nao funcionou garfield! agora nao da head shot nem com a sniper!
que coisa estranha!
me ajuda por favor,preciso arruma issu!
Reply
#7

tenta

pawn Код:
#include <a_samp>

#define SERVER_MAX_PLAYERS 500

new RecentlyShot[SERVER_MAX_PLAYERS];

new WeaponsTipe[]=
{
    22,
    23,
    24,
    25,
    26,
    27,
    28,
    29,
    30,
    31,
    32,
    33,
    34,
    38
};

public OnPlayerSpawn(playerid)
{
    RecentlyShot[playerid] = 0;
    return 1;
}

public OnPlayerUpdate(playerid)
{

    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE && newkeys & KEY_HANDBRAKE) {
        if(RecentlyShot[playerid] == 0) {
            RecentlyShot[playerid] = 1;
            SetTimerEx("AntiSpam", 1000, false, "d", playerid);
            if(GetPlayerWeapon(playerid) == 22 || GetPlayerWeapon(playerid) == 23 || GetPlayerWeapon(playerid) == 24 || GetPlayerWeapon(playerid) == 25 || GetPlayerWeapon(playerid) == 26 || GetPlayerWeapon(playerid) == 27 || GetPlayerWeapon(playerid) == 28 || GetPlayerWeapon(playerid) == 29 || GetPlayerWeapon(playerid) == 30 || GetPlayerWeapon(playerid) == 31 || GetPlayerWeapon(playerid) == 32 || GetPlayerWeapon(playerid) == 33 || GetPlayerWeapon(playerid) == 34 || GetPlayerWeapon(playerid) == 38) {
                new Float:blahx, Float:blahy, Float:blahz;
                HeadshotCheck(playerid, blahx, blahy, blahz);
                return 1;
            }
            return 1;
        }
        return 1;
    }
    return 1;
}

forward AntiSpam(playerid);
public AntiSpam(playerid) {
    RecentlyShot[playerid] = 0;
    return 1;
}

stock PlayerName(playerid) {
    new name[24];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
stock IsValidWeaponForHeadShot(playerid)
{
    for(new i; i < 64; ++i)
    {
        if(GetPlayerWeapon(playerid) == WeaponsTipe[i])
        {
            return true;
        }
    }
    return false;
}
stock HeadshotCheck(playerid, &Float:x, &Float:y, &Float:z)
{
    new Float:fx,Float:fy,Float:fz;
    GetPlayerCameraFrontVector(playerid, fx, fy, fz);

    new Float:cx,Float:cy,Float:cz;
    GetPlayerCameraPos(playerid, cx, cy, cz);

    for(new Float:i = 0.0; i < 50; i = i + 0.5)
    {
        x = fx * i + cx;
        y = fy * i + cy;
        z = fz * i + cz;

        #if defined SHOWPATH
        CreatePickup(1239, 4, x, y, z, -1);
        #endif

        for(new player = 0; player < SERVER_MAX_PLAYERS; player ++)
        {
            if(IsPlayerConnected(playerid))
            {
                if(player != playerid)
                {
                    if(GetPlayerSpecialAction(player) == SPECIAL_ACTION_DUCK)
                    {
                        if(IsValidWeaponForHeadShot(playerid))
                        {
                            if(IsPlayerInRangeOfPoint(player, 0.3, x, y, z))
                            {
                                GameTextForPlayer(playerid, "~r~HEADSHOT!", 2000, 6);
                                GameTextForPlayer(player, "~r~HEADSHOT!", 2000, 6);

                                SetPlayerHealth(player, 0.0);
                                CallRemoteFunction("OnPlayerDeath", "ddd", player, playerid, GetPlayerWeapon(playerid));
                            }
                        }
                    }
                    else
                    {
                        if(IsValidWeaponForHeadShot(playerid))
                        {
                            if(IsValidWeaponForHeadShot(playerid))
                            {
                                if(IsPlayerInRangeOfPoint(player, 0.3, x, y, z - 0.7))
                                {

                                    GameTextForPlayer(playerid, "~r~HEADSHOT!", 2000, 6);
                                    GameTextForPlayer(player, "~r~HEADSHOT!", 2000, 6);

                                    SetPlayerHealth(player, 0.0);
                                    CallRemoteFunction("OnPlayerDeath", "ddd", player, playerid, 34);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return 1;
}
Reply
#8

Quote:
Originally Posted by TheGarfield
Посмотреть сообщение
tenta

pawn Код:
#include <a_samp>

#define SERVER_MAX_PLAYERS 500

new RecentlyShot[SERVER_MAX_PLAYERS];

new WeaponsTipe[]=
{
    22,
    23,
    24,
    25,
    26,
    27,
    28,
    29,
    30,
    31,
    32,
    33,
    34,
    38
};

public OnPlayerSpawn(playerid)
{
    RecentlyShot[playerid] = 0;
    return 1;
}

public OnPlayerUpdate(playerid)
{

    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE && newkeys & KEY_HANDBRAKE) {
        if(RecentlyShot[playerid] == 0) {
            RecentlyShot[playerid] = 1;
            SetTimerEx("AntiSpam", 1000, false, "d", playerid);
            if(GetPlayerWeapon(playerid) == 22 || GetPlayerWeapon(playerid) == 23 || GetPlayerWeapon(playerid) == 24 || GetPlayerWeapon(playerid) == 25 || GetPlayerWeapon(playerid) == 26 || GetPlayerWeapon(playerid) == 27 || GetPlayerWeapon(playerid) == 28 || GetPlayerWeapon(playerid) == 29 || GetPlayerWeapon(playerid) == 30 || GetPlayerWeapon(playerid) == 31 || GetPlayerWeapon(playerid) == 32 || GetPlayerWeapon(playerid) == 33 || GetPlayerWeapon(playerid) == 34 || GetPlayerWeapon(playerid) == 38) {
                new Float:blahx, Float:blahy, Float:blahz;
                HeadshotCheck(playerid, blahx, blahy, blahz);
                return 1;
            }
            return 1;
        }
        return 1;
    }
    return 1;
}

forward AntiSpam(playerid);
public AntiSpam(playerid) {
    RecentlyShot[playerid] = 0;
    return 1;
}

stock PlayerName(playerid) {
    new name[24];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
stock IsValidWeaponForHeadShot(playerid)
{
    for(new i; i < 64; ++i)
    {
        if(GetPlayerWeapon(playerid) == WeaponsTipe[i])
        {
            return true;
        }
    }
    return false;
}
stock HeadshotCheck(playerid, &Float:x, &Float:y, &Float:z)
{
    new Float:fx,Float:fy,Float:fz;
    GetPlayerCameraFrontVector(playerid, fx, fy, fz);

    new Float:cx,Float:cy,Float:cz;
    GetPlayerCameraPos(playerid, cx, cy, cz);

    for(new Float:i = 0.0; i < 50; i = i + 0.5)
    {
        x = fx * i + cx;
        y = fy * i + cy;
        z = fz * i + cz;

        #if defined SHOWPATH
        CreatePickup(1239, 4, x, y, z, -1);
        #endif

        for(new player = 0; player < SERVER_MAX_PLAYERS; player ++)
        {
            if(IsPlayerConnected(playerid))
            {
                if(player != playerid)
                {
                    if(GetPlayerSpecialAction(player) == SPECIAL_ACTION_DUCK)
                    {
                        if(IsValidWeaponForHeadShot(playerid))
                        {
                            if(IsPlayerInRangeOfPoint(player, 0.3, x, y, z))
                            {
                                GameTextForPlayer(playerid, "~r~HEADSHOT!", 2000, 6);
                                GameTextForPlayer(player, "~r~HEADSHOT!", 2000, 6);

                                SetPlayerHealth(player, 0.0);
                                CallRemoteFunction("OnPlayerDeath", "ddd", player, playerid, GetPlayerWeapon(playerid));
                            }
                        }
                    }
                    else
                    {
                        if(IsValidWeaponForHeadShot(playerid))
                        {
                            if(IsValidWeaponForHeadShot(playerid))
                            {
                                if(IsPlayerInRangeOfPoint(player, 0.3, x, y, z - 0.7))
                                {

                                    GameTextForPlayer(playerid, "~r~HEADSHOT!", 2000, 6);
                                    GameTextForPlayer(player, "~r~HEADSHOT!", 2000, 6);

                                    SetPlayerHealth(player, 0.0);
                                    CallRemoteFunction("OnPlayerDeath", "ddd", player, playerid, 34);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return 1;
}
agora so esta dando head shot com a sniper e a m4,as outras armas nao!
pq?
nao consigo entender issu!!!!
ajuda pelo amor de Deus!
faz meses e meses que tento arruma issu
Reply
#9

tamos chegando lб ...
pawn Код:
#include <a_samp>

#define SERVER_MAX_PLAYERS 500

new RecentlyShot[SERVER_MAX_PLAYERS];

new WeaponsTipe[]=
{
    22,
    23,
    24,
    25,
    26,
    27,
    28,
    29,
    30,
    31,
    32,
    33,
    34,
    38
};

public OnPlayerSpawn(playerid)
{
    RecentlyShot[playerid] = 0;
    return 1;
}

public OnPlayerUpdate(playerid)
{

    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE && newkeys & KEY_HANDBRAKE) {
        if(RecentlyShot[playerid] == 0) {
            RecentlyShot[playerid] = 1;
            SetTimerEx("AntiSpam", 1000, false, "d", playerid);
            if(GetPlayerWeapon(playerid) == 22 || GetPlayerWeapon(playerid) == 23 || GetPlayerWeapon(playerid) == 24 || GetPlayerWeapon(playerid) == 25 || GetPlayerWeapon(playerid) == 26 || GetPlayerWeapon(playerid) == 27 || GetPlayerWeapon(playerid) == 28 || GetPlayerWeapon(playerid) == 29 || GetPlayerWeapon(playerid) == 30 || GetPlayerWeapon(playerid) == 31 || GetPlayerWeapon(playerid) == 32 || GetPlayerWeapon(playerid) == 33 || GetPlayerWeapon(playerid) == 34 || GetPlayerWeapon(playerid) == 38) {
                new Float:blahx, Float:blahy, Float:blahz;
                HeadshotCheck(playerid, blahx, blahy, blahz);
                return 1;
            }
            return 1;
        }
        return 1;
    }
    return 1;
}

forward AntiSpam(playerid);
public AntiSpam(playerid) {
    RecentlyShot[playerid] = 0;
    return 1;
}

stock PlayerName(playerid) {
    new name[24];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
stock IsValidWeaponForHeadShot(playerid)
{
    for(new i; i < 64; ++i)
    {
        if(GetPlayerWeapon(playerid) == WeaponsTipe[i])
        {
            return true;
        }
    }
    return false;
}
stock HeadshotCheck(playerid, &Float:x, &Float:y, &Float:z)
{
    new Float:fx,Float:fy,Float:fz;
    GetPlayerCameraFrontVector(playerid, fx, fy, fz);

    new Float:cx,Float:cy,Float:cz;
    GetPlayerCameraPos(playerid, cx, cy, cz);

    for(new Float:i = 0.0; i < 50; i = i + 0.5)
    {
        x = fx * i + cx;
        y = fy * i + cy;
        z = fz * i + cz;

        #if defined SHOWPATH
        CreatePickup(1239, 4, x, y, z, -1);
        #endif

        for(new player = 0; player < SERVER_MAX_PLAYERS; player ++)
        {
            if(IsPlayerConnected(playerid))
            {
                if(player != playerid)
                {
                    if(GetPlayerSpecialAction(player) == SPECIAL_ACTION_DUCK)
                    {
                        if(IsValidWeaponForHeadShot(playerid))
                        {
                            if(IsPlayerInRangeOfPoint(player, 0.3, x, y, z))
                            {
                                GameTextForPlayer(playerid, "~r~HEADSHOT!", 2000, 6);
                                GameTextForPlayer(player, "~r~HEADSHOT!", 2000, 6);

                                SetPlayerHealth(player, 0.0);
                                CallRemoteFunction("OnPlayerDeath", "ddd", player, playerid, GetPlayerWeapon(playerid));
                            }
                        }
                    }
                    else
                    {
                        if(IsValidWeaponForHeadShot(playerid))
                        {
                            if(IsValidWeaponForHeadShot(playerid))
                            {
                                if(IsPlayerInRangeOfPoint(player, 0.3, x, y, z - 0.7))
                                {

                                    GameTextForPlayer(playerid, "~r~HEADSHOT!", 2000, 6);
                                    GameTextForPlayer(player, "~r~HEADSHOT!", 2000, 6);

                                    SetPlayerHealth(player, 0.0);
                                    CallRemoteFunction("OnPlayerDeath", "ddd", player, playerid, GetPlayerWeapon(playerid));
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return 1;
}
tenta ai.
Reply
#10

Quote:
Originally Posted by TheGarfield
Посмотреть сообщение
tamos chegando lб ...
pawn Код:
#include <a_samp>

#define SERVER_MAX_PLAYERS 500

new RecentlyShot[SERVER_MAX_PLAYERS];

new WeaponsTipe[]=
{
    22,
    23,
    24,
    25,
    26,
    27,
    28,
    29,
    30,
    31,
    32,
    33,
    34,
    38
};

public OnPlayerSpawn(playerid)
{
    RecentlyShot[playerid] = 0;
    return 1;
}

public OnPlayerUpdate(playerid)
{

    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE && newkeys & KEY_HANDBRAKE) {
        if(RecentlyShot[playerid] == 0) {
            RecentlyShot[playerid] = 1;
            SetTimerEx("AntiSpam", 1000, false, "d", playerid);
            if(GetPlayerWeapon(playerid) == 22 || GetPlayerWeapon(playerid) == 23 || GetPlayerWeapon(playerid) == 24 || GetPlayerWeapon(playerid) == 25 || GetPlayerWeapon(playerid) == 26 || GetPlayerWeapon(playerid) == 27 || GetPlayerWeapon(playerid) == 28 || GetPlayerWeapon(playerid) == 29 || GetPlayerWeapon(playerid) == 30 || GetPlayerWeapon(playerid) == 31 || GetPlayerWeapon(playerid) == 32 || GetPlayerWeapon(playerid) == 33 || GetPlayerWeapon(playerid) == 34 || GetPlayerWeapon(playerid) == 38) {
                new Float:blahx, Float:blahy, Float:blahz;
                HeadshotCheck(playerid, blahx, blahy, blahz);
                return 1;
            }
            return 1;
        }
        return 1;
    }
    return 1;
}

forward AntiSpam(playerid);
public AntiSpam(playerid) {
    RecentlyShot[playerid] = 0;
    return 1;
}

stock PlayerName(playerid) {
    new name[24];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
stock IsValidWeaponForHeadShot(playerid)
{
    for(new i; i < 64; ++i)
    {
        if(GetPlayerWeapon(playerid) == WeaponsTipe[i])
        {
            return true;
        }
    }
    return false;
}
stock HeadshotCheck(playerid, &Float:x, &Float:y, &Float:z)
{
    new Float:fx,Float:fy,Float:fz;
    GetPlayerCameraFrontVector(playerid, fx, fy, fz);

    new Float:cx,Float:cy,Float:cz;
    GetPlayerCameraPos(playerid, cx, cy, cz);

    for(new Float:i = 0.0; i < 50; i = i + 0.5)
    {
        x = fx * i + cx;
        y = fy * i + cy;
        z = fz * i + cz;

        #if defined SHOWPATH
        CreatePickup(1239, 4, x, y, z, -1);
        #endif

        for(new player = 0; player < SERVER_MAX_PLAYERS; player ++)
        {
            if(IsPlayerConnected(playerid))
            {
                if(player != playerid)
                {
                    if(GetPlayerSpecialAction(player) == SPECIAL_ACTION_DUCK)
                    {
                        if(IsValidWeaponForHeadShot(playerid))
                        {
                            if(IsPlayerInRangeOfPoint(player, 0.3, x, y, z))
                            {
                                GameTextForPlayer(playerid, "~r~HEADSHOT!", 2000, 6);
                                GameTextForPlayer(player, "~r~HEADSHOT!", 2000, 6);

                                SetPlayerHealth(player, 0.0);
                                CallRemoteFunction("OnPlayerDeath", "ddd", player, playerid, GetPlayerWeapon(playerid));
                            }
                        }
                    }
                    else
                    {
                        if(IsValidWeaponForHeadShot(playerid))
                        {
                            if(IsValidWeaponForHeadShot(playerid))
                            {
                                if(IsPlayerInRangeOfPoint(player, 0.3, x, y, z - 0.7))
                                {

                                    GameTextForPlayer(playerid, "~r~HEADSHOT!", 2000, 6);
                                    GameTextForPlayer(player, "~r~HEADSHOT!", 2000, 6);

                                    SetPlayerHealth(player, 0.0);
                                    CallRemoteFunction("OnPlayerDeath", "ddd", player, playerid, GetPlayerWeapon(playerid));
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return 1;
}
tenta ai.
deeeeeeeeeeeeeeeeeus ainda num deu!
agora so da com sniper!
e mesmo assim se mirar bem em cima da cabeзa
que coisaaaaaaaaaa
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)