예제 #1
0
void CLocalPlayer::Pulse()
{
	CPlayerEntity::Pulse();

	if(IsSpawned()) {
		DoDeathCheck();
		
		if(!m_bParachuteCheck) {

			// Create "simulated" parachute
			CIVScript::GiveWeaponToChar(GetScriptingHandle(), 41, 1, false);
			DWORD dwParachute = 0x4C19FE43; //0x402B7648;
			CVector3 vecCurrPos;
			GetPosition(vecCurrPos);

			CIVScript::CreateObject(dwParachute, vecCurrPos.fX, vecCurrPos.fY, -25.0 , &m_pObj, 1);
			CIVScript::SetObjectDynamic(m_pObj, 1);
			CIVScript::SetObjectCollision(m_pObj, 1);
			CIVScript::SetObjectVisible(m_pObj, 0);
			CIVScript::SetActivateObjectPhysicsAsSoonAsItIsUnfrozen(m_pObj, 1);
			CIVScript::AttachObjectToPed(m_pObj, GetScriptingHandle(), 1202, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 1);

			m_bParachuteCheck = true;
		}

		if(!m_bParachuteIntitialised)
		{
			//g_pCore->GetGame()->OnClientPastGameJoin();
			m_bParachuteIntitialised = true;
		}
	}
	m_bSpawnMarked = true;
}
예제 #2
0
void CVehicleEntity::SetLightsState(bool bLights)
{
    // Are we spawned?
    if(IsSpawned())
    {
        if(bLights)
                CIVScript::ForceCarLights(GetScriptingHandle(),2);
        else if(!bLights)
                CIVScript::ForceCarLights(GetScriptingHandle(),1);

        m_bLights = bLights;
    }
}
예제 #3
0
void CVehicleEntity::SetCarDoorAngle(int iDoor,bool bClose, float fAngle)
{
    // Are we spawned?
    if(IsSpawned())
    {
        if(fAngle > 1.9f && fAngle < 350.0f)
                CIVScript::ControlCarDoor(GetScriptingHandle(),(CIVScript::eVehicleDoor)iDoor,bClose,fAngle);
        else if(fAngle >= 350.0f)
                CIVScript::OpenCarDoor(GetScriptingHandle(),(CIVScript::eVehicleDoor)iDoor);
        else if(fAngle < 2.0f)
                CIVScript::ShutCarDoor(GetScriptingHandle(),(CIVScript::eVehicleDoor)iDoor);
    }

    // Apply changes
    m_fDoor[iDoor] = fAngle;
}
예제 #4
0
void CVehicleEntity::SetDoorLockState(DWORD dwDoorLockState)
{
	// Get the actual lock state
	DWORD dwState = 0;

	switch(dwDoorLockState)
	{
		case 0:
			dwState = 0;
			break;
		case 1:
			dwState = 3;
			break;
		case 2:
			dwState = 7;
			break;
		default:
		return;
	}

	m_dwDoorLockState = dwState;

	// Are we spawned?
	if(IsSpawned())
		CIVScript::LockCarDoor(GetScriptingHandle(), m_dwDoorLockState);
}
예제 #5
0
void CVehicleEntity::SetTaxiLightsState(bool bState)
{
    // Are we spawned?
    if(IsSpawned())
        CIVScript::SetTaxiLights(GetScriptingHandle(),bState);

    m_bTaxiLights = bState;
}
예제 #6
0
void CLocalPlayer::HandleSpawn()
{
    // Flag us as alive
    CLocalPlayer::m_bIsDead = false;

	// Set our current time
	CGameFunction::SetTimeOfDay(m_iRespawnTime[0],m_iRespawnTime[1]);

	// Reset vehicle enter/exit
	ResetVehicleEnterExit();

	// Reset parachute
	m_bParachuteCheck = false;

	// Set first spawn
	m_bFirstSpawn = true;

	// Force to draw components on slot 8(parachute etc.)
	int iResult;
    switch (CIVScript::GetCharDrawableVariation(GetScriptingHandle(), 1))
    {
        case 0: iResult = 1; break;
        case 1: iResult = 2; break;
        case 2: iResult = 2; break;
        case 3: iResult = 1; break;
        case 4: iResult = 1; break;
		default: break;
    }

	CIVScript::SetDrawPlayerComponent(8, 1); // special 3
	CIVScript::SetCharComponentVariation(GetScriptingHandle(), 8, iResult, 0);

	// Set basic skin in developmet mode
#ifdef _DEV
	SetPedClothes(1, 1);
	SetPedClothes(2, 1);
	SetPedClothes(3, 0);
#endif

	//g_pCore->GetMainMenu()->SetVisible(true);

	// Notify the server 
	g_pCore->GetNetworkManager()->Call(GET_RPC_CODEX(RPC_PLAYER_SPAWN), NULL, HIGH_PRIORITY, RELIABLE, true);
}
예제 #7
0
void CClientVehicle::Teleport(const CVector3& vecPosition)
{
	if(IsSpawned())
	{
		// Teleport the vehicle (TODO: Don't use natives for this)
		// TODO: Use reversed code from this native
		InvokeNative<void *>(NATIVE_SET_CAR_COORDINATES_NO_OFFSET, GetScriptingHandle(), vecPosition.fX, vecPosition.fY, vecPosition.fZ);
	}

	m_vecPosition = vecPosition;
}
예제 #8
0
void CVehicleEntity::SetVariation(unsigned char ucVariation)
{
    // Are we spawned?
    if(IsSpawned())
    {
        if(m_pVehicle->GetTextureVariationCount() != 255)
        {
            //m_pVehicle->SetTextureVariation(ucVariation);
            CIVScript::SetCarLivery(GetScriptingHandle(), (int)ucVariation);
            m_ucVariation = ucVariation;
		}
        else
            m_ucVariation = 0;
    }
    else
        m_ucVariation = ucVariation;
}
예제 #9
0
unsigned char CVehicleEntity::GetVariation()
{
    // Are we spawned?
    if(IsSpawned())
	{
        if(m_pVehicle->GetTextureVariationCount() != 255)
        {
            //return (unsigned char)m_pVehicle->GetTextureVariation();
            int iVariation = 0;
            CIVScript::GetCarLivery(GetScriptingHandle(), &iVariation);
            return iVariation;
        }
        else
            return 0;
    }
    else
        return m_ucVariation;
}
예제 #10
0
void CVehicleEntity::SetPosition(const CVector3& vecPosition, bool bDontCancelTasks, bool bResetInterpolation)
{
	if(IsSpawned())
	{
		if(!bDontCancelTasks)
			CIVScript::SetCarCoordinatesNoOffset(GetScriptingHandle(), vecPosition.fX, vecPosition.fY, vecPosition.fZ);
		else
		{
			// Set the position in the matrix
			m_pVehicle->SetPosition(vecPosition);

			//m_pVehicle->GetVehicle()->UpdatePhysicsMatrix(true);
		}
	}

	m_vecPosition = vecPosition;

	// Reset interpolation if requested
	if(bResetInterpolation)
		RemoveTargetPosition();
}
예제 #11
0
void CVehicleEntity::SetPosition(const CVector3& vecPosition, bool bDontCancelTasks, bool bResetInterpolation)
{
	if (IsSpawned())
	{
		if (!bDontCancelTasks)
		{
			EFLC::CScript::SetCarCoordinatesNoOffset(GetScriptingHandle(), vecPosition.fX, vecPosition.fY, vecPosition.fZ);
			g_pCore->GetGraphics()->GetChat()->Print("!bDontCancelTasks");
		}
		else
		{
			m_pVehicle->RemoveFromWorld();
			// Set the position in the matrix
			m_pVehicle->SetPosition(vecPosition);
			m_pVehicle->AddToWorld();

			//m_pVehicle->RemoveFromWorld();
			//Vector4 coords(vecPosition.fX, vecPosition.fY, vecPosition.fZ, 0);
			//m_pVehicle->GetVehicle()->SetCoordinates(&coords, 1, 0);
			//m_pVehicle->GetVehicle()->UpdatePhysicsMatrix(true);
			//m_pVehicle->AddToWorld();
		}

		m_vecPosition = vecPosition;

		// Reset interpolation if requested
		if (bResetInterpolation)
			RemoveTargetPosition();

		return;

		//
		Vector4 coords(vecPosition.fX, vecPosition.fY, vecPosition.fZ, 0);
		m_pVehicle->GetVehicle()->SetCoordinates(&coords, 1, 0);
		m_pVehicle->GetVehicle()->UpdatePhysicsMatrix(true);
		m_pVehicle->GetVehicle()->Function100();
		
		DWORD dwsub_9D92E0 = g_pCore->GetBase() + 0x9D92E0;

		if (sub_9D92E0(m_pVehicle->GetVehicle()))
		{
			int v8 = sub_9D92E0(m_pVehicle->GetVehicle());
			(*(void(__thiscall **)(int))(*(DWORD *)v8 + 16))(v8);
			if (*(DWORD *)(sub_9D92E0(m_pVehicle->GetVehicle()) + 24))
			{
				int v9 = sub_9D92E0(m_pVehicle->GetVehicle());
				sub_5C9D60(*(void **)(v9 + 24), 1);
			}
		}

		//__debugbreak();
		sub_9FFFC0(m_pVehicle->GetVehicle(), 1);
		//

		//m_pVehicle->RemoveFromWorld();
		//m_pVehicle->GetVehicle()->Function31(&coords, 0, 1);
		//m_pVehicle->AddToWorld();
		//m_pVehicle->RemoveFromWorld();
		//EFLC::CScript::SetCarCoordinatesNoOffset(GetScriptingHandle(), vecPosition.fX, vecPosition.fY, vecPosition.fZ);
		//EFLC::CScript::SetCarCoordinates(GetScriptingHandle(), vecPosition.fX, vecPosition.fY, vecPosition.fZ);
		//m_pVehicle->AddToWorld();
		
		// Reset interpolation if requested
		if (bResetInterpolation)
			RemoveTargetPosition();		
	}

	m_vecPosition = vecPosition;
}