Raised This Month: $ Target: $400
 0% 

[HELP] Get player/bot id and randomize?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-12-2015 , 12:12   Re: [HELP] Get player/bot id and randomize?
Reply With Quote #8

Hartmann, your code worked but i have one bug.
Sometimes give a extra item after 20, 30, 40 seconds, how to fix?

PHP Code:
#include < amxmodx >
#include < zombieplague >

#define PRIMARY_WEAPONS_BIT_SUM ((1<<CSW_SCOUT) | (1<<CSW_XM1014) | (1<<CSW_MAC10) | (1<<CSW_AUG) | (1<<CSW_UMP45) | (1<<CSW_SG550) | (1<<CSW_GALIL) | (1<<CSW_FAMAS) | (1<<CSW_AWP) | (1<<CSW_MP5NAVY) | (1<<CSW_M249) | (1<<CSW_M3) | (1<<CSW_M4A1) | (1<<CSW_TMP) | (1<<CSW_G3SG1) | (1<<CSW_SG552) | (1<<CSW_AK47) | (1<<CSW_P90))

new const VERSION[] = "0.1";

new 
g_has_extra[33];
new 
human_extraid[][] =
{
    
"Rock Guitar",
    
"AKM 12",
    
"[Balrog] Ethereal"
}

public 
plugin_init()
{
    
register_plugin("[ZP] Bot Addon: Auto Buy Extras"VERSION"CrazY");
    
set_task(10.0"buy_extra", .flags="b");
}

public 
buy_extra()
{
    new 
sizeof_extras random(sizeof human_extraid);
    new 
players[32], iPnum sName[32];
    
get_players(playersiPnum"a");
    new 
player;

    if(
iPnumplayer players[random(iPnum)];

    if(
is_user_bot(player) && !g_has_extra[player] && !zp_get_user_zombie(id))
    {
        
get_user_name(playersName31);
        
drop_primary(player);
        
g_has_extra[player] = true;
        
zp_force_buy_extra_item(playerzp_get_extra_item_id(human_extraid[sizeof_extras]), 1);
        
set_hudmessage(random(255), random(255), random(255), -1.00.702.04.01.01.0);
        
show_hudmessage(0"O bot %s ganhou uma %s."sNamehuman_extraid[sizeof_extras]);
    }
}

stock drop_primary(id)
{
    new 
weapons[32], num;
    
get_user_weapons(idweaponsnum);
    for (new 
0numi++)
    {
        if (
PRIMARY_WEAPONS_BIT_SUM & (1<<weapons[i]))
        {
            static 
wname[32];
            
get_weaponname(weapons[i], wnamesizeof wname 1);
            
engclient_cmd(id"drop"wname);
        }
    }

__________________









Last edited by CrazY.; 11-12-2015 at 12:21.
CrazY. 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 22:04.


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