25.02.2010, 17:59
This would be kinda hard to realize because of the desync, but it looks something like this
You can get IsPlayerFacingPlayer here
http://forum.sa-mp.com/index.php?topic=130630.0
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;
}
http://forum.sa-mp.com/index.php?topic=130630.0