Raised This Month: $ Target: $400
 0% 

BOT Random Cut The Right Wire


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 06-20-2021 , 20:15   Re: BOT Random Cut The Right Wire
Reply With Quote #4

Not tested.

Code:
/*  Copyright ?2008, ConnorMcLeod     Cut The Right Wire is free software;     you can redistribute it and/or modify it under the terms of the     GNU General Public License as published by the Free Software Foundation.     This program is distributed in the hope that it will be useful,     but WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     GNU General Public License for more details.     You should have received a copy of the GNU General Public License     along with Cut The Right Wire; if not, write to the     Free Software Foundation, Inc., 59 Temple Place - Suite 330,     Boston, MA 02111-1307, USA. */ #include <amxmodx> #include <fakemeta> #include <hamsandwich> #define PLUGIN "Cut The Right Wire" #define AUTHOR "ConnorMcLeod" #define VERSION "0.0.2" #define MAX_PLAYERS 32 #define TEAM_CT 2 #define PEV_PDATA_SAFE  2 #define EXTRAOFFSET                 5 #define ACTUAL_EXTRA_OFFSET         20 #define OFFSET_TEAM     114 #define OFFSET_MENUID   205 #define OFFSET_C4_EXPLODE_TIME      100 #define OFFSET_C4_DEFUSING          0x181 #define KEYS    ((1<<0)|(1<<1)|(1<<9)) new const g_szWrongWireMsgs[][] = {     "CTRW_FAILED1",     "CTRW_FAILED2" } new g_iMaxPlayers new g_iWire new g_iC4 = FM_NULLENT new bool:g_bCanDefuse[MAX_PLAYERS+1] new g_iPlayerInMenu new bool:g_bBot[MAX_PLAYERS+1] new g_iChooseMenu public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     if( !engfunc( EngFunc_FindEntityByString , FM_NULLENT , "classname" , "func_bomb_target" )     &&  !engfunc( EngFunc_FindEntityByString , FM_NULLENT , "classname" , "info_bomb_target" )  )     {         pause("ad")         return     }     register_dictionary("right_wire.txt")     register_event("HLTV", "Event_HLTV_New_Round", "a", "1=0", "2=0")     register_logevent("Logevent_Round_End", 2, "1=Round_End")     register_menucmd((g_iChooseMenu = register_menuid("WireMenu")), KEYS ,"actionChooseWire");     RegisterHam(Ham_Use, "grenade", "C4_Use")     g_iMaxPlayers = get_maxplayers() } public client_putinserver(id) {     // if( (g_bBot[id] = bool:is_user_bot(id)) )     // {     //  g_bCanDefuse[id] = true     // } } public client_disconnect(id) {     g_bBot[id] = false } public Event_HLTV_New_Round() {     g_iC4 = FM_NULLENT     g_iPlayerInMenu = 0     g_iWire = random_num(0,1)     for( new id = 1 ; id <= g_iMaxPlayers ; id++ )     {         g_bCanDefuse[id] = g_bBot[id] ? true : false     } } public Logevent_Round_End() {     g_iC4 = FM_NULLENT } ShowMenu(id) {     new szMenu[192]     formatex(szMenu, charsmax(szMenu), "%L", id, "CTRW_CHOOSE")     show_menu(id, KEYS, szMenu, _, "WireMenu") } public actionChooseWire(id, iKey) {     if( iKey == g_iWire )     {         g_bCanDefuse[id] = true     }     else     {         Explode_c4()         Failed_Msg(id)     }     return PLUGIN_HANDLED } public C4_Use(iC4, id, idactivator, use_type, Float:value) {     if( use_type != 2 || value != 1.0 )     {         UTIL_ServerConsole_Printf("usetype: %d , val:%f", use_type, value)         return HAM_IGNORED     }     if( get_pdata_int(id, OFFSET_TEAM, EXTRAOFFSET) != TEAM_CT )     {         return HAM_IGNORED     }     if( g_iC4 != iC4 )     {         g_iC4 = iC4     }     if( !g_bCanDefuse[id] )     {         if( !g_iPlayerInMenu         ||  !is_user_alive( g_iPlayerInMenu )         ||  get_pdata_int(g_iPlayerInMenu, OFFSET_MENUID, EXTRAOFFSET) != g_iChooseMenu )         {             g_iPlayerInMenu = id            if (is_user_bot(id))                 actionChooseWire(id, random_num(0, 1))             else                 ShowMenu(id)         }         return HAM_SUPERCEDE     }     return HAM_IGNORED } Explode_c4() {     if( pev_valid(g_iC4) == PEV_PDATA_SAFE )     {         set_pdata_float(g_iC4, OFFSET_C4_EXPLODE_TIME, 0.0, EXTRAOFFSET)     } } Failed_Msg(id) {     new szName[32]     get_user_name(id, szName, charsmax(szName))     client_print(0, print_chat, "%L", LANG_PLAYER, g_szWrongWireMsgs[random_num(0,charsmax(g_szWrongWireMsgs))], szName) } stock UTIL_ServerConsole_Printf(const fmt[], any:...) // from shptools {     static string[512]     vformat(string, charsmax(string), fmt, 2)     server_print(string)     static basedir[64], date[16], time[16], fp     get_localinfo("amxx_basedir",basedir,63)     get_time("%H:%M:%S", time, 15)     static logfile[192]     if(logfile[0] == 0)     {         get_time("%m%d", date, 15)         formatex(logfile, 127, "%s/logs/CTRW_%s.log", basedir, date)     }     get_time("%m/%d/%Y", date, 15)     fp = fopen(logfile, "a")     fprintf(fp, "L %s - %s: %s^n", date, time, string)     fclose(fp) }
__________________
GitHub
SteamWishlist

六四天安門事件
+ARUKARI- 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 19:53.


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