message_stocks.inc: Cache messages id

This commit is contained in:
Karol Szuster 2016-03-20 13:04:48 +01:00
parent 7522403da8
commit 5a3f4be04e

View File

@ -19,7 +19,12 @@
/* Creates a death message. */ /* Creates a death message. */
stock dod_make_deathmsg(killer, victim, weaponNUM) stock dod_make_deathmsg(killer, victim, weaponNUM)
{ {
message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0); static msgid = 0;
if (!msgid)
{
msgid = get_user_msgid("DeathMsg");
}
message_begin(MSG_ALL, msgid, {0,0,0}, 0);
write_byte(killer); write_byte(killer);
write_byte(victim); write_byte(victim);
write_byte(weaponNUM); write_byte(weaponNUM);
@ -48,7 +53,12 @@ stock user_silentkill(index, flag = 1)
/* Creates a death message. */ /* Creates a death message. */
stock make_deathmsg(killer, victim, headshot, const weapon[]) stock make_deathmsg(killer, victim, headshot, const weapon[])
{ {
message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0); static msgid = 0;
if (!msgid)
{
msgid = get_user_msgid("DeathMsg");
}
message_begin(MSG_ALL, msgid, {0,0,0}, 0);
write_byte(killer); write_byte(killer);
write_byte(victim); write_byte(victim);