Veteran Member
Join Date: Jul 2008
Location: Santiago, Chile
|
02-17-2010
, 18:47
Re: [TUT]Modulos basicos [Fun, Cstrike, Engine, Fakemeta, Hamsandwich]
|
#2
|
Hamsandwich - incompleto(falta traducir)
Regresar Arriba
PHP Code:
/* Hookea la tabla virtual para la clase de entidad especifica. * Mira en los Ham num en la lista de parametros. * * @param function La funcion que se hookeara * @param EntityClass El nombre de la entidad a Hookear * @param callback La forward que sera llamada. * @param post Whether or not to forward this in post. * @return Returns a handle to the forward. Use EnableHamForward/DisableHamForward to toggle the forward on or off. */ native HamHook:RegisterHam(Ham:function, const EntityClass[], const Callback[], Post=0);
/* Hookea la tabla virtual para la clase de entidad especifica. * Mira en los Ham num en la lista de parametros. * * @param function La funcion que se hookeara * @param EntityId El nombre de la entidad a Hookear * @param callback La forward que sera llamada. * @param post Whether or not to forward this in post. * @return Returns a handle to the forward. Use EnableHamForward/DisableHamForward to toggle the forward on or off. */ native HamHook:RegisterHamFromEntity(Ham:function, EntityId, const Callback[], Post=0);
Ejemplo: #include <engine> // modulo
public plugin_init() { register_plugin("Test RegisterHam", "Beta", "GlaDiuS") RegisterHam(Ham_Spawn, "player", "Funcion_Post", 1) // forward, cuando un jugador espawnea. (1 = despues de haber espawneado) RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_usp", "Funcion2_Post", 1) // forward, cuando un jugador apreta el boton secundario. (1 = despues de haber apretado el boton) new entity = create_entity("player") // creamos la entidad RegisterHamFromEntity(Ham_Killed, entity, "Funcion3") // forward, cuando la entidad muere. }
public Funcion_Post(index) client_print(index, print_chat, "Comienza la ronda. ¿Estas listo para matar?") // mensaje tipo chat
public Funcion2_Post(entity) { new index // variable para detectar al index index = entity_get_edict(entity, EV_ENT_owner) // detectamos al jugador que tiene la entidad. client_print(index, print_chat, "usaste el boton secundario con la USP") // mensaje tipo chat } public Funcion3(index, attacker) { new aName[32] // variable que usaremos para le nombre del atacante new idName[32] // variable que usaremos para le nombre de la victima get_user_name(attacker, aName, charsmax(aName)) // detectamos el nombre del atacante get_user_name(index, idName, charsmax(idName)) // detectamos el nombre de la victima client_print(index, print_chat, "te ha matado %s", aName) // mensaje tipo chat client_print(attacker, print_chat, "mataste a %s", idName) // mensaje tipo chat }
PHP Code:
/* Stops a ham forward from triggering. * Use the return value from RegisterHam as the parameter here! * * @param fwd The forward to stop. */ native DisableHamForward(HamHook:fwd);
/* Starts a ham forward back up. * Use the return value from RegisterHam as the parameter here! * * @param fwd The forward to re-enable. */ native EnableHamForward(HamHook:fwd);
/* Executes the virtual function on the entity. * Look at the Ham enum for parameter lists. * * @param function The function to call. * @param id The id of the entity to execute it on. */ native ExecuteHam(Ham:function, this, any:...);
/* Executes the virtual function on the entity, this will trigger all hooks on that function. * Be very careful about recursion! * Look at the Ham enum for parameter lists. * * @param function The function to call. * @param id The id of the entity to execute it on. */ native ExecuteHamB(Ham:function, this, any:...);
Ejemplo: #include <engine> // modulo
const EXTRAOFFSET_INDEX = 5 // offset para el player const OFFSET_ActiveItem = 373 // ofset del item que tiene en mano
new HamHook:ResetMaxSpeed // variable que saremos en enable/disable forward
public plugin_init() { register_plugin("Test Enable/Disable Forward & ExecuteHam/HamB", "Beta", "GlaDiuS") ResetMaxSpeed = RegisterHam(Ham_Item_PreFrame, "player", "Funcion_ResetMaxSpeed") // Ham hook que usaremos para la Maxspeed RegisterHam(Ham_Killed, "player", "Funcion_Killed") // forward, cuando el jugador muere. register_event("HLTV", "Funcion_NewRound", "a", "1=0", "2=0") // evento que es llamado cuando un playe esta con el freeze time register_logevent("Funcion_RoundStart", 2, "1=Round_Start") // evento llamado cuando se acaba el freeze tiem y puede moverse. }
public Funcion_Killed(index) { ExecuteHamB(Ham_CS_RoundRespawn, index); }
public Funcion_NewRound() { EnableHamForward(ResetMaxSpeed) // activamos la forward Ham_Item_PreFrame }
public Funcion_RoundStart() { DisableHamForward(ResetMaxSpeed) // paramos la llamada a la forward Ham_Item_PreFrame }
public Funcion_ResetMaxSpeed(index) { if( is_user_connected(index) && get_user_team(index) == 1) // detectamos si el jugador esta conectado y si es del team TT { new Float:MaxSpeed // variable para la speed new ActiveItem = get_pdata_cbase(index, OFFSET_ActiveItem, EXTRAOFFSET_INDEX) // detectamos el item que tenga el player if( ActiveItem > 0 ) // si el item es mayor a 0 { ExecuteHam(Ham_CS_Item_GetMaxSpeed, ActiveItem, MaxSpeed) // le seteamos el maxspeed que tenga el arma } else // contrario al if { MaxSpeed = 250.0 // si el player no tiene arma le seteamos 250 a la variable } entity_set_float(index, EV_FL_maxspeed, MaxSpeed) // le seteamos la velocidad return HAM_SUPERCEDE // el plugin termina } return HAM_IGNORED // el plugin continua }
PHP Code:
/* Gets the return status of the current hook. * This is useful to determine what return natives to use. * * @return The current status of the hook (such as HAM_SUPERCEDE). */ native GetHamReturnStatus();
/* Gets the return value of a hook for hooks that return integers or booleans. * * @param output The variable to store the value in. */ native GetHamReturnInteger(&output);
/* Gets the return value of a hook for hooks that return float. * * @param output The variable to store the value in. */ native GetHamReturnFloat(&Float:output);
/* Gets the return value of a hook for hooks that return Vectors. * * @param output The variable to store the value in. */ native GetHamReturnVector(Float:output[3]);
/* Gets the return value of a hook for hooks that return entities. * * @param output The variable to store the value in. Will be -1 on null. */ native GetHamReturnEntity(&output);
/* Gets the return value of a hook for hooks that return strings. * * @param output The buffer to store the string in. * @param size The string size of the buffer. */ native GetHamReturnString(output[], size);
/* Gets the original return value of a hook for hooks that return integers or booleans. * * @param output The variable to store the value in. */ native GetOrigHamReturnInteger(&output);
/* Gets the original return value of a hook for hooks that return floats. * * @param output The variable to store the value in. */ native GetOrigHamReturnFloat(&Float:output);
/* Gets the original return value of a hook for hooks that return Vectors. * * @param output The variable to store the value in. */ native GetOrigHamReturnVector(Float:output[3]);
/* Gets the original return value of a hook for hooks that return entities. * * @param output The variable to store the value in. -1 on null. */ native GetOrigHamReturnEntity(&output);
/* Gets the original return value of a hook for hooks that return strings. * * @param output The buffer to store the string in. * @param size The size of the buffer. */ native GetOrigHamReturnString(output[], size);
/* Sets the return value of a hook that returns an integer or boolean. * This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE. * * @param value The value to set the return to. */ native SetHamReturnInteger(value);
/* Sets the return value of a hook that returns a float. * This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE. * * @param value The value to set the return to. */ native SetHamReturnFloat(Float:value);
/* Sets the return value of a hook that returns a Vector. * This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE. * * @param value The value to set the return to. */ native SetHamReturnVector(const Float:value[3]);
/* Sets the return value of a hook that returns an entity. Set to -1 for null. * This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE. * * @param value The value to set the return to. */ native SetHamReturnEntity(value);
/* Sets the return value of a hook that returns a string. * This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE. * * @param value The value to set the return to. */ native SetHamReturnString(const value[]);
Ejemplo: public plugin_init() { register_plugin("Test GetOrigHam/Get/SetHamReturnStatus/Integer/Float/Vector/Entity/String", "Beta", "GlaDiuS") RegisterHam(Ham_TeamId, "player", "Funcion_Teamid") RegisterHam(Ham_BloodColor, "player", "Funcion_BloodColor") }
public Funcion_Teamid(index) { SetHamReturnString("Revolucion") // creamos un nombre al team new string[30] // variable para detectar el nombre del team new origstring[30] // variable para detectar el nombre original del team GetHamReturnString(string, charsmax(string)) // detectamos el nombre que tiene el team GetOrigHamReturnString(origstring, charsmax(origstring)) // detectamos el nombre original del team client_print(index, print_chat, "tu team es: %s , tu team original es", string, origstring) // mensaje tipo chat }
public Funcion_BloodColor(index) { SetHamReturnInteger(30) // creamos un numero para la sangre new integer // variable para detectar el valor de la sangre (hexadecimal) new originteger // variable para detectar el valor original de la sangre (hexadecimal) GetHamReturnInteger(integer) // detectamos el valor de la sangre GetOrigHamReturnInteger(originteger) // detectamos el valor original de la sangre client_print(0, print_chat, "El color (en formato HEX) de la sangre es: %d - color original %d", integer, originteger) // mensaje tipo chat }
PHP Code:
/* Sets a parameter on the fly of the current hook. This has no effect in post hooks. * Use this on parameters that are integers. * * @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this". * @param value The value to change it to. */ native SetHamParamInteger(which, value);
/* Sets a parameter on the fly of the current hook. This has no effect in post hooks. * Use this on parameters that are floats. * * @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this". * @param value The value to change it to. */ native SetHamParamFloat(which, Float:value);
/* Sets a parameter on the fly of the current hook. This has no effect in post hooks. * Use this on parameters that are Vectors. * * @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this". * @param value The value to change it to. */ native SetHamParamVector(which, const Float:value[3]);
/* Sets a parameter on the fly of the current hook. This has no effect in post hooks. * Use this on parameters that are entities. * * @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this". * @param value The value to change it to. */ native SetHamParamEntity(which, value);
/* Sets a parameter on the fly of the current hook. This has no effect in post hooks. * Use this on parameters that are strings. * * @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this". * @param value The value to change it to. */ native SetHamParamString(which, const output[]);
/* Sets a parameter on the fly of the current hook. This has no effect in post hooks. * Use this on parameters that are trace result handles. * * @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this". * @param value The value to change it to. */ native SetHamParamTraceResult(which, tr_handle);
Ejemplo: public plugin_init() { register_plugin("Test SetHamParamInteger/Float/Vector/Entity/String/TraceResult", "Beta", "GlaDiuS") RegisterHam(Ham_TakeDamage, "player", "Funcion_TakeDamage") // forward del takedamage }
public Funcion_TakeDamage(index, inflictor, attacker, Float:damage, damagebits) SetHamParamFloat(4, damage * 0.5) // le cambiamos el daño a todas las armas(daño del arma * 0.5)
PHP Code:
/* Returns whether or not the function for the specified Ham is valid. * Things that would make it invalid would be bounds (an older module version * may not have all of the functions), and the function not being found in * the mod's hamdata.ini file. * * @param function The function to look up. * @return true if the function is valid, false otherwise. */ native bool:IsHamValid(Ham:function);
Ejemplo: public plugin_init() { register_plugin("Test HamIsValid", "Beta", "GlaDiuS") if(IsHamValid(Ham_Spawn)) // detectamos si la forward es valida { RegisterHam(Ham_Spawn, "player", "Funcion_Spawn") // forward cuando un player espawnea } }
public Funcion_Spawn(index) client_print(index, print_chat, "ronda esta comenzado, ¿Listo para luchar?") // mensaje tipo chat
PHP Code:
/* This is used to compliment fakemeta's {get,set}_pdata_{int,float,string}. * This requires the mod to have the pev and base fields set in hamdata.ini. * Note this dereferences memory! Improper use of this will crash the server. * This will return an index of the corresponding cbase field in private data. * Returns -1 on a null entry. * * @param id The entity to examine the private data. * @param offset The windows offset of the data. * @param linuxdiff The linux difference of the data. * @return The index of the corresponding pdata field. -1 for none set. */ native get_pdata_cbase(id, offset, linuxdiff=5);
/* This is used to compliment fakemeta's {get,set}_pdata_{int,float,string}. * This requires the mod to have the pev and base fields set in hamdata.ini. * This will set the corresponding cbase field in private data with the index. * Pass -1 to null the entry. * * @param id The entity to examine the private data. * @param offset The windows offset of the data. * @param value The index to store, -1 for invalid * @param linuxdiff The linux difference of the data. */ native set_pdata_cbase(id, offset, value, linuxdiff=5);
/* This is similar to the get_pdata_cbase, however it does not dereference memory. * This is many times slower than get_pdata_cbase, and this should only be used * for testing and finding of offsets, not actual release quality plugins. * This will return an index of the corresponding cbase field in private data. * Returns -1 on a null entry. -2 on an invalid entry. * * @param id Entry to examine the private data. * @param offset The windows offset of the data. * @param linuxdiff The linux difference of the data. * @return The index of the corresponding pdata field, -1 for null, -2 for invalid. */ native get_pdata_cbase_safe(id, offset, linuxdiff=5);
Ejemplo: #include <engine> #include <fakemeta>
const m_pPlayer = 41 const m_flNextPrimaryAttack = 46 const m_flNextSecondaryAttack = 47 const LINUX_OFFSET_WEAPONS = 4
const m_iRadiosLeft = 192
public plugin_init() { register_plugin( "Test Get/Set_pdata_cbase/cbase_safe", "Beta", "GlaDiuS" ); // get_pdata_cbase RegisterHam(Ham_Item_Deploy, "weapon_knife", "Funcion_KnifeDeploy", 1); // forward , cuando obtiene un arma en este caso un knife // set_pdata_cbase RegisterHam(Ham_Spawn, "player", "Funcion_Spawn", 1 ); // forward, cuando espawnea new const Radio[3][] = { "radio1", "radio2", "radio3" } // registramos los tipos de radios que debemos bloquear for(new i; i <= 3; i++) // creamos un loop con las radios register_clcmd(Radio[i], "Radios") // aqui ponemos los comandos para ser bloqueados get_pdata_cbase_safe(index }
// set_pdata_cbase public Radios() return PLUGIN_HANDLED // no dejas que la funcion siga, se termina.
public Funcion_Spawn(index) { set_pdata_cbase(index, m_iRadiosLeft, 0) // con este bloqueamos la radio } //
// get_pdata_cbase - Creditos a Exolent public Funcion_KnifeDeploy(Entity) { new index = get_pdata_cbase(Entity, m_pPlayer) entity_set_string(index, EV_SZ_viewmodel, "") entity_set_string(index, EV_SZ_weaponmodel, "") set_pdata_float(Entity, m_flNextPrimaryAttack, 9999.0, LINUX_OFFSET_WEAPONS) set_pdata_float(Entity, m_flNextSecondaryAttack, 9999.0, LINUX_OFFSET_WEAPONS) }
PHP Code:
// This is the callback from the module, this handles any fatal errors. // This will in turn call the "HamFilter(Ham:id, HamError:err, const reason[])" public, if it exists. // Return PLUGIN_HANDLED from within the HamFilter to stop the plugin from failing. // Any other return value will fail the plugin. // You do not need to have a HamFilter, if there is none, all fatal errors will fail the plugin. // Do not modify this! public __fatal_ham_error(Ham:id, HamError:err, const reason[]) { new func=get_func_id("HamFilter", -1); new bool:fail=true; if (func != -1 && callfunc_begin_i(func, -1)==1) { callfunc_push_int(_:id); callfunc_push_int(_:err); callfunc_push_str(reason, false); if (callfunc_end()==PLUGIN_HANDLED) { fail=false; } } if (fail) { set_fail_state(reason); } }
Ham Constant
PHP Code:
enum Ham { /** * Description: This is typically called whenever an entity is created. * It is the virtual equivilent of spawn from the engine. * Some mods call this on player spawns too. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Spawn, this); */ Ham_Spawn = 0, /** * Description: This is typically called on map change. * This will typically precache all assets required by the entity. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Precache, this); */ Ham_Precache, /** * Description: Typically this is similar to an engine keyvalue call. * Use the kvd natives from fakemeta to handle the kvd_handle passed. * NOTE: Do not pass handle 0 to this! Use get_kvd_handle(0) from fakemeta instead! * Forward params: function(this, kvd_handle); * Return type: None. * Execute params: ExecuteHam(Ham_Keyvalue, this, kvd_handle); */ Ham_Keyvalue, /** * Description: Returns flags for how an entity can be used (FCAP_* constants in hlsdk_const.inc) * Forward params: function(this) * Return type: Integer. * Execute params: ExecuteHam(Ham_ObjectCaps, this); */ Ham_ObjectCaps, /** * Description: Usually called to activate some objects. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Activate, this); */ Ham_Activate, /** * Description: Usually called after the engine call with the same name. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_SetObjectCollisionBox, this); */ Ham_SetObjectCollisionBox, /** * Description: Returns an integer number that corresponds with what type of entity this is. * Forward params: function(this) * Return type: Integer. * Execute params: ExecuteHam(Ham_Classify, this); */ Ham_Classify, /** * Description: Typically called when an entity dies to notify any children entities about the death. * Forward params: function(this, idchild) * Return type: None. * Execute params: ExecuteHam(Ham_DeathNotice, this, idchild) */ Ham_DeathNotice, /** * Description: Usually called whenever an entity gets attacked by a hitscan (such as a gun) weapon. * Use the get/set tr2 natives in fakemeta to handle the traceresult data. * Do not use a handle of 0 as a traceresult in execution, use create_tr2() from Fakemeta * to pass a custom handle instead. (Don't forget to free the handle when you're done.) * Forward params: function(this, idattacker, Float:damage, Float:direction[3], traceresult, damagebits) * Return type: None. * Execute params: ExecuteHam(Ham_TraceAttack, this, idattacker, Float:damage, Float:direction[3], tracehandle, damagebits); */ Ham_TraceAttack, /** * Description: Usually called whenever an entity takes any kind of damage. * Inflictor is the entity that caused the damage (such as a gun). * Attacker is the entity that tirggered the damage (such as the gun's owner). * Forward params: function(this, idinflictor, idattacker, Float:damage, damagebits); * Return type: Integer. * Execute params: ExecuteHam(Ham_TakeDamage, this, idinflictor, idattacker, Float:damage, damagebits); */ Ham_TakeDamage, /** * Description: Usually called whenever an entity gets a form of a heal. * Forward params: function(this, Float:health, damagebits); * Return type: Integer. * Execute params: ExecuteHam(Ham_TakeHealth, this, Float:health, damagebits); */ Ham_TakeHealth, /** * Description: Normally called whenever an entity dies. * Forward params: function(this, idattacker, shouldgib) * Return type: None. * Execute params: ExecuteHam(Ham_Killed, this, idattacker, shouldgib); */ Ham_Killed, /** * Description: Normally returns the blood color of the entity. * Forward params: function(this) * Return type: Integer. * Execute params: ExecuteHam(Ham_BloodColor, this) */ Ham_BloodColor, /** * Description: Traces where blood should appear. * Forward params: function(this, Float:Damage, Float:Direction[3], trace_handle, damagebits); * Return type: None. * Execute params: ExecuteHam(Ham_TraceBleed, this, Float:damage, Float:direction[3], trace_handle, damagebits); */ Ham_TraceBleed, /** * Description: Returns whether an entity is activated. * Forward params: function(this, idActivator); * Return type: Integer. * Execute params: ExecuteHam(Ham_IsTriggered, this, idActivator); */ Ham_IsTriggered, /** * Description: Returns the id of the entity if its class is derived off of CBaseMonster, -1 otherwise. * Forward params: function(this) * Return type: Entity. * Execute params: ExecuteHam(Ham_MyMonsterPointer, this); */ Ham_MyMonsterPointer, /** * Description: Returns the id of the entity if its class is derived off of CBaseSquadMonster, -1 otherwise. * Forward params: function(this) * Return type: Entity. * Execute params: ExecuteHam(Ham_MySquadMonsterPointer, this); */ Ham_MySquadMonsterPointer, /** * Description: Returns the toggle state of the entity. * Forward params: function(this) * Return type: Integer. * Execute params: ExecuteHam(Ham_GetToggleState, this); */ Ham_GetToggleState, /** * Description: Typically adds points to the entity. * Forward params: function(this, points, bool:cangonegative); * Return type: None. * Execute params: ExecuteHam(Ham_AddPoints, this, points, bool:cangonegative); */ Ham_AddPoints,
/** * Description: Typically adds points to everybody on the entity's team. * Forward params: function(this, points, bool:cangonegative); * Return type: None. * Execute params: ExecuteHam(Ham_AddPointsToTeam, this, points, bool:cangonegative); */ Ham_AddPointsToTeam, /** * Description: Adds an item to the player's inventory. * Forward params: function(this, idother); * Return type: Integer. * Execute params: ExecuteHam(Ham_AddPlayerItem, this, idother); */ Ham_AddPlayerItem, /** * Description: Removes an item to the player's inventory. * Forward params: function(this, idother); * Return type: Integer. * Execute params: ExecuteHam(Ham_RemovePlayerItem, this, idother); */ Ham_RemovePlayerItem, /** * Description: Gives ammo to the entity. * Forward params: function(this, Amount, const Name[], Max) * Return type: Integer. * Execute params: ExecuteHam(Ham_GiveAmmo, this, amount, "type", max); */ Ham_GiveAmmo, /** * Description: Unsure, I believe this is the delay between activation for an entity. * Forward params: function(this) * Return type: Float. * Execute params: ExecuteHam(Ham_GetDelay, this, Float:output) */ Ham_GetDelay, /** * Description: Whether or not the entity is moving. * Forward params: function(this); * Return type: Integer. * Execute params: ExecuteHam(Ham_IsMoving, this); */ Ham_IsMoving, /** * Description: Unsure. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_OverrideReset, this) */ Ham_OverrideReset, /** * Description: Returns the damage decal of the entity for the damage type. * Forward params: function(this, damagebits) * Return type: Integer. * Execute params: ExecuteHam(Ham_DamageDecal, this); */ Ham_DamageDecal, /** * Description: Sets the toggle state of the entity. * Forward params: function(this, state) * Return type: None. * Execute params: ExecuteHam(Ham_SetToggleState, this, state); */ Ham_SetToggleState, /** * Description: Not entirely sure what this does. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_StartSneaking, this); */ Ham_StartSneaking,
/** * Description: Not entirely sure what this does. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_StopSneaking, this); */ Ham_StopSneaking, /** * Description: Not entirely sure. * Forward params: function(this, idOn) * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_OnControls, this, idOn); */ Ham_OnControls, /** * Description: Whether or not the entity is sneaking. * Forward params: function(this); * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_IsSneaking, this); */ Ham_IsSneaking, /** * Description: Whether or not the entity is alive. * Forward params: function(this); * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_IsAlive, this); */ Ham_IsAlive, /** * Description: Whether or not the entity uses a BSP model. * Forward params: function(this); * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_IsBSPModel, this); */ Ham_IsBSPModel, /** * Description: Whether or not the entity can reflect gauss shots.. * Forward params: function(this); * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_ReflectGauss, this); */ Ham_ReflectGauss, /** * Description: Whether or not the target is the same as the one passed. * Note the strindex parameter is a string passed that has been allocated by the engine. * Use fakemeta's EngFunc_SzFromIndex to convert to a normal string, or fakemeta's * EngFunc_AllocString to create a new string. * Forward params: function(this, strindex). * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_HasTarget, this, strindex); */ Ham_HasTarget, /** * Description: Whether or not the entity is in the world. * Forward params: function(this); * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_IsInWorld, this); */ Ham_IsInWorld, /** * Description: Whether or not the entity is a player. * Forward params: function(this); * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_IsPlayer, this); */ Ham_IsPlayer,
/** * Description: Whether or not the entity is a net client. * Forward params: function(this); * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_IsNetClient, this); */ Ham_IsNetClient,
/** * Description: Get the entity's team id. * Forward params: function(this); * Return type: String (string length returned and string byref'd in ExecuteHam). * Execute params: ExecuteHam(Ham_TeamId, this, buffer[], size); */ Ham_TeamId, /** * Description: Returns the next target of this. * Forward params: function(this); * Return type: Entity. * Execute params: ExecuteHam(Ham_GetNextTarget, this); */ Ham_GetNextTarget, /** * Description: Called whenever an entity thinks. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Think, this); */ Ham_Think, /** * Description: Called whenever two entities touch. * Forward params: function(this, idother); * Return type: None. * Execute params: ExecuteHam(Ham_Touch, this, idother); */ Ham_Touch, /** * Description: Called whenver one entity uses another. * Forward params: function(this, idcaller, idactivator, use_type, Float:value) * Return type: None. * Execute params: ExecuteHam(Ham_Use, this, idcaller, idactivator, use_type, Float:value); */ Ham_Use, /** * Description: Normally called whenever one entity blocks another from moving. * Forward params: function(this, idother); * Return type: None. * Execute params: ExecuteHam(Ham_Blocked, this, idother); */ Ham_Blocked, /** * Description: Normally called when a map-based item respawns, such as a health kit or something. * Forward params: function(this); * Return type: Entity. * Execute params: ExecuteHam(Ham_Respawn, this); */ Ham_Respawn, /** * Description: Used in Half-Life to update a monster's owner. * Forward params: function(this); * Return type: None. * Execute params: ExecuteHam(Ham_UpdateOwner, this); */ Ham_UpdateOwner, /** * Description: Normally called whenever a barnacle grabs the entity. * Forward params: function(this); * Return type: Integer. * Execute params: ExecuteHam(Ham_FBecomeProne, this); */ Ham_FBecomeProne, /** * Description: Returns the center of the entity. * Forward params: function(this); * Return type: Vector (byref'd in Execute). * Execute params: ExecuteHam(Ham_Center, this, Float:output[3]); */ Ham_Center, /** * Description: Returns the eye position of the entity. * Forward params: function(this); * Return type: Vector (byref'd in Execute). * Execute params: ExecuteHam(Ham_EyePosition, this, Float:output[3]); */ Ham_EyePosition,
/** * Description: Returns the ear position of the entity. * Forward params: function(this); * Return type: Vector (byref'd in Execute). * Execute params: ExecuteHam(Ham_EarPosition, this, Float:output[3]); */ Ham_EarPosition, /** * Description: Position to shoot at. * Forward params: function(this, Float:srcvector[3]); * Return type: Vector (byref'd in Execute). * Execute params: ExecuteHam(Ham_BodyTarget, Float:srcvector[3], Float:returnvector[3]) */ Ham_BodyTarget, /** * Description: Returns the illumination of the entity. * Forward params: function(this) * Return type: Integer. * Execute params: ExecuteHam(Ham_Illumination, this); */ Ham_Illumination, /** * Description: Unsure, I assume it is whether or not the other entity is visible to this entity. * Forward params: function(this, idOther); * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_FVisible, this, idOther); */ Ham_FVisible, /** * Description: Unsure, I assume it is whether or not the target vector is visible to this entity. * Forward params: function(this, const Float:origin[3]); * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_FVecVisible, this, const Float:origin[3]); */ Ham_FVecVisible,
/** * Players have all the attributes of normal entities, in addition to these. */ /** * Description: Typically called every frame when a player has jump held. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Player_Jump, this); */ Ham_Player_Jump,
/** * Description: Typically called every frame when a player has duck held. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Player_Duck, this); */ Ham_Player_Duck, /** * Description: Typically called every frame during PlayerPreThink engine call. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Player_PreThink, this); */ Ham_Player_PreThink,
/** * Description: Typically called every frame during PlayerPostThink engine call. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Player_PostThink, this); */ Ham_Player_PostThink, /** * Description: Returns a vector that tells the gun position. * Forward params: function(this) * Return type: Vector, byreffed in execute. * Execute params: ExecuteHam(Ham_Player_GetGunPosition, this, Float:output[3]); */ Ham_Player_GetGunPosition, /** * Description: Whether or not the player should fade on death. * Forward param: function(this) * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_Player_ShouldFadeOnDeath, this); */ Ham_Player_ShouldFadeOnDeath,
/** * Description: Called whenever an impulse command is executed. * Forward param: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Player_ImpulseComands, this); */ Ham_Player_ImpulseCommands, /** * Description: Updates the client's data for hud changes (such as ammo). Usually called every frame. * Forward param: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Player_UpdateClientData, this); */ Ham_Player_UpdateClientData, /** * Items have all the attributes of normal entities in addition to these. */ /** * Description: Adds the item to the player. * Forward params: function(this, idPlayer); * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_Item_AddToPlayer, this, idPlayer); */ Ham_Item_AddToPlayer,
/** * Description: Unsure. * Forward params: function(this, idOriginal); * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_Item_AddDuplicate, this, idOriginal); */ Ham_Item_AddDuplicate, /** * Description: Whether or not this entity can be deployed. * Forward params: function(this); * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_Item_CanDeploy, this); */ Ham_Item_CanDeploy, /** * Description: Deploys the entity (usually a weapon). * Forward params: function(this); * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_Item_Deploy, this); */ Ham_Item_Deploy, /** * Description: Whether or not the entity can be holstered. * Forward params: function(this); * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_Item_CanHolster, this); */ Ham_Item_CanHolster, /** * Description: Whether or not the entity (usually weapon) can be holstered. * Forward params: function(this) * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_Item_Holster, this); */ Ham_Item_Holster, /** * Description: Updates the HUD info about this item. * Forward params: function(this); * Return type: None. * Execute params: ExecuteHam(Ham_UpdateItemInfo, this); */ Ham_Item_UpdateItemInfo, /** * Description: Called each frame for an item, normally only on active items. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Item_PreFrame, this); */ Ham_Item_PreFrame, /** * Description: Called each frame for an item, normally only on active items. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Item_PostFrame, this); */ Ham_Item_PostFrame, /** * Description: Called when an item gets dropped, normally on death only. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Item_Drop, this); */ Ham_Item_Drop, /** * Description: Normally called when an item gets deleted. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Item_Drop, this); */ Ham_Item_Kill, /** * Description: Called when an entity starts being attached to (normally invisible and "following") a player. * Forward params: function(this, idPlayer) * Return type: None. * Execute params: ExecuteHam(Ham_Item_AttachToPlayer, this, idPlayer) */ Ham_Item_AttachToPlayer, /** * Description: Returns the ammo index of the item. * Forward params: function(this) * Return type: Integer. * Execute params: ExecuteHam(Ham_Item_PrimaryAmmoIndex, this); */ Ham_Item_PrimaryAmmoIndex, /** * Description: Returns the secondary ammo index of the item. * Forward params: function(this) * Return type: Integer. * Execute params: ExecuteHam(Ham_Item_SecondaryAmmoIndex, this); */ Ham_Item_SecondaryAmmoIndex,
/** * Description: Updates item data for the client. * Forward params: function(this, idPlayer) * Return type: Integer. * Execute params: ExecuteHam(Ham_Item_UpdateClientData, this, idPlayer); */ Ham_Item_UpdateClientData, /** * Description: Returns the entity index if the item is a weapon, -1 otherwise. * Forward params: function(this) * Return type: Entity. * Execute Params: ExecuteHam(Ham_Item_GetWeaponPtr, this) */ Ham_Item_GetWeaponPtr, /** * Description: Returns the item slot for the item. * Forward params: function(this) * Return type: Integer. * Execute Params: ExecuteHam(Ham_Item_ItemSlot, this) */ Ham_Item_ItemSlot, /** * Weapons have all the attributes to Ham_Item_*, in addition to these. */ /** * Description: Gets ammo from the target weapon. * Forward params: function(this, idTarget) * Return type: Integer. * Execute Params: ExecuteHam(Ham_Weapon_ExtractAmmo, this, idTarget) */ Ham_Weapon_ExtractAmmo,
/** * Description: Gets clip ammo from the target weapon. * Forward params: function(this, idTarget) * Return type: Integer. * Execute Params: ExecuteHam(Ham_Weapon_ExtractAmmo, this, idTarget) */ Ham_Weapon_ExtractClipAmmo, /** * Description: Unsure. * Forward params: function(this) * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_Weapon_AddWeapon, this); */ Ham_Weapon_AddWeapon, /** * Description: Plays the weapon's empty sound. * Forward params: function(this) * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_Weapon_PlayEmptySound, this); */ Ham_Weapon_PlayEmptySound,
/** * Description: Sets the weapon so that it can play empty sound again. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Weapon_ResetEmptySound, this); */ Ham_Weapon_ResetEmptySound, /** * Description: Sends an animation event for the weapon. * Forward params: function(this, iAnim, skiplocal, body); * Return type: None. * Execute params: ExecuteHam(Ham_Weapon_SendWeaponAnim, this, iAnim, skiplocal, body); */ Ham_Weapon_SendWeaponAnim, /** * Description: Whether or not the weapon is usable (has ammo, etc.) * Forward params: function(this) * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_Weapon_IsUsable, this) */ Ham_Weapon_IsUsable, /** * Description: Called when the main attack of a weapon is triggered. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Weapon_PrimaryAttack, this); */ Ham_Weapon_PrimaryAttack, /** * Description: Called when the secondary attack of a weapon is triggered. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Weapon_SecondaryAttack, this); */ Ham_Weapon_SecondaryAttack, /** * Description: Called when the weapon is reloaded. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Weapon_Reload, this); */ Ham_Weapon_Reload, /** * Description: Displays the idle animation for the weapon. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Weapon_WeaponIdle, this); */ Ham_Weapon_WeaponIdle, /** * Description: There is no more ammo for this gun, so switch to the next best one. * Forward params: function(this) * Return type: None. * ExecuteParams: ExecuteHam(Ham_Weapon_RetireWeapon, this) */ Ham_Weapon_RetireWeapon, /** * Description: Whether or not the weapon should idle. * Forward params: function(this) * Return type: Integer (boolean). * Execute Params: ExecuteHam(Ham_Weapon_ShouldWeaponIdle, this) */ Ham_Weapon_ShouldWeaponIdle, /** * Description: Not sure. * Forward params: function(this) * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_Weapon_UseDecrement, this); */ Ham_Weapon_UseDecrement, /** * Description: - * Forward params: function(this, someboolvalue) * Return type: None. * Execute params: ExecuteHam(Ham_TS_BreakableRespawn, this, someboolvalue); */ Ham_TS_BreakableRespawn, /** * Description: - * Forward params: function(this) * Return type: Integer (boolean) * Execute params: ExecuteHam(Ham_TS_CanUsedThroughWalls, this); */ Ham_TS_CanUsedThroughWalls, /** * Description: Unsure - this was removed in TS 3.0 (and thus is deprecated). * Forward params: function(this) * Return type: Integer (I think...) * Execute params: ExecuteHam(Ham_TS_RespawnWait, this); */ Ham_TS_RespawnWait,
/** * Description: This is called on a map reset for most map based entities. * Forward params: function(this); * Return type: None. * Execute params: ExecuteHam(Ham_CS_Restart, this); */ Ham_CS_Restart, /** * Description: Respawn function for players/bots only! Do not use this on non player/bot entities! * Forward params: function(this); * Return type: None. * Execute params: ExecuteHam(Ham_CS_RoundRespawn, this); */ Ham_CS_RoundRespawn, /** * Description: Whether or not the player can drop the specified item. * Forward params: function(this) * Return type: Integer * Execute params: ExecuteHam(Ham_CS_Item_CanDrop, this); */ Ham_CS_Item_CanDrop, /** * Description: Gets the maximum speed for whenever a player has the item deployed. * Forward params: function(this); * Return type: Float, byrefed in execute. * Execute params: ExecuteHam(Ham_CS_Item_GetMaxSpeed, this, Float:output); */ Ham_CS_Item_GetMaxSpeed,
/** * Description: I assume this spawns players at the start of a new round. * Forward params: function(this) * Return type: None. * Execute Params: ExecuteHam(Ham_DOD_RoundRespawn, this); */ Ham_DOD_RoundRespawn,
/** * Description: I assume this spawns entities (like func_breakables) at the start of a new round. * Forward params: function(this) * Return type: None. * Execute Params: ExecuteHam(Ham_DOD_RoundRespawnEnt, this); */ Ham_DOD_RoundRespawnEnt, /** * Description: Unsure. * Forward params: function(this) * Return type: None, I think... * Execute params: ExecuteHam(Ham_DOD_RoundStore, this); */ Ham_DOD_RoundStore, /** * Description: Unsure. * Forward params: function(this, someintegervalue) * Return type: None. * Execute params: ExecuteHam(Ham_DOD_AreaSetIndex, this, someintegervalue) */ Ham_DOD_AreaSetIndex, /** * Description: Unsure * Forward params: function(this, idPlayer) * Return type: None. * Execute Params: ExecuteHam(Ham_DOD_AreaSendStatus, this, idPlayer); */ Ham_DOD_AreaSendStatus, /** * Description: Unsure. * Forward params: function(this) * Return type: Integer. * Execute Params: ExecuteHam(Ham_DOD_GetState, this); */ Ham_DOD_GetState, /** * Description: Unsure. * Forward params: function(this, idtarget) * Return type: Integer. * Execute Params: ExecuteHam(Ham_DOD_GetStateEnt, this, idtarget); */ Ham_DOD_GetStateEnt, /** * Description: Whether or not a player can drop this item. * Forward params: function(this) * Return type: Integer (boolean). * Execute Params: ExecuteHam(Ham_DOD_Item_CanDrop, this); */ Ham_DOD_Item_CanDrop,
/** * Description: Unsure. * Forward params: function(this, iduser) * Return type: Integer. * Execute params: ExecuteHam(Ham_TFC_EngineerUse, this, iduser) */ Ham_TFC_EngineerUse, /** * Description: Unsure. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_TFC_Finished, this); */ Ham_TFC_Finished, /** * Description: Unsure. * Forward params: function(this, entityid, Float:floata, Float:floatb) * Return type: None. * Execute params: ExecuteHam(Ham_TFC_EmpExplode, this, entityid, Float:floata, Float:floatb) */ Ham_TFC_EmpExplode,
/** * Description: Unsure. * Forward params: function(this, Float:floata, Float:floatb) * Return type: None. * Execute params: ExecuteHam(Ham_TFC_CalcEmpDmgRad, this, Float:floata, Float:floatb) */ Ham_TFC_CalcEmpDmgRad, /** * Description: Unsure. * Forward params: function(this, entityid) * Return type: None. * Execute params: ExecuteHam(Ham_TFC_TakeEmpBlast, this, entityid); */ Ham_TFC_TakeEmpBlast, /** * Description: Unsure. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_TFC_EmpRemove, this); */ Ham_TFC_EmpRemove, /** * Description: Unsure. * Forward params: function(this, entityid, Float:floata) * Return type: None. * Execute params: ExecuteHam(Ham_TFC_TakeConcussionBlast, this, entityid, Float:floata); */ Ham_TFC_TakeConcussionBlast, /** * Description: Unsure. * Forward params: function(this, entityid) * Return type: None. * Execute params: ExecuteHam(Ham_TFC_Concuss, this, entityid); */ Ham_TFC_Concuss,
/** * Description: Unsure. * Is only in ESF Open Beta. * Forward params: function(this) * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_ESF_IsEnvModel, this); */ Ham_ESF_IsEnvModel, /** * Description: Unsure. * Is only in ESF Open Beta. * Forward params: function(this, entityida, entityidb, Float:floata, Float:floatb, dmgbits) * Return type: Integer. * Execute params: ExecuteHam(Ham_ESF_TakeDamage2, this, entityida, entityidb, Float:floata, Float:floatb, dmgbits); */ Ham_ESF_TakeDamage2,
/** * Description: Returns how many points each entity is worth. * Forward params: function(this) * Return type: Integer. * Execute params: ExecuteHam(Ham_NS_GetPointValue, this); */ Ham_NS_GetPointValue, /** * Description: Unsure. Probably awards this with the killing of idvictim. * Forward params: function(this, idvictim) * Return type: None. * Execute params: ExecuteHam(Ham_NS_AwardKill, this, idvictim); */ Ham_NS_AwardKill, /** * Description: Unsure, probably whenever an entity resets after a new round. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_NS_ResetEntity, this); */ Ham_NS_ResetEntity, /** * Description: Unsure. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_NS_UpdateOnRemove, this) */ Ham_NS_UpdateOnRemove,
/** Virtual functions added to TS in TS 3 */ /** * Description: Unsure. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_TS_GiveSlowMul, this) */ Ham_TS_GiveSlowMul, /** * Description: Unsure. The second paramater is actually a char. * Forward params: function(this, Float:someval, someotherval) * Return type: None. * Execute params: ExecuteHam(Ham_TS_GoSlow, this, Float:someval, someotherval) */ Ham_TS_GoSlow, /** * Description: Probably returns true if the user is in slow mo. * Forward params: function(this) * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_TS_InSlow, this) */ Ham_TS_InSlow, /** * Description: Returns true if the entity is an objective. * Forward params: function(this) * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_TS_IsObjective, this) */ Ham_TS_IsObjective, /** * Description: Unsure. * Forward params: function(this, bool:someval) * Return type: None. * Execute params: ExecuteHam(Ham_TS_EnableObjective, this, bool:someval) */ Ham_TS_EnableObjective, /** * Description: Probably called when the engine call to OnEntFreePrivateData is called (the entity destructor.) * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_TS_OnEntFreePrivateData, this) */ Ham_TS_OnFreeEntPrivateData, /** * Description: Probably called when the engine call to ShouldCollide is called. * Forward params: function(this, otherEntity) * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_TS_ShouldCollide, this, otherEntity) */ Ham_TS_ShouldCollide,
/** * DONT USE ME LOL */ HAM_LAST_ENTRY_DONT_USE_ME_LOL };
enum HamError { HAM_OK = 0, HAM_INVALID_FUNC, // The function is not valid HAM_FUNC_NOT_CONFIGURED, // This function is not configured in hamdata.ini HAM_ERR_END };
__________________
Proyects
Kreedz Chile Mod [100%] (Fixing some details).
Last edited by gladius; 12-28-2012 at 19:00.
|
|