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


Messages In This Thread
Head Shot System Not Working Correctly. - by [L3th4l] - 21.07.2010, 20:53
Re: Head Shot System Not Working Correctly. - by Carlton - 22.07.2010, 02:12
Re: Head Shot System Not Working Correctly. - by MisterTickle - 22.07.2010, 02:17
Re: Head Shot System Not Working Correctly. - by Carlton - 22.07.2010, 02:19
Re: Head Shot System Not Working Correctly. - by [L3th4l] - 22.07.2010, 02:25

Forum Jump:


Users browsing this thread: 1 Guest(s)