From 4bcd4f0ae0f187cfbda5c8c1ba60233bcfd333e9 Mon Sep 17 00:00:00 2001 From: julianacat Date: Thu, 20 Jul 2017 02:53:39 -0500 Subject: [PATCH] Fixed Name stealer not working + crashing --- src/hooks/others.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index 2dc351cb..17a2aaa2 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -254,18 +254,20 @@ bool StolenName(){ // Save the ent to our array potential_targets[potential_targets_length] = i; potential_targets_length++; + + // With our maximum amount of players reached, dont search for anymore if (potential_targets_length >= 32) break; } + // Checks to prevent crashes + if (potential_targets_length == 0) return false; + // Get random number that we can use with our array int target_random_num = floor(RandFloatRange(0, potential_targets_length - 0.1F)); // Get a idx from our random array position int new_target = potential_targets[target_random_num]; - // Checks to prevent crashes - if (!ENTITY(new_target) || potential_targets_length == 0) return false; - // Grab username of user player_info_s info; if (g_IEngine->GetPlayerInfo(new_target, &info)) {