AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   bot auto planting bomb (https://forums.alliedmods.net/showthread.php?t=346195)

sb123 02-13-2024 12:45

bot auto planting bomb
 
Is there such a plugin?
If the BOT is a CT team, when the BOT of the CT team picks up C4, it will automatically install a bomb

Mordekay 02-13-2024 14:20

Re: bot auto planting bomb
 
I'm not a coder, so I don't know if this is changeable. But the item C4 for T is the defuse kit for CT. So, any CT buying the defuse kit, would instantly plant the "bomb"

sb123 02-14-2024 07:55

Re: bot auto planting bomb
 
Quote:

Originally Posted by Mordekay (Post 2818015)
I'm not a coder, so I don't know if this is changeable. But the item C4 for T is the defuse kit for CT. So, any CT buying the defuse kit, would instantly plant the "bomb"

I am using this plugin, but the BOT in the CT team picks up the bomb, but the BOT will not install the bomb, I need to ask the CT picks up the bomb to install the bomb automatically if it is a BOT

Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>

#define PLUGIN "CT PickUP C4"
#define VERSION "1.7"
#define AUTHOR "KinSprite"

#define MORE_THAN_ONE_BOMB

// Whether it is defined as an older version of the game, yes is 1, no is 0
#define FOR_OLD_GAME_ENGINE 0

new g_allowctpickupbomb
new g_lastcvarvalue
new g_allowctplantbomb
new g_lastallowctplantbomb
new bool:allowctpickupbomb[33]=true

public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
        register_dictionary("ctpickupc4.txt")
        register_concmd("amx_ctpickupc4","cmdallowctpickupbomb",ADMIN_IMMUNITY," Effect cvar changing immediately,not until new round.")
        register_logevent("startnewround",2,"0=World triggered","1=Round_Start")
        register_logevent("round_end", 2, "1=Round_End")
        register_logevent("ct_dropbomb",3,"1=triggered")
       
        #if FOR_OLD_GAME_ENGINE == 1
        register_event("Damage", "on_Damage", "b", "2!0")
        #else
        register_event("DeathMsg","on_DeathMsg","a")
        #endif
       
        register_touch("weaponbox", "player", "ctpickupbomb")
        g_allowctpickupbomb = register_cvar("amx_allowctpickupbomb","0")
        g_allowctplantbomb = register_cvar("amx_allowctplantbomb","1")
}

public cmdallowctpickupbomb(id,level,cid){
        if(!cmd_access(id,level,cid,1))
                return PLUGIN_HANDLED
        console_print(id,"[AMXX] Effect cvar changing now")
        set_task(0.5,"startnewround")
        return PLUGIN_HANDLED
}

public startnewround(){
        new now_value = get_pcvar_num(g_allowctpickupbomb)
        new state_value
        if(now_value!=g_lastcvarvalue)
        {
                new players[32],num,i
                get_players(players, num,"ae","CT")
                if(now_value==1){
                        for(i=0;i<num;i++)
                                allowctpickupbomb[players[i]] = true
                        state_value = 10
                } else {
                        for(i=0;i<num;i++)
                                allowctpickupbomb[players[i]] = false
                        state_value = 20
                }       
                g_lastcvarvalue = now_value
        }
       
        new now_allowctplantbomb = get_pcvar_num(g_allowctplantbomb)
        if(g_lastcvarvalue==1&&now_allowctplantbomb!=g_lastallowctplantbomb)
        {
                if(now_allowctplantbomb==1)
                        state_value ++
                else
                        state_value +=2
                g_lastallowctplantbomb=now_allowctplantbomb
        }
        if(state_value!=0){
                if(state_value==10)
                {
                        if(g_lastallowctplantbomb==1)
                                state_value = 11
                        else
                                state_value = 12
                }
                new message[32]
                switch(state_value)
                {
                        case 1 : format(message,31,"CAN_PLANT_BOMB")
                        case 2 : format(message,31,"CAN_NOT_PLANT_BOMB")
                        case 11 : format(message,31,"ALLOW_CT_PICK_BOMB_AND_PLANT")
                        case 12 : format(message,31,"ALLOW_CT_PICK_BOMB_NOT_PLANT")
                        case 20 : format(message,31,"NOT_ALLOW_CT_PICK_BOMB")
                }
                client_print(0,print_chat,"[AMXX] %L",LANG_PLAYER,message)
                new hud_message[64]
                format(hud_message,63,"%s_SHORT",message)
                set_hudmessage(0,100,255,-1.0,0.38,0,1.0,6.0,2.0,2.0,3)
                show_hudmessage(0,"%L",LANG_PLAYER,hud_message)
        }
       
}

public client_putinserver(id){
        allowctpickupbomb[id] = true
       
        if (g_lastcvarvalue == 1)
        {
                if (is_user_bot(id))
                        return PLUGIN_CONTINUE
                new param[2]
                param[0]=id
                set_task(5.0,"show_server_state",id,param,1)
        }
       
        return PLUGIN_CONTINUE
}

public show_server_state(param[])
{
        new message[32]
        if(g_lastallowctplantbomb==1)
                format(message,31,"ALLOW_CT_PICK_BOMB_AND_PLANT")
        else
                format(message,31,"ALLOW_CT_PICK_BOMB_NOT_PLANT")
        client_print(param[0],print_chat,"[AMXX] %L",param[0],message)
        new hud_message[64]
        format(hud_message,63,"%s_SHORT",message)
        set_hudmessage(0,100,255,-1.0,0.38,0,1.0,6.0,2.0,2.0,3)
        show_hudmessage(param[0],"%L",param[0],hud_message)
}

public ct_dropbomb(){
        new sArg[64], sAction[64]
        new sName[64] 
        new iUserId, id

        read_logargv(0,sArg,64)
        read_logargv(2,sAction,64)
        parse_loguser(sArg,sName,64,iUserId)
        id = find_player("k",iUserId)
        if(id==0)
                return PLUGIN_CONTINUE
        if(equal(sAction,"Dropped_The_Bomb")&&get_user_team(id)==2)
        {
                allowctpickupbomb[id]=false
                new param[2]
                param[0]=id
                set_task(0.2,"reset_ctpickbomb",8963+id,param,1)
        }
        return PLUGIN_HANDLED
}

public reset_ctpickbomb(param[]){
        allowctpickupbomb[param[0]]=true
}

public ctpickupbomb(Ent,player){
        if ( get_user_team(player) != 2 || g_lastcvarvalue != 1 || !allowctpickupbomb[player] )
                return PLUGIN_CONTINUE
        new sz[33]
        entity_get_string(Ent,EV_SZ_model,sz,32)
        if(equal(sz,"models/w_backpack.mdl"))
        {
                #if defined (MORE_THAN_ONE_BOMB)
                if(hasweapon(player,CSW_C4))
                        return PLUGIN_CONTINUE
                #endif
                give_item(player,"weapon_c4")
                if(g_lastallowctplantbomb==1)
                        cs_set_user_plant(player, 1, 1)
                else
                        cs_set_user_plant(player, 0, 1)
                       
                new c4 = find_ent_by_owner(-1, "weapon_c4", Ent)
                kill_entity(Ent)
                kill_entity(c4)
        }
        return PLUGIN_CONTINUE
}


public round_end() {
        set_task(4.6, "round_prestart")
}

public round_prestart() {
        new Players[32]
        new playerCount, i
        get_players(Players, playerCount, "ae", "CT")
       
        new  origin[3]
       
        for (i=0; i<playerCount; i++)
                if (hasweapon(Players[i], CSW_C4))
                {
                        get_user_origin(Players[i],origin)
                        origin[2] -= 2000
                        set_user_origin(Players[i],origin)
                        engclient_cmd(Players[i],"drop","weapon_c4")
                        origin[2] += 2000
                        set_user_origin(Players[i],origin)
                }
}

#if FOR_OLD_GAME_ENGINE == 1
public on_Damage(victim){
        if ( victim < 1 || victim > 32 )
                return PLUGIN_CONTINUE
               
        if ( get_user_team(victim) != 2 )
                return PLUGIN_CONTINUE
       
        new damage = read_data(2)
        if ( get_user_health(victim) - damage < 1 )
                drop_c4(victim)
               
        return PLUGIN_CONTINUE
}
#else
public on_DeathMsg(){
        new victim = read_data(2)       
       
        if ( victim < 1 || victim > 32 )
                return PLUGIN_CONTINUE
               
        if (get_user_team(victim) == 2)
                drop_c4(victim)
               
        return PLUGIN_CONTINUE
}
#endif
       
drop_c4(id){
        if (hasweapon(id, CSW_C4))
                engclient_cmd(id,"drop","weapon_c4")
}

stock hasweapon(player_id,weapon_id)
{
        new Weapons[32]
        new numWeapons,i
        get_user_weapons(player_id, Weapons, numWeapons)
        for(i=0;i<numWeapons; i++)
        {
                if(Weapons[i]==weapon_id)
                        return true
        }
        return false
}

stock kill_entity(id)
{
    entity_set_int(id, EV_INT_flags, entity_get_int(id, EV_INT_flags)|FL_KILLME)
}


mlibre 02-16-2024 17:24

Re: bot auto planting bomb
 
how crazy is this

sb123 02-17-2024 13:48

Re: bot auto planting bomb
 
Quote:

Originally Posted by mlibre (Post 2818145)
how crazy is this

Can you solve this problem? thanks

mlibre 02-18-2024 07:03

Re: bot auto planting bomb
 
Quote:

Originally Posted by sb123 (Post 2818173)
Can you solve this problem? thanks

since the CT is supposed to place the bomb, it's against the rules lol, I'll have to review the code and understand how the hell it works.

bigdaddy424 02-18-2024 17:20

Re: bot auto planting bomb
 
Quote:

Originally Posted by mlibre (Post 2818213)
since the CT is supposed to place the bomb, it's against the rules lol, I'll have to review the code and understand how the hell it works.

youre right, its against their nature
only instance i see this working is using the logic of terrorists on cts just for the algorithm of planting the bomb and this probably requires editing the source of popular open source bots such as podbot etc (http://www.bots-united.com/)
while their forum might not be as visited as it used to most of these communities have discord servers. could get more help there asking for help

sb123 02-22-2024 01:52

Re: bot auto planting bomb
 
Quote:

Originally Posted by mlibre (Post 2818213)
since the CT is supposed to place the bomb, it's against the rules lol, I'll have to review the code and understand how the hell it works.

This is the original theme.
https://forums.alliedmods.net/showthread.php?t=25936
The author probably hasn't been online for many years. If you have time, can you help me modify the code?


All times are GMT -4. The time now is 02:28.

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