![]() |
Getting the enemy's weapon-help plz
Hi all,
I'm trying to build a bot for counter-strike 1.6. I want to know what weapon the bot's sighted enemy is using. For that I'm using the entvars_s structure. I do something like this (short version): Code:
//What enemies do i see? Thanks, Paulo |
Re: Getting the enemy's weapon-help plz
weaponmodel field is a string, so you need to use a strcmp() stuff, so i advice you to use bits
if ((targetEnemy->v.weapons & (1 << CS_WEAPON_AWP))) m_botHasAWP = true; in this way =) |
Re: Getting the enemy's weapon-help plz
Thanks for the help!
Where do you find the weapons name like CS_WEAPON_AWP? I'm looking specifically for the gun and shield. ( I want to throw them grenades :D ) |
Re: Getting the enemy's weapon-help plz
np =)
Weapons: PHP Code:
To check if bot has shield use: PHP Code:
|
Re: Getting the enemy's weapon-help plz
well he wanted to get the current weapon which the enemy is using, which cannot be done using entvars_t::weapons ...
check for STRING(targetEnemy->v.viewmodel) may be a good idea for this. The values are usually "models/v_[weaponname].mdl" so just use strcmp to check it. |
All times are GMT +2. The time now is 22:25. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.