AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ham_PainSound (https://forums.alliedmods.net/showthread.php?t=343547)

MrPickles 08-04-2023 21:48

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

PHP Code:

ExecuteHamHam_PainSoundthis ); 


mlibre 08-04-2023 22:28

Re: Ham_PainSound
 
https://github.com/alliedmodders/amx...c#L1295..L1300

MrPickles 08-04-2023 22:47

Re: Ham_PainSound
 
Quote:

Originally Posted by mlibre (Post 2808215)

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?

mlibre 08-05-2023 11:20

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

Quote:

Originally Posted by joaquimandrade (Post 1493221)
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])





All times are GMT -4. The time now is 18:23.

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