Raised This Month: $ Target: $400
 0% 

[ HELP ] Invalid Player (-1) ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-21-2015 , 10:29   Re: [ HELP ] Invalid Player (-1) ?
Reply With Quote #6

Untested
PHP Code:

#include < amxmodx >
#include < zombieplague >

#define MAX_PLAYERS 32

new const VERSION[] = "1.0";

new 
bool:g_bHasExtraMAX_PLAYERS ]; 

new 
cvar_give_extras_delay;

public 
plugin_init()
{
    
register_plugin("[ZP] Bot Addon: Give Random Extras"VERSION"CrazY");
    
cvar_give_extras_delay register_cvar("zp_give_extras_delay""20.0");
}

public 
zp_round_started()
    
set_task(get_pcvar_float(cvar_give_extras_delay), "GiveRandomExtraBot"053, .flags="b");

public 
zp_round_ended()
{
    
remove_task053 );
        
    
arraysetg_bHasExtra false sizeofg_bHasExtra ) );
    
//g_has_extra[0] = false;
}

public 
GiveRandomExtraBot()
{
    static 
iBotName[33];
    new 
BotID fnGetBot();
    
    if ( 
BotID 
    {
        
get_user_name(BotIDiBotName32);
        
set_hudmessage(random(255), random(255), random(255), -1.00.716.01.10.50.5);
        
show_hudmessage(0"O bot %s ganhou uma  M249 Para Machinegun"iBotName);
        
zp_force_buy_extra_item(BotIDzp_get_extra_item_id("M249 Para Machinegun"), 1);
        
g_bHasExtraBotID ] = true;
    }
}

stock fnGetBot()
{
    new 
iPlayers32 ] , iNum id iBot;
    
    
get_playersiPlayers iNum "dh" );
    
    for ( new 
iNum i++ )
    {
        
id iPlayers];
        
        if ( !
g_bHasExtraid ] )
        {
            
iBot id;
            break;
        }
    }
    
    return 
iBot;

get_players() flags
Code:
Optional list of filtering flags:
  "a" - do not include dead clients
  "b" - do not include alive clients
  "c" - do not include bots
  "d" - do not include human clients
  "e" - match with team
  "f" - match with part of name
  "g" - match case insensitive
  "h" - do not include HLTV proxies
  "i" - include connecting clients
__________________

Last edited by Bugsy; 11-21-2015 at 12:18.
Bugsy 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 18:14.


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