Raised This Month: $ Target: $400
 0% 

(REQ) Get random entity


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Nax0ne
Senior Member
Join Date: Jul 2011
Location: Chile
Old 11-15-2017 , 11:56   (REQ) Get random entity
Reply With Quote #1

Hello everyone! How can I get an "entity" at random, as if it were a player, but in reality it is an NPC. For example, a random NPC is selected as a "hero" but I have done it in different ways and it does not work for me.


Help mee :'(

PHP Code:
make_npc_hero( )
{    
    new Array:
entities ArrayCreate(132);    
    new 
ent = -1iHero;
    
    while( ( 
ent find_ent_by_classent"npc" ) ) ) 
    {
         
ArrayPushCellentitiesent ); 
        new 
iNpcTotal ArraySizeentities );    
        
        if ( 
randomiNpcTotal ) )
            
g_iNPCIsHeroent ] = 1;
    }
    
    
server_print"CURRENT HERO %i"ent );

__________________

Last edited by Nax0ne; 11-15-2017 at 11:59.
Nax0ne is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode