This is a really big project for a begginer in Pawn and I think it's crazy. However I will help you.
Quote:
Originally Posted by SLC
I need references to tutorials or snippets related to monitoring various events such as bullet fired, bullet hit etc.
|
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
new g_iMaxPlayers;
public plugin_init()
{
g_iMaxPlayers = get_maxplayer();
RegisterHam(Ham_Weapon_PrimaryAttack, "player", "BulletFired", 0); // Bullet Fired forward
RegisterHam(Ham_TakeDamage, "player", "BulletHit", 1); // Bullet Hit forward
}
public BulletHit(victim, inflictor, attacker, Float:damage, damage_bit)
{
if(attacker && attacker <= g_iMaxPlayers)
{
// Bullet Hit is made (by attacker)
// Add your code here
}
}
public BulletFired(ent)
{
static id; id = pev(ent, pev_owner);
static iClip, iAmmo;
static iWeapon; iWeapon = get_user_weapon(id, iClip, iAmmo);
if(iWeapon == CSW_KNIFE) return HAM_IGNORED;
if(iWeapon == CSW_HEGRENADE) return HAM_IGNORED;
if(iWeapon == CSW_SMOKEGRENADE) return HAM_IGNORED;
if(iWeapon == CSW_FLASHBANG) return HAM_IGNORED;
if(iWeapon == CSW_C4) return HAM_IGNORED;
// If this isn't working, replace iClip with iAmmo
if(iClip == 0) return HAM_IGNORED;
// Bullet Fire is made
// Add your code here
}