cell AMX_NATIVE_CALL TEST_Hook_OnPlayerExitVehicle(AMX* amx, cell* params) { if(GetVehicleSpeed(params[2]) > 2.0) SaveCord[EnterCar[params[1]]] = 10; else { float x[3];float z; g_Invoke->callNative(&PAWN::GetVehiclePos,params[2],&x[0],&x[1],&x[2]); g_Invoke->callNative(&PAWN::GetVehicleZAngle,params[2],&z); Vehicle[params[2]].posx = x[0]; Vehicle[params[2]].posy = x[1]; Vehicle[params[2]].posz = x[2]; Vehicle[params[2]].posa = z; } EnterCar[params[1]] = -1; if(IsAPlane(params[2])) { GunNoCheck[params[1]] = 4; PlayerWeapon[params[1]][46] = 1; PlayerAmmo[params[1]][46] = 1; } return 1; }
void AVehiclePawn::UpdateWheelEffects(float DeltaTime) { if (bTiresTouchingGround == false && LandingSound) //we don't update bTiresTouchingGround until later in this function, so we can use it here to determine whether we're landing { float MaxSpringForce = GetVehicleMovement()->GetMaxSpringForce(); if (MaxSpringForce > SpringCompressionLandingThreshold) { UGameplayStatics::PlaySoundAtLocation(this, LandingSound, GetActorLocation()); } } bTiresTouchingGround = false; if (DustType && !bIsDying && GetVehicleMovement() && GetVehicleMovement()->Wheels.Num() > 0) { const float CurrentSpeed = GetVehicleSpeed(); for (int32 i = 0; i < ARRAY_COUNT(DustPSC); i++) { UPhysicalMaterial* ContactMat = GetVehicleMovement()->Wheels[i]->GetContactSurfaceMaterial(); if (ContactMat != NULL) { bTiresTouchingGround = true; } UParticleSystem* WheelFX = DustType->GetDustFX(ContactMat, CurrentSpeed); const bool bIsActive = DustPSC[i] != NULL && !DustPSC[i]->bWasDeactivated && !DustPSC[i]->bWasCompleted; UParticleSystem* CurrentFX = DustPSC[i] != NULL ? DustPSC[i]->Template : NULL; if (WheelFX != NULL && (CurrentFX != WheelFX || !bIsActive)) { if (DustPSC[i] == NULL || !DustPSC[i]->bWasDeactivated) { if (DustPSC[i] != NULL) { DustPSC[i]->SetActive(false); DustPSC[i]->bAutoDestroy = true; } SpawnNewWheelEffect(i); } DustPSC[i]->SetTemplate(WheelFX); DustPSC[i]->ActivateSystem(); } else if (WheelFX == NULL && bIsActive) { DustPSC[i]->SetActive(false); } } } if (SkidAC != NULL) { FVector Vel = GetVelocity(); bool bVehicleStopped = Vel.SizeSquared2D() < SkidThresholdVelocity*SkidThresholdVelocity; bool TireSlipping = GetVehicleMovement()->CheckSlipThreshold(LongSlipSkidThreshold, LateralSlipSkidThreshold); bool bWantsToSkid = bTiresTouchingGround && !bVehicleStopped && TireSlipping; float CurrTime = GetWorld()->GetTimeSeconds(); if (bWantsToSkid && !bSkidding) { bSkidding = true; SkidAC->Play(); SkidStartTime = CurrTime; } if (!bWantsToSkid && bSkidding) { bSkidding = false; SkidAC->FadeOut(SkidFadeoutTime, 0); if (CurrTime - SkidStartTime > SkidDurationRequiredForStopSound) { UGameplayStatics::PlaySoundAtLocation(this, SkidSoundStop, GetActorLocation()); } } } }