Merge pull request #362 from Ni3znajomy/update-message-stocks

message_stocks.inc: Cache messages id
This commit is contained in:
Vincent Herbet 2016-03-20 13:13:58 +01:00
commit e6a2bc545c

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);