PDA

View Full Version : TE_GUNSHOT correctly


Sputnik53
04-07-2008, 09:56
Hi, I've been trying to print a gunshot decal to a brush entity but this is just crashing the server...
message_begin(MSG_ALL, SVC_TEMPENTITY, iOrigin)
write_byte(TE_GUNSHOT)
write_coord(iOrigin[0])
write_coord(iOrigin[1])
write_coord(iOrigin[2])
message_end()
How do I do it properly?

Exolent[jNr]
04-07-2008, 09:58
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
This way, its to everyone, but unreliable.
Also, iOrigin might be messing it up inside the message_begin().

Sputnik53
04-07-2008, 12:34
Oh sry, I meant TE_GUNSHOTDECAL not TE_GUNSHOT. :/

Exolent[jNr]
04-07-2008, 12:49
message_const.inc
#define TE_GUNSHOTDECAL 109 // Decal and ricochet sound
// write_byte(TE_GUNSHOTDECAL)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_short(entity index???)
// write_byte(decal???)

Sputnik53
04-07-2008, 13:18
Hmm and what do I write to entity index? :/

Exolent[jNr]
04-07-2008, 13:20
My guess would be the player index or the entity index of the weapon the player is holding.

Sputnik53
04-07-2008, 13:56
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_GUNSHOTDECAL)
write_coord(iOrigin[0])
write_coord(iOrigin[1])
write_coord(iOrigin[2])
write_short(id)
write_byte(random_num(41,45))
message_end()
This works but doesn't do what I thought it would, which would be printing a gunshot mark in the wall. :/

EDIT: Found out the solution.

For brush entities:
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(TE_DECAL)
write_coord(iOrigin[0])
write_coord(iOrigin[1])
write_coord(iOrigin[2])
write_byte(random_num(41,45))
write_short(ent)
message_end()

For world brush:
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(TE_WORLDDECAL)
write_coord(iOrigin[0])
write_coord(iOrigin[1])
write_coord(iOrigin[2])
write_byte(random_num(41,45))
message_end()