Tazer by a weapon?
#8

This would be kinda hard to realize because of the desync, but it looks something like this

pawn Код:
new
    Float:health[MAX_PLAYERS],
    shot[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
    GetPlayerHealth(playerid, health[playerid]);
    return 1;
}
public OnPlayerUpdate(playerid)
{
    new
        Float:temp;
    GetPlayerHealth(playerid, temp);
    if(health[playerid] > temp)
    {
        OnPlayerLooseHealth(playerid, temp, health[playerid]);
        GetPlayerHealth(playerid, health[playerid]);
    }
    return 1;
}

public OnPlayerKeyStateChange(playerid, oldkeys, newkeys)
{
    if((newkeys & KEY_FIRE) && GetPlayerWeapon(playerid) == some weapon id)
    {
        shot[playerid] = 1;
        SetTimerEx("ResetShot", 1500, 0, "d", playerid);
        return 1;
    }
}

OnPlayerLooseHealth(playerid, oldhealth, newhealth)
{
    for(new id = 0; id < MAX_PLAYERS; id++)
    {
        if(shot[id] == 1)
        {
            new
                Float:angle;
            GetPlayerFacingAngle(id, angle);
            if(IsPlayerFacingPlayer(id, playerid, 5.0))
            {
                //taze 'playerid'
                return 1;
            }
        }
    }
    return 1;
}

forward ResetShot(playerid);
public ResetShot(playerid)
{
    shot[playerid] = 0;
}
You can get IsPlayerFacingPlayer here
http://forum.sa-mp.com/index.php?topic=130630.0
Reply


Messages In This Thread
Tazer by a weapon? - by acade - 25.02.2010, 16:56
Re: Tazer by a weapon? - by dice7 - 25.02.2010, 16:59
Re: Tazer by a weapon? - by acade - 25.02.2010, 17:08
Re: Tazer by a weapon? - by acade - 25.02.2010, 17:19
Re: Tazer by a weapon? - by dice7 - 25.02.2010, 17:26
Re: Tazer by a weapon? - by acade - 25.02.2010, 17:34
Re: Tazer by a weapon? - by acade - 25.02.2010, 17:40
Re: Tazer by a weapon? - by dice7 - 25.02.2010, 17:59
Re: Tazer by a weapon? - by acade - 25.02.2010, 20:02
Re: Tazer by a weapon? - by acade - 25.02.2010, 20:26

Forum Jump:


Users browsing this thread: 1 Guest(s)