This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Hit Wall which part of body


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
elantra86
Member
Join Date: Feb 2014
Old 04-30-2020 , 12:44   Hit Wall which part of body
Reply With Quote #1

Hi all! Wanna create new plugin - for alert msg for user:
If user touch something - in air


PHP Code:
message_begin(MSG_ONEget_user_msgid("Damage"), _id); 
and create red blocks 1 or 2 on that side which part of body touching

PHP Code:
/* Sets hit zones for player.
 * Parts of body are as bits:
 * 1   - generic
 * 2   - head
 * 4   - chest
 * 8   - stomach
 * 16  - left arm
 * 32  - right arm
 * 64  - left leg
 * 128 - right leg */ 
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <engine>
#include <fakemeta>


public plugin_init()
{
    
RegisterHam(Ham_Touch"player""FwdPlayerTouch")
}

new 
Float:model_size[3];

public 
FwdPlayerTouch(ident)
{
    
entity_get_vector(idEV_VEC_sizemodel_size);
    
    if(!(
pev(idpev_flags) & FL_ONGROUND) && model_size[2] > 50.0 && is_user_alive(id))
    {
        new 
Float:origin[3]
        
entity_get_vector(idEV_VEC_originorigin)
        
        new 
hull = (get_entity_flags(id) & FL_DUCKING) ? HULL_HEAD HULL_HUMAN
        
        
new Float:temp_origin[3]
        for(new 
04i++)
        {
            
temp_origin origin
            temp_origin
[2] += ((2) ? -1.0 1.0)
            
temp_origin[2] += 22;
            if(
trace_hull(temp_originhullid1))
            {
                
take_damage(idtemp_origin)
                break
            }
        }
    }
}



stock take_damage(idFloat:origin[3])
{
    new 
gorigin[3];
    
gorigin[0] = floatround(origin[0]);
    
gorigin[1] = floatround(origin[1]);

    
gorigin[2] = floatround(origin[2]);

    
message_begin(MSG_ONEget_user_msgid("Damage"), _id);
    
write_byte(1); // damage save
    
write_byte(1); // damage take
    
write_long(DMG_GENERIC); // example dmg - DMG_POISON
    
write_coord(gorigin[0]); // x
    
write_coord(gorigin[1]); // y
    
write_coord(gorigin[2]); // z // use this for show the messaj up i tink more up?
    
message_end();

now when i touch wall i get red blocks from 4 side. can some one help with this?

Last edited by elantra86; 04-30-2020 at 13:27. Reason: Added Code
elantra86 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 13:01.


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