Raised This Month: $51 Target: $400
 12% 

Solved [L4D2/Actions Extensions] How can I get attack target in SurvivorAttack?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
little_froy
Senior Member
Join Date: May 2021
Old 03-11-2024 , 19:26   [L4D2/Actions Extensions] How can I get attack target in SurvivorAttack?
Reply With Quote #1

action.Get(0x34) & 0xFFF not works for this. How can I get attack target? I want to prevent some attack.

PHP Code:
public void OnActionCreated(BehaviorAction actionint actor, const char[] name)
{
    if(
strncmp(name"Survivor"8) == 0)
    {
        if(
strcmp(name[8], "Attack") == 0)
        {
            
action.SelectTargetPoint on_Attack;
        }
    }
}

Action on_Attack(BehaviorAction actionAddress nextbotint entityfloat vec[3])
{
    
int target get_entity_from_address(view_as<Address>(entity));
    
PrintToChatAll("%N:%d"action.Actortarget);
    return 
Plugin_Continue;
}

int get_entity_from_address(Address addr)
{
    
int entity = -1;
    while((
entity FindEntityByClassname(entity"*")) != -1)
    {
        if(
entity >= && GetEntityAddress(entity) == addr)
        {
            return 
entity;
        }
    }
    return -
1;


Last edited by little_froy; 03-12-2024 at 04:42.
little_froy is offline
Reply



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 18:59.


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