Syntax
function onPlayerUnderAttack(player,plr)
Example
function onPlayerUnderAttack(player,plr)
{
Message(player.Name+" is attacking "+plr.Name);
}
Source Code
CLIENT SIDE
function Player::PlayerShoot(player, weapon, hitEntity, hitPosition)
{
if (player == World.FindLocalPlayer()){
if (hitEntity.Type == 0){
local shooter = player;
local plr = hitEntity.ID;
local message = Stream();
message.WriteInt(12332115); // use unique integer
message.WriteString(plr.tostring());
Server.SendData(message);}
}}
SERVER SIDE
function onPlayerUnderAttack(player,plr)
{
Message(player.Name+" is attacking "+plr.Name);
}
function onClientScriptData( player )
{
local int = Stream.ReadInt(),
string = Stream.ReadString();
if (int == 12332115)
{
local plr = FindPlayer(string.tointeger());
if (plr){onPlayerUnderAttack(player,plr)}
}
}
Unfortunately, Player::PlayerShoot is not called for shotguns...