From 289510f882b965671a165037150c365523cbe87e Mon Sep 17 00:00:00 2001 From: marqdevx Date: Mon, 4 Mar 2024 11:14:51 +0100 Subject: [PATCH] Last grenade only teleports if exists --- src/commands.cpp | 5 +++++ src/playermanager.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/commands.cpp b/src/commands.cpp index 4b1cff78..3de3f746 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -735,5 +735,10 @@ CON_COMMAND_CHAT(last, "Teleport to the last thrown grenade") ZEPlayer *pPlayer = g_playerManager->GetPlayer(player->GetPlayerSlot()); + if(pPlayer->lastThrow_position.x == 0.0f && pPlayer->lastThrow_position.y == 0.0f && pPlayer->lastThrow_position.z == 0.0f){ + ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "No lineup saved"); + return; + } + player->GetPawn()->Teleport(&pPlayer->lastThrow_position, &pPlayer->lastThrow_rotation, nullptr); } \ No newline at end of file diff --git a/src/playermanager.h b/src/playermanager.h index 96d943e0..108d1af7 100644 --- a/src/playermanager.h +++ b/src/playermanager.h @@ -68,6 +68,8 @@ class ZEPlayer m_bInGame = false; m_iMZImmunity = 0; // out of 100 m_flNominateTime = -60.0f; + + lastThrow_position = Vector(0,0,0); } ~ZEPlayer()