Head Shot System Not Working Correctly.
#1

Here is the code im using:

pawn Код:
if(newkeys & KEY_FIRE && newkeys & KEY_HANDBRAKE)
{
        if(GetPlayerWeapon(playerid) == 34)
        {
            new Float:HSX, Float:HSY, Float:HSZ;
            return HeadshotCheck(playerid, HSX, HSY, HSZ);
        }
        return 1;
}
That goes under OnPlayerKeyStateChange..

This is the function:

pawn Код:
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;
        CreatePickup(1239, 4, X, Y, Z, -1);
        foreach(Player,player)
        {
            if(IsPlayerInRangeOfPoint(player, 0.3, X, Y, Z - 0.7))
            {
                if(player != playerid)
                {
                    format(Msg, sizeof(Msg), "HEADSHOT: \"%s\" Was Shot By \"%s\"", pName(player), pName(playerid));
                    SetPlayerHealth(player, 0.0);
                    SendNewsMessage(COLOR_IVORY,Msg);
                }
            }
        }
    }
    return 1;
}
Well right now im stucked with that, cause SOMEONE deleted Seif_'s account and well the file went with it.

So yeah, when i shoot someone near the head with sniper, it won't instant kill him. any suggestions?

btw, ignore the Sendnews... thats on my script, not related to the HeadShot function.
Reply
#2

pawn Код:
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;
        CreatePickup(1239, 4, X, Y, Z, -1);
        foreach(Player,player)
        {
             if(player != playerid)
             {
                    format(Msg, sizeof(Msg), "HEADSHOT: \"%s\" Was Shot By \"%s\"", pName(player), pName(playerid));
                    SetPlayerHealth(player, 0.0);
                    SendNewsMessage(COLOR_IVORY,Msg);
             }
        }
    }
    return 1;
}
Reply
#3

Seif's Body Detection Script is on the SAMP market.
Reply
#4

http://www.cos-rp.com/downloads/bodyparts.zip
Reply
#5

Ok thanx Carlton for pointing that out, and also thanx Mister for the info. Forgot he had scripts up there
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)