void CPlayer::Reset ( void ) { //Called when resetMapInfo is called to reset per player information that is reset in the clientside implimentation of resetMapInfo. This stops our functions clientside and serverside possibly returning different results. memset ( &m_fStats[0], 0, sizeof ( m_fStats ) ); m_pPlayerStatsPacket->Clear ( ); SetPlayerStat ( 24, 569.0f ); // default max_health m_pClothes->DefaultClothes (); m_bHasJetPack = false; // Removed //m_bForcedScoreboard = false; m_bForcedMap = false; m_ucInterior = 0; m_usDimension = 0; //m_pKeyBinds->Clear (); m_bCursorShowing = false; // Added m_ucFightingStyle = 15; // STYLE_GRAB_KICK SetNametagText ( NULL ); m_ucAlpha = 255; // Make sure the nametag color is no longer overridden RemoveNametagOverrideColor (); m_bNametagShowing = true; m_usModel = 0; }
void CClientPlayer::Reset ( void ) { // stats for ( unsigned short us = 0 ; us <= NUM_PLAYER_STATS ; us++ ) { if ( us == MAX_HEALTH ) { SetStat ( us, 569.0f ); } else { SetStat ( us, 0.0f ); } } // model SetModel ( 0 ); // clothes GetClothes ()->DefaultClothes ( false ); // jetpack SetHasJetPack ( false ); // fight-style SetFightingStyle ( STYLE_GRAB_KICK ); // rebuild RebuildModel (); // Nametag SetNametagText ( m_strNick ); m_bNametagShowing = true; // Otherwize default to white m_ucNametagColorR = 255; m_ucNametagColorG = 255; m_ucNametagColorB = 255; m_bNametagColorOverridden = false; SetAlpha ( 255 ); }
CClientPlayer::CClientPlayer ( CClientManager* pManager, ElementID ID, bool bIsLocalPlayer ) : ClassInit ( this ), CClientPed ( pManager, 0, ID, bIsLocalPlayer ) { // Initialize m_pManager = pManager; m_bIsLocalPlayer = bIsLocalPlayer; SetTypeName ( "player" ); m_bNametagColorOverridden = false; m_uiPing = 0; m_usLatency = 0; m_uiPlayerSyncCount = 0; m_uiKeySyncCount = 0; m_uiVehicleSyncCount = 0; m_ulLastPuresyncTime = 0; m_bHasConnectionTrouble = false; m_bForce = false; m_bDoExtrapolatingAim = false; m_bNetworkDead = false; m_voice = NULL; // If it's the local player, add the model if ( m_bIsLocalPlayer ) { // Set us as the local player in the player manager if ( !pManager->GetPlayerManager ()->GetLocalPlayer () ) { pManager->GetPlayerManager ()->SetLocalPlayer ( this ); } CClientPlayer * pLocalPlayer = this; // Enable voice playback for local player if ( pLocalPlayer->GetVoice() == NULL ) { //If voice is enabled CClientPlayerVoice * pVoice = new CClientPlayerVoice ( this, g_pClientGame->GetVoiceRecorder() ); pLocalPlayer->SetPlayerVoice ( pVoice ); } } else { // Enable weapon processing for players m_remoteDataStorage->SetProcessPlayerWeapon ( true ); // Enable voice playback for remote players if ( g_pClientGame->GetVoiceRecorder()->IsEnabled() ) //If voice is enabled m_voice = new CClientPlayerVoice ( this, g_pClientGame->GetVoiceRecorder() ); } // Set all our default stats m_pTeam = NULL; m_bNametagShowing = true; m_ucNametagColorR = 255; m_ucNametagColorG = 255; m_ucNametagColorB = 255; m_ulLastNametagShow = 0; SetNametagText ( m_strNick ); // Add us to the player list m_pManager->GetPlayerManager ()->AddToList ( this ); #ifdef MTA_DEBUG m_bShowingWepdata = false; #endif m_LastPuresyncType = PURESYNC_TYPE_NONE; }