mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 14:25:38 +03:00
optimized a stock and created message_stocks.inc (am29627)
This commit is contained in:
parent
a1e8701236
commit
fb0d728720
@ -84,12 +84,7 @@ stock get_entity_flags(ent)
|
|||||||
/* Get the distance between two entities */
|
/* Get the distance between two entities */
|
||||||
stock get_entity_distance(ent1, ent2)
|
stock get_entity_distance(ent1, ent2)
|
||||||
{
|
{
|
||||||
new Float:orig1[3], Float:orig2[3]
|
return floatround(entity_range(ent1, ent2))
|
||||||
|
|
||||||
entity_get_vector(ent1, EV_VEC_origin, orig1)
|
|
||||||
entity_get_vector(ent2, EV_VEC_origin, orig2)
|
|
||||||
|
|
||||||
return floatround(get_distance_f(orig1, orig2))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get grenade thrown by this user */
|
/* Get grenade thrown by this user */
|
||||||
@ -154,45 +149,6 @@ stock get_speed(ent)
|
|||||||
return floatround(vector_length(Vel))
|
return floatround(vector_length(Vel))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Creates a death message. */
|
|
||||||
stock make_deathmsg(killer,victim,headshot,weapon[])
|
|
||||||
{
|
|
||||||
message_begin(MSG_ALL,get_user_msgid("DeathMsg"),{0,0,0},0)
|
|
||||||
write_byte( killer )
|
|
||||||
write_byte( victim )
|
|
||||||
|
|
||||||
new mod_name[32]
|
|
||||||
get_modname(mod_name,31)
|
|
||||||
if (equal(mod_name,"cstrike") || equal(mod_name,"czero") || equal(mod_name,"csv15") || equal(mod_name,"cs13"))
|
|
||||||
write_byte( headshot )
|
|
||||||
write_string( weapon )
|
|
||||||
message_end()
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Creates a death message. */
|
|
||||||
stock dod_make_deathmsg(killer,victim,weaponNUM)
|
|
||||||
{
|
|
||||||
|
|
||||||
message_begin(MSG_ALL,get_user_msgid("DeathMsg"),{0,0,0},0)
|
|
||||||
write_byte( killer )
|
|
||||||
write_byte( victim )
|
|
||||||
write_byte( weaponNUM)
|
|
||||||
message_end()
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Kills a user without a message. */
|
|
||||||
stock user_silentkill(index)
|
|
||||||
{
|
|
||||||
set_msg_block(get_user_msgid("DeathMsg"),BLOCK_ONCE)
|
|
||||||
user_kill(index,1)
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set rendering of an entity */
|
/* Set rendering of an entity */
|
||||||
stock set_rendering(index, fx=kRenderFxNone, r=255, g=255, b=255, render=kRenderNormal, amount=16)
|
stock set_rendering(index, fx=kRenderFxNone, r=255, g=255, b=255, render=kRenderNormal, amount=16)
|
||||||
{
|
{
|
||||||
|
50
plugins/include/message_stocks.inc
Normal file
50
plugins/include/message_stocks.inc
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/* Message Stocks
|
||||||
|
*
|
||||||
|
* by the AMX Mod X Development Team
|
||||||
|
*
|
||||||
|
* This file is provided as is (no warranties).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined _message_stocks_included
|
||||||
|
#endinput
|
||||||
|
#endif
|
||||||
|
#define _message_stocks_included
|
||||||
|
|
||||||
|
/* Creates a death message. */
|
||||||
|
stock dod_make_deathmsg(killer, victim, weaponNUM)
|
||||||
|
{
|
||||||
|
message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0);
|
||||||
|
write_byte(killer);
|
||||||
|
write_byte(victim);
|
||||||
|
write_byte(weaponNUM);
|
||||||
|
message_end();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Kills a user without a message. */
|
||||||
|
stock user_silentkill(index)
|
||||||
|
{
|
||||||
|
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_ONCE);
|
||||||
|
user_kill(index, 1);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Creates a death message. */
|
||||||
|
stock make_deathmsg(killer, victim, headshot, weapon[])
|
||||||
|
{
|
||||||
|
message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0);
|
||||||
|
write_byte(killer);
|
||||||
|
write_byte(victim);
|
||||||
|
|
||||||
|
new mod_name[32];
|
||||||
|
get_modname(mod_name, 31);
|
||||||
|
if (equal(mod_name, "cstrike") || equal(mod_name, "czero") || equal(mod_name, "csv15") || equal(mod_name, "cs13"))
|
||||||
|
write_byte(headshot);
|
||||||
|
write_string(weapon);
|
||||||
|
message_end();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
@ -11,6 +11,7 @@
|
|||||||
#define _coremsg_included
|
#define _coremsg_included
|
||||||
|
|
||||||
#include <message_const>
|
#include <message_const>
|
||||||
|
#include <message_stocks>
|
||||||
|
|
||||||
/* These functinos are used to generate client messages.
|
/* These functinos are used to generate client messages.
|
||||||
* You may generate menu, smoke, shockwaves, thunderlights,
|
* You may generate menu, smoke, shockwaves, thunderlights,
|
||||||
|
Loading…
Reference in New Issue
Block a user