- 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);
- WriteByte(MSG_ENTITY, this.target_random);
+ sf = 0;
+ sf = BITSET(sf, BIT(0), this.target_random);
+
+ sf = BITSET(sf, BIT(1), this.target && this.target != "");
+ sf = BITSET(sf, BIT(2), this.target2 && this.target2 != "");
+ sf = BITSET(sf, BIT(3), this.target3 && this.target3 != "");
+ sf = BITSET(sf, BIT(4), this.target4 && this.target4 != "");
+ sf = BITSET(sf, BIT(5), this.targetname && this.targetname != "");
+
+ WriteByte(MSG_ENTITY, sf);
+ if(sf & BIT(1))
+ WriteString(MSG_ENTITY, this.target);
+ if(sf & BIT(2))
+ WriteString(MSG_ENTITY, this.target2);
+ if(sf & BIT(3))
+ WriteString(MSG_ENTITY, this.target3);
+ if(sf & BIT(4))
+ WriteString(MSG_ENTITY, this.target4);
+ if(sf & BIT(5))
+ WriteString(MSG_ENTITY, this.targetname);