Raised This Month: $ Target: $400
 0% 

Best way to Detect Hit/Miss with Awp.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Paulster1022
Member
Join Date: Apr 2006
Old 04-24-2011 , 12:23   Re: Best way to Detect Hit/Miss with Awp.
Reply With Quote #3

Quote:
Originally Posted by SonicSonedit View Post
Paulster1022
This will not detect a hit through the wall or grenade hit.
You can use Ham_Takedamage to detect hit and Ham_Weapon_PrimaryAttack to detect shots count. Ham_Weapon_PrimaryAttack count - Ham_Takedamage count = miss count.

RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_awp" "ham_Weapon_PrimaryAttack")
RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage")

public ham_Weapon_PrimaryAttack(weapon_entity)
{
}

public ham_TakeDamage(victim, inflictor, attacker, Float:damage) // inflictor will probably be weapon_entity from function above
{
}
To detect a hit I would use Takedamage, but to detect a miss.... I need to detect the bullet shot and no damage occurred.
Code:
new bool: did_damage[33]

public ham_TakeDamage(victim, inflictor, attacker, Float:damage)
{
    if(inflictor == CSW_AWP)
        did_damage[attacker] = true
}

public ham_Weapon_PrimaryAttack(weapon_entity)
{
	for(new i = 0; i < g_maxplayers; i++)
	{
		if(is_user_alive(i))
		{
                        if(did_damage[i])
                        {
                              client_print(i, print_chat, "Hit with Awp!")
                              did_damage[i] = false
                        }
                  
                       else
                       {
                              client_print(i, print_chat, "Missed with Awp!")
                       }
                 }
        }
}
Ya there is no way this is working out correctly. Still unsure on detecting the shot missed.
Paulster1022 is offline
Send a message via AIM to Paulster1022
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode