void CLocalPlayer::SendOnFootData() { RakNet::BitStream PlayerBitStream_send; PlayerBitStream_send.Write((MessageID)ID_SEND_PLAYER_DATA); PlayerBitStream_send.Write(NetworkManager->playerid); PlayerBitStream_send.Write(GetType()); PlayerBitStream_send.Write(GetModel()); PlayerBitStream_send.Write(GetHealth()); PlayerBitStream_send.Write(GetArmour()); PlayerBitStream_send.Write(GetCoords().x); PlayerBitStream_send.Write(GetCoords().y); PlayerBitStream_send.Write(GetCoords().z); PlayerBitStream_send.Write(GetHeading()); PlayerBitStream_send.Write(GetQuaternion().fX); PlayerBitStream_send.Write(GetQuaternion().fY); PlayerBitStream_send.Write(GetQuaternion().fZ); PlayerBitStream_send.Write(GetQuaternion().fW); PlayerBitStream_send.Write(AI::GET_PED_DESIRED_MOVE_BLEND_RATIO(playerPed)); PlayerBitStream_send.Write(GetVelocity().x); PlayerBitStream_send.Write(GetVelocity().y); PlayerBitStream_send.Write(GetVelocity().z); PlayerBitStream_send.Write(LocalPlayer->GetVehicle()); PlayerBitStream_send.Write(time(0)); NetworkManager->client->Send(&PlayerBitStream_send, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, RakNet::UNASSIGNED_SYSTEM_ADDRESS, true); }
float AMech_RPGCharacter::GetTotalResistance(DamageEnums::DamageType damageType) { float totalResistance = 0; for (ArmourMap armourFound : GetArmour()) { if (armourFound.Value != nullptr) totalResistance += armourFound.Value->GetResistance(damageType); } return MAX(totalResistance, 1); }
void AMech_RPGCharacter::CreateArmour(float phsyicalResistance, float blastResistance, float energyResistance, int32 grade, int32 quaility) { for (int i = 0; i < ArmourEnums::End; i++) { ArmourEnums::ArmourPosition pos = (ArmourEnums::ArmourPosition)i; AArmour* newArmour = AArmour::CreateArmour(GetWorld(), "Test", phsyicalResistance, blastResistance, energyResistance, pos, this, grade, quaility); GetArmour().Add(pos, newArmour); AddItem(newArmour); } }
void CLocalPlayer::SetModel(Hash model) { int health = GetHealth(); int armour = GetArmour(); if (STREAMING::IS_MODEL_IN_CDIMAGE(model) && STREAMING::IS_MODEL_VALID(model)) STREAMING::REQUEST_MODEL(model); while (!STREAMING::HAS_MODEL_LOADED(model)) WAIT(0); PLAYER::SET_PLAYER_MODEL(0, model); STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(model); playerPed = PLAYER::GET_PLAYER_PED(0); SetHealth(health); SetArmour(armour); }
AArmour* AMech_RPGCharacter::GetArmourByPosition(TEnumAsByte<ArmourEnums::ArmourPosition> pos) { return *GetArmour().Find(pos); }