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

Ham_PainSound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 08-04-2023 , 21:48   Ham_PainSound
Reply With Quote #1

Hi, I was wondering, how can I use: Ham_PainSound, in Execute Ham, and what does that do?

PHP Code:
ExecuteHamHam_PainSoundthis ); 
MrPickles is offline
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 08-04-2023 , 22:47   Re: Ham_PainSound
Reply With Quote #3

Quote:
Originally Posted by mlibre View Post
PHP Code:
/**
     * Description:        Called when monster is about to emit pain sound.
     *                    Not guaranteed to actually emit sound. (random, time, etc..)
     * Forward params:    function(this);
     * Return type:        None.
     * Execute params:    ExecuteHam(Ham_PainSound, this);
     */ 
Thats exactly what i wrote, What is "this"?, and what happens when it is executed?
MrPickles is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 08-05-2023 , 11:20   Re: Ham_PainSound
Reply With Quote #4

Called when monster is about to emit pain sound. Not guaranteed to actually emit sound.

Quote:
Originally Posted by joaquimandrade View Post
Here goes a stupid example. When you scream in pain it also shows gibs. Also it shows how you can write more concise and efficient code when more functions are exposed:

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fakemeta_stocks>
#include <hamsandwich>
#include <xs>

#define PLUGIN    "New Plugin"
#define AUTHOR    "Unknown"
#define VERSION    "1.0"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_PainSound,"player","painSound",0)
}

public 
painSound(id)
{
    new 
Float:eyes[3]
    
    
ExecuteHam(Ham_EyePosition,id,eyes)
    
    
// Equivalent to:
    
new Float:origin[3], Float:view_ofs[3]
    
pev(id,pev_origin,origin)
    
pev(id,pev_view_ofs,view_ofs)
    
xs_vec_add(origin,view_ofs,origin)
    
//
    
    
ExecuteHam(Ham_GibMonster,id)
    
    
client_print(0,print_chat,"These vectors should be equal [%f][%f][%f] - [%f][%f][%f]",origin[0],origin[1],origin[2],eyes[0],eyes[1],eyes[2])

__________________
mlibre 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 08:12.


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