How to add buybot to your hack

社区服务
高级搜索
猴岛论坛CSGO反恐精英CS作弊器交流讨论How to add buybot to your hack
发帖 回复
正序阅读 最近浏览的帖子最近浏览的版块
0个回复

How to add buybot to your hack

楼层直达
作弊辅导员_h

ZxID:1019634

等级: 元老
定做作弊器
举报 只看楼主 使用道具 楼主   发表于: 2007-07-25 0
First the storage
A list to hold the available buy options and the buy list Code:

struct buybot_item_list_s
{
    char szItem[32];
};
vector<buybot_item_list_s> ValidItems;

struct buybot_s
{
    char szItem[32];
};
vector<buybot_s> BuyBot;

Next I setup the functions for creating the list of stuff you can buy Code:

void func_itemlistadd()//add to list of valid items
{
    buybot_item_list_s tmp;

    for(int i=0;i<ValidItems.size();i++)
        if(!strcmp(ValidItems.szItem,cmd.argS(1).c_str()))
        {
            Con_Echo("Item is already in buybot item list!");
            return;
        }
    strcpy(tmp.szItem,cmd.argS(1).c_str());
    ValidItems.push_back(tmp);
}

void func_itemlist()//list valid items
{
    for(int i=0;i<ValidItems.size();i++)
        Con_Echo("%s",ValidItems.szItem);
}

And then the actual buybot functions. Code:

bool ValidItem(const char *item)//check if item being added is valid
{
    for(int i=0;i<ValidItems.size();i++)
    {
        if(!strcmp(ValidItems.szItem,item))
            return true;
    }
    return false;
}

void func_buyadd()//add an item to the buybot
{
    if (!ValidItem(cmd.argS(1).c_str()))
    {
        Con_Echo("Item is invalid");
        return;
    }
    buybot_s tmp;

    for(int i=0;i<BuyBot.size();i++)
        if((!strcmp(BuyBot.szItem,cmd.argS(1).c_str())) && (!strstr(cmd.argS(1).c_str(),"primammo")) && (!strstr(cmd.argS(1).c_str(),"secammo")))
        {
            Con_Echo("Item is already in buybot!");
            return;
        }
    strcpy(tmp.szItem,cmd.argS(1).c_str());
    BuyBot.push_back(tmp);
}

void func_buydel()//delete an item from the buybot
{
    for(int i=0;i<BuyBot.size();i++)
        if(!strcmp(BuyBot.szItem,cmd.argS(1).c_str()))
        {
            BuyBot.erase(BuyBot.begin() + i, BuyBot.begin() + i + 1);
            Con_Echo("Item deleted");
            return;
        }
}

void func_buylist()//list items the buybot will buy
{
    for(int i=0;i<BuyBot.size();i++)
        Con_Echo("%s",BuyBot.szItem);
}

void func_buy()//buy items
{
    char* buf;
        for(int i=0;i<BuyBot.size();i++)
        {
            sprintf(buf,"#%s",BuyBot.szItem);
            cmd.exec(buf);
        }
}

Now here is the one snag i have run into. I cant buy AtRoundStart automatically.
It works fine however if I just bind a key or mouse button the "buy". Calling it from AtRoundStart or ResetHUD causes the game to exit as soon as the round starts.
Also i found that using an alias with later (eg. alias buytest "later 1 buy") also causes it to crash, but (alias buytest "buy") doesnt.

Anoyone have any ideas about what the problem could be?

Other than that, There are a couple things that could use tweaking but If you find it useful then enjoy =)

edit...

Problem i was having is now fixed. Thank you Xen and Azorbix for the suggestions

here is what i did

I setup a bool "bCanBuy" and a timer "buytimer"
So in atRoundStart I have this Code:

if(cvar.buybot)
    {
        buytimer.countdown (2);
        bCanBuy = true;
    }

then in Hud_Redraw Code:

if(buytimer.expired() && bCanBuy)
    {
        cmd.exec("buy");
        bCanBuy = false;
    }
密码被盗,请联系cscheat取回
« 返回列表
发帖 回复