likewarz is so cute!
if net code is so easy!
follow me!
1.
enum WeaponAttachmentTypeEnum
{
WPN_ATTM_INVALID=-1,
WPN_ATTM_MUZZLE=0,
WPN_ATTM_UPPER_RAIL=1,
WPN_ATTM_LEFT_RAIL=2,
WPN_ATTM_BOTTOM_RAIL=3,
WPN_ATTM_CLIP=4,
WPN_ATTM_RECEIVER=5, // not visual
WPN_ATTM_STOCK=6, // not visual
WPN_ATTM_BARREL=7, // not visual
WPN_ATTM_MAX
};
2.
// struct used to pass network weapon attachments that affect remote player
struct wiNetWeaponAttm
{
DWORD LeftRailID;
DWORD MuzzleID;
(is there add your attach)
wiNetWeaponAttm()
{
LeftRailID = 0;
MuzzleID = 0;
(is there add your attach)
}
};
3.
void obj_Player::OnNetPacket(const PKT_S2C_SetPlayerAttachments_s& n)
{
// only remote players can change loadout this way
if(NetworkLocal)
return;
r3d_assert(n.wid == wiCharDataFull::CHAR_LOADOUT_WEAPON1 || n.wid == wiCharDataFull::CHAR_LOADOUT_WEAPON2);
Weapon* wpn = m_Weapons[n.wid];
if(!wpn) {
return;
}
// set wpn attachment
CurLoadout.Attachment[n.wid].attachments[WPN_ATTM_MUZZLE] = n.Attm.MuzzleID;
CurLoadout.Attachment[n.wid].attachments[WPN_ATTM_LEFT_RAIL] = n.Attm.LeftRailID;
(is there add your attach)
wpn->setWeaponAttachmentsByIDs(CurLoadout.Attachment[n.wid].attachments);
// workaround to enable flashlight particle (OnEquip will enable flashlight light)!
// also we assume that remote player can change attachment only for currently equipped weapon
wpn->OnUnequip();
wpn->OnEquip(isFlashlightOn);
}
Hope help yours!
becouse i am so busy! so i can't code it so details,this will help yours!Thx evryone!