[Pedido] sitema de headshot
#1

tipo um cara da um tiro com sniper em qualquer parte do corpo do cara ae ele morre so com um tiro ajuda
Reply
#2

http://www.homehots.net/2011/06/head...em-funcao.html

ou

Quote:

#include <a_samp>

#define SERVER_MAX_PLAYERS 61

new RecentlyShot[SERVER_MAX_PLAYERS];

public OnFilterScriptInit()
{
print("\n\n_______________________________________ _______ ____________________");
print(" Lanзa Sistema Headshot por: Lucas_Rocha!");
print(" By: allef_Monster!");
print(" ---------------------------------------------------------------------");
LoadModules(0,1);
print("___________________________________________ _______ ________________\n\n");
return 1;
}

public OnFilterScriptExit()
{
print("\n\n_______________________________________ _______ ____________________");
print(" Lanзa Sistema de Headshot por: Lucas_Rocha descarregado!");
print(" By: allef_Monster!");
print(" ---------------------------------------------------------------------");
LoadModules(0,1);
print("___________________________________________ _______ ________________\n\n");
return 1;
}

public OnPlayerConnect(playerid) {
SendClientMessage(playerid, 0xFFFFFFFF, "Esse Servidor Utiliza Sistema de HeadShot!");
LoadModules(playerid,2);
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) == 34) {
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, &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))
{
new string[128];
format(string, sizeof(string), "[Aviso]Headshot: %s levou um Headshot do %s", PlayerName(player), PlayerName(playerid));
SendClientMessageToAll(0xFF9900AA, string);

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))
{
new string[128];
format(string, sizeof(string), "[Aviso]HeadShot: %s levou um Headshot do %s", PlayerName(player), PlayerName(playerid));
SendClientMessageToAll(0xFF9900AA, string);

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

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

stock LoadModules(playerid,funcao)
{
if(funcao==1) print("Esse Servidor Utiliza Sistema de HeadShot!");
if(funcao==2)
{
SendClientMessage(playerid, 0xFFFFFFFF, "Vocк Bobiou e Levou 1 HeadShot");
}

}

nao testado ...
Reply
#3

pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart) {

    if ( bodypart == BODY_PART_HEAD && weaponid >= 22 && weaponid <= 34 ) {
   
        SetPlayerHealth(damagedid, 0.0);
        GameTextForPlayer(playerid, "~r~Headshot!", 1000, 4);
    }
   
    return 1;
}
OBS:Funcional apenas para o SA-MP 0.3z!
Reply
#4

afz samp 0.3z ta com muitos bugs
Reply
#5

Quote:
Originally Posted by xXCallXX
Посмотреть сообщение
afz samp 0.3z ta com muitos bugs
Man, ainda й sistema beta ''-''
Reply
#6

hum.... mais 0.3x nao vir bugs nele
Reply
#7

Quote:
Originally Posted by xXCallXX
Посмотреть сообщение
hum.... mais 0.3x nao vir bugs nele
0.3x Foi lanзado oficialmente, o 0.3z ainda estб em fase de testes(beta) os bugs forem resolvidos ai sim ira vim o 0.3z oficial, tanto que no www.sa-mp.com(site oficial do samp) ainda estб na versгo 0.3x
Reply
#8

Isso Talvez Funcione

Obs: Nao Testei

Se Funcionar +rep

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(GetPlayerWeapon(issuerid)) == 34)// Geta ID Da Arma No Caso 34 Sniper Rifle
    {
        new Float:hp;
        GetPlayerHealth(playerid,hp);//Geta Para Ver A Vida
        SetPlayerHealth(playerid, hp -100);// Seta A Vida A 0
    }
}
Resumo: Qualquer Um Que Usar A Sniper Rifle Vai Matar O Outro Player [Resolvi Um Bug]
Reply
#9

LucasPR2013 esse cуdigo vai fazer com quem atirar com a arma com ID:34 , matar o outro fбcil, mesmo se o tire pegar no PЙ. '-'
Reply
#10

Davi54723

1- No Comeco Ele Disse 1 Tiro Em Qualquer Parte Do Corpo
2- E o ID 34 E a Sniper Nao E O Id Do Player
3- Isso Pode Modificar Para Ficar So Um Tipo De Skin Usando
Exemplo:
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(GetPlayerSkin(issuerid)) == 286)//Skin Do FBI
    {
        if(GetPlayerWeapon(issuerid)) == 34)// ID Da Arma No Caso 34 Sniper Rifle
        {
            new Float:hp;
            GetPlayerHealth(playerid,hp);//Geta Para Ver A Vida
            SetPlayerHealth(playerid, hp -100);// Seta A Vida A 0
        }
    }
}
Assim So Quem Tem A Skin Do FBI Mata Com 1 Tiro
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)