really good job
Based upon basic nade esp by bwarrior.
For all projectiles, it shows 2D ESP with distance and remaining fuse time.
For fused grenades this code shows predicted explosion location in the world (as a red sphere).
When you're throwing a grenade, it shows you the trajectory it will fly (as a curve) and the place it will hit (as a green sphere).
And yes, this code misses 1 line as a c+p protection. Ez to find, though.
Code:FVector ProjLocation(FVector startPos, FVector velocity, FVector accel, FLOAT tTimeDelta) { return startPos + FVector(velocity*tTimeDelta + accel * FLOAT(tTimeDelta*tTimeDelta / 2)); } FVector DoTrace(FVector& StartLocation, FVector& EndLocation) { FVector HitLocation, HitNormal; FTraceHitInfo HitInfo; APBR::PlayerController->Trace(&HitLocation, &HitNormal, EndLocation, StartLocation, true, FVector(0, 0, 0), &HitInfo, 0); return HitLocation; } void Projectiles(UCanvas* pCanvas) { static FLOAT g; // storing game's gravity if (g==0) g = APBR::PlayerController->Pawn->GetGravityZ(); static TArray<AActor*> Actors; APBR::PlayerController->Pawn->FindActorsOfClass(AcAPBProjectile::StaticClass(), &Actors); for (int i=0; i<Actors.Count; i++) { if (Actors(i)) { AcAPBProjectile* proj = reinterpret_cast<AcAPBProjectile*>(Actors(i)); FVector LandPos, Coordinate = Toolkit::WorldToScreen(pCanvas, APBR::PlayerController, proj->Location); if (Coordinate.Z>100) //fake far-away nades continue; APBR::PlayerController->DrawDebugSphere(proj->Location, 50, 4, 255,0,0, false); // can be seen through walls Toolkit::DrawString(pCanvas, Coordinate.X, Coordinate.Y, APBR::Colors.Red, L"* %0.0fm/%0.1fs", Coordinate.Z, proj->m_FuseTime); FLOAT ttl = proj->m_FuseTime; LandPos = ProjLocation(proj->Location, proj->Velocity, FVector(0, 0, g), ttl); // drawing predicted hit location works only for fused projectiles APBR::PlayerController->DrawDebugSphere(LandPos, 400, 8, 255,0,0, false); } } AcItem* item = APBR::PlayerController->m_HoldableItemManager->m_CurrentItem; if (item && item->IsA(AcGrenadeWeapon::StaticClass())) { static const int nPoints = 64; const FLOAT timeStep = 0.05f; static FLOAT throwForce = 1600; // TODO: pretty accurate, but must revalidate. AcGrenadeWeapon* nadeWeap = reinterpret_cast<AcGrenadeWeapon*>(item); AcAPBProjectile* proj = nadeWeap->m_CookingGrenade; if (!proj) return; FVector dirn = APBR::PlayerController->PlayerCamera->Rotation.Vector(); dirn.Normalize(); FVector prevPos = nadeWeap->m_FireStartLocation; for (int i = 0; (i < nPoints) && (i*timeStep<proj->m_FuseTime); i++) { FVector pos = ProjLocation(nadeWeap->m_FireStartLocation, dirn, FVector(0, 0, g), i*0.1); FVector hit = DoTrace(prevPos, pos); // checking if line segment is broken = we hit something pos = (hit.Length()) ? hit : pos; APBR::PlayerController->DrawDebugLine(prevPos, pos, 255, 50, 255, false); // next line segment prevPos = pos; if (hit.Length()) // no more tracing break; } APBR::PlayerController->DrawDebugSphere(prevPos, 100, 8, 0, 255, 50, false); // end of trajectory } }
Credits:
Joan
bwarrior
And there are the credits!
Last edited by Powahh; 09-21-2011 at 12:18 PM.
Looks nice, wouldn't mind testing it out
Nice
hope i will learn how to use c++
your code is wrong! there are a lot of mistakes in it and dll file isnt makes!
1>------ Построение начато: проект: as, Конфигурация: Release Win32 ------
1> as1.cpp
1>as1.cpp(1): error C2146: синтаксическая ошибка: отсутствие ";" перед идентификатором "ProjLocation"
1>as1.cpp(1): error C4430: отсутствует спецификатор типа - предполагается int. Примечание. C++ не поддерживает int по умолчанию
1>as1.cpp(1): error C2146: синтаксическая ошибка: отсутствие ")" перед идентификатором "startPos"
1>as1.cpp(1): error C4430: отсутствует спецификатор типа - предполагается int. Примечание. C++ не поддерживает int по умолчанию
1>as1.cpp(1): error C2059: синтаксическая ошибка: )
1>as1.cpp(2): error C2143: синтаксическая ошибка: отсутствие ";" перед "{"
1>as1.cpp(2): error C2447: {: отсутствует заголовок функции (возможно, используется формальный список старого типа)
1>as1.cpp(6): error C2146: синтаксическая ошибка: отсутствие ";" перед идентификатором "DoTrace"
1>as1.cpp(6): error C4430: отсутствует спецификатор типа - предполагается int. Примечание. C++ не поддерживает int по умолчанию
1>as1.cpp(6): error C2086: int FVector: переопределение
1> as1.cpp(1): см. объявление "FVector"
1>as1.cpp(6): error C2065: StartLocation: необъявленный идентификатор
1>as1.cpp(6): error C2065: EndLocation: необъявленный идентификатор
1>as1.cpp(7): error C2448: DoTrace: вероятно, инициализатор, использующий стиль функции, является определением функции
1>as1.cpp(16): error C2065: UCanvas: необъявленный идентификатор
1>as1.cpp(16): error C2065: pCanvas: необъявленный идентификатор
1>as1.cpp(17): error C2448: Projectiles: вероятно, инициализатор, использующий стиль функции, является определением функции
1>as1.cpp(66): fatal error C1004: непредвиденное обнаружение конца файла
========== Построение: успешно: 0, с ошибками: 1, без изменений: 0, пропущено: 0 ==========
Error
Code:1>------ Build started: Project: NewProyect, Configuration: Release Win32 ------ 1> dllmain.cpp 1>dllmain.cpp(1): error C2146: syntax error : missing ';' before identifier 'ProjLocation' 1>dllmain.cpp(1): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>dllmain.cpp(1): error C2146: syntax error : missing ')' before identifier 'startPos' 1>dllmain.cpp(1): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>dllmain.cpp(1): error C2059: syntax error : ')' 1>dllmain.cpp(2): error C2143: syntax error : missing ';' before '{' 1>dllmain.cpp(2): error C2447: '{' : missing function header (old-style formal list?) 1>dllmain.cpp(6): error C2146: syntax error : missing ';' before identifier 'DoTrace' 1>dllmain.cpp(6): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>dllmain.cpp(6): error C2086: 'int FVector' : redefinition 1> dllmain.cpp(1) : see declaration of 'FVector' 1>dllmain.cpp(6): error C2065: 'StartLocation' : undeclared identifier 1>dllmain.cpp(6): error C2065: 'EndLocation' : undeclared identifier 1>dllmain.cpp(7): error C2448: 'DoTrace' : function-style initializer appears to be a function definition 1>dllmain.cpp(16): error C2065: 'UCanvas' : undeclared identifier 1>dllmain.cpp(16): error C2065: 'pCanvas' : undeclared identifier 1>dllmain.cpp(17): error C2448: 'Projectiles' : function-style initializer appears to be a function definition ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
wo! its the same thing! but in english! i have a russian version
Download Vtable Hook https://www.mpgh.net/forum/273-all-po...esp-codes.html
Is this still a correct code?