Merge pull request #204 from julianacat/master

Fixed Name stealer not working + crashing
This commit is contained in:
julianacat 2017-07-20 02:54:12 -05:00 committed by GitHub
commit 99f3124748

View File

@ -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)) {