- WriteString(MSG_ENTITY, this.target);
- WriteString(MSG_ENTITY, this.target2);
- WriteString(MSG_ENTITY, this.target3);
- WriteString(MSG_ENTITY, this.target4);
- WriteString(MSG_ENTITY, this.targetname);
- WriteString(MSG_ENTITY, this.killtarget);
+ // probably some way to clean this up...
+ int targbits = 0;
+ if(this.target && this.target != "") targbits |= BIT(0);
+ if(this.target2 && this.target2 != "") targbits |= BIT(1);
+ if(this.target3 && this.target3 != "") targbits |= BIT(2);
+ if(this.target4 && this.target4 != "") targbits |= BIT(3);
+ if(this.targetname && this.targetname != "") targbits |= BIT(4);
+ if(this.killtarget && this.killtarget != "") targbits |= BIT(5);
+
+ WriteByte(MSG_ENTITY, targbits);
+
+ if(targbits & BIT(0))
+ WriteString(MSG_ENTITY, this.target);
+ if(targbits & BIT(1))
+ WriteString(MSG_ENTITY, this.target2);
+ if(targbits & BIT(2))
+ WriteString(MSG_ENTITY, this.target3);
+ if(targbits & BIT(3))
+ WriteString(MSG_ENTITY, this.target4);
+ if(targbits & BIT(4))
+ WriteString(MSG_ENTITY, this.targetname);
+ if(targbits & BIT(5))
+ WriteString(MSG_ENTITY, this.killtarget);