搜索
查看: 8306|回复: 22

1.5如何让匪徒埋C4后停止回合时间?代码该如何写啊!求救

[复制链接]
发表于 2017-4-28 20:30:07 | 显示全部楼层 |阅读模式 来自 辽宁丹东
1.5如何让匪徒埋C4后停止回合时间 代码该如何写啊!要做1个像1。6那样的最后1秒按上包C4也能爆炸
求救大神教教新手如何做

我用nobombhostages.amxx 是实现了回合时间无限 但是匪徒没有C4

#include <amxmodx>
#include <engine>
#include <fun>

new maxplayers

public plugin_init() {
        maxplayers = get_maxplayers()
        register_cvar("amx_nobombhos","1")
        register_plugin("No bomb/hostages","1.00","NL)Ramon(NL")
        register_event("RoundTime", "nohos", "bc")
        removeit()
        nohos()
}

public removeit() {
        new fhosr = find_ent_by_class(-1, "func_hostage_rescue")
        while(fhosr > maxplayers)
                {
                entity_set_int(fhosr, EV_INT_flags, FL_KILLME)
                fhosr = find_ent_by_class(fhosr, "func_hostage_rescue")
        }
        new doneonce = 0
        new fbombt = find_ent_by_class(-1, "func_bomb_target")
        while(fbombt > maxplayers)
                {
                entity_set_int(fbombt, EV_INT_flags, FL_KILLME)
                doneonce = 1
                fbombt = find_ent_by_class(fbombt, "func_bomb_target")
        }
        if(doneonce == 1)server_cmd("sv_restartround 1")
        new ibombt = find_ent_by_class(-1, "info_bomb_target")
        while(ibombt > maxplayers)
                {
                entity_set_int(ibombt, EV_INT_flags, FL_KILLME)
                ibombt = find_ent_by_class(ibombt, "info_bomb_target")
        }       
        new fescape = find_ent_by_class(-1, "func_escapezone")
        while(fescape > maxplayers)
                {
                entity_set_int(fescape, EV_INT_flags, FL_KILLME)
                fescape = find_ent_by_class(fescape, "func_escapezone")
        }       
        new fvips = find_ent_by_class(-1, "func_vip_safteyzone")
        while(fvips > maxplayers)
                {
                entity_set_int(fvips, EV_INT_flags, FL_KILLME)
                fvips = find_ent_by_class(fvips, "func_vip_safteyzone")
        }       
        new fvipst = find_ent_by_class(-1, "func_vip_start")
        while(fvipst > maxplayers)
                {
                entity_set_int(fvipst, EV_INT_flags, FL_KILLME)
                fvipst = find_ent_by_class(fvipst, "func_vip_start")
        }       
        return PLUGIN_CONTINUE
}

public nohos() {
        if(get_cvar_num("amx_nobombhos") == 1)
                {
                new iHos = find_ent_by_class(-1, "hostage_entity")
                while(iHos > maxplayers)
                        {
                        entity_set_int(iHos, EV_INT_flags, FL_KILLME)
                        iHos = find_ent_by_class(iHos, "hostage_entity")
                }
                new jHos = find_ent_by_class(-1, "monster_scientist")
                while(iHos > maxplayers)
                        {
                        entity_set_int(jHos, EV_INT_flags, FL_KILLME)
                        iHos = find_ent_by_class(jHos, "monster_scientist")
                }
        }
}
发表于 2017-5-1 18:04:39 | 显示全部楼层 来自 云南西双版纳州景洪
set_msg_block(get_user_msgid("RoundTime"),BLOCK_SET)
回复

使用道具 举报

 楼主| 发表于 2017-5-2 10:20:50 | 显示全部楼层 来自 辽宁丹东
大神 我用了这个命令后 C4可以按了 但是C4爆炸后 下回合时间是固定的了0分
如何在取消这个固定时间
也就是取消set_msg_block(get_user_msgid("RoundTime"),BLOCK_SET)设置 新回合回复正常时间
这是我现在的代码


#include <amxmodx>
#include <csx>
#include <cstrike>






public BombPlanted
public BombCountVoice
public BombCountDef



new g_C4Timer
new g_Defusing
new Float:g_LastOmg
new g_LastAnnounce


new g_announce_sync



public plugin_init()
{
        register_plugin("CS Misc. Stats", AMXX_VERSION_STR, "AMXX Dev Team")
        register_dictionary("miscstats.txt")
        register_event("TextMsg", "eRestart", "a", "2&#Game_C", "2&#Game_w")
        register_event("SendAudio", "eEndRound", "a", "2&%!MRAD_terwin", "2&%!MRAD_ctwin", "2&%!MRAD_rounddraw")
        //register_event("RoundTime", "eNewRound", "bc")

       

       

}

announceEvent(id, message[])
{
        new name[32]
       
        get_user_name(id, name, 31)
        set_hudmessage(255, 100, 50, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, -1)
        ShowSyncHudMsg(0, g_announce_sync, "%L", LANG_PLAYER, message, name)
}








public bombTimer()
{
        if (--g_C4Timer > 0)
        {
                if (BombCountVoice)
                {
                        if (g_C4Timer == 30 || g_C4Timer == 20)
                        {
                                new temp[64]
                               
                                num_to_word(g_C4Timer, temp, 63)
                                format(temp, 63, "^"vox/%s seconds until explosion^"", temp)
                                play_sound(temp)
                        }
                        else if (g_C4Timer < 11)
                        {
                                new temp[64]
                               
                                num_to_word(g_C4Timer, temp, 63)
                                format(temp, 63, "^"vox/%s^"", temp)
                                play_sound(temp)
                        }
                }
                if (BombCountDef && g_Defusing)
                        client_print(g_Defusing, print_center, "%d", g_C4Timer)
        }
        else
                remove_task(8038)
}





public eRestart()
{
        eEndRound()

}

public eEndRound()
{
        g_C4Timer = -2
        g_LastOmg = 0.0
        remove_task(8038)
        g_LastAnnounce = 0
}




public bomb_planted(planter)
{
        g_Defusing = 0
       
        if (BombPlanted)
                announceEvent(planter, "SET_UP_BOMB")
       
        g_C4Timer = get_cvar_num("mp_c4timer")
        set_task(1.0, "bombTimer", 8038, "", 0, "b")
        set_msg_block(get_user_msgid("RoundTime"),BLOCK_SET)
}




public play_sound(sound[])
{
        new players[32], pnum
        get_players(players, pnum, "c")
        new i
       
        for (i = 0; i < pnum; i++)
        {
                if (is_user_connecting(players[i]))
                        continue
               
                client_cmd(players[i], "spk %s", sound)
        }
}
回复

使用道具 举报

 楼主| 发表于 2017-5-2 10:56:00 | 显示全部楼层 来自 辽宁丹东
zhangsheng 发表于 2017-5-1 18:04
set_msg_block(get_user_msgid("RoundTime"),BLOCK_SET)



这个命令用了后 匪徒埋包 时间还是不能暂停 比如时间剩30秒埋包 时间还会走下去 这局结束后
set_msg_block(get_user_msgid("RoundTime"),BLOCK_SET)在下回合开始后时间才是固定的,
怎么样才能使当匪徒埋包后冻结当前时间或取消时间~大神你QQ我加你QQ 请教下!!
回复

使用道具 举报

 楼主| 发表于 2017-5-2 10:59:22 | 显示全部楼层 来自 辽宁丹东
现在1.5的娱乐比赛都打2分钟的 匪徒不RUSH 慢打埋包时间都不够
所以想做像那1.6那样的埋包方式
回复

使用道具 举报

发表于 2017-5-2 18:30:57 | 显示全部楼层 来自 云南西双版纳州景洪
放C4以后设置回合时间为不限制
set_msg_block(get_user_msgid("RoundTime"),BLOCK_SET)
开局恢复回合时间为原来设置的回合时间
set_msg_block(get_user_msgid("RoundTime"),BLOCK_NOT)
回复

使用道具 举报

发表于 2017-5-2 18:45:00 | 显示全部楼层 来自 云南西双版纳州景洪
  1. #include <amxmodx>

  2. public plugin_init()
  3. {
  4.         register_plugin("RoundTime", "1.0", "zhangsheng")
  5.         register_logevent("logevent_function_p", 3, "2=Planted_The_Bomb")
  6. }

  7. public logevent_function_p()
  8. {
  9.         message_begin(MSG_ALL,get_user_msgid("RoundTime"))
  10.         write_short(40) //一局剩余时间,单位为秒,一般C4爆炸为35秒就设置为35以上
  11.         message_end()
  12. }
复制代码
回复

使用道具 举报

发表于 2017-5-3 16:25:35 | 显示全部楼层 来自 云南西双版纳州景洪
需要安装orpheu模块才能使用这个插件,安装C4以后自动将回合时间设置成C4当前爆炸时间。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
回复

使用道具 举报

 楼主| 发表于 2017-5-3 20:42:44 | 显示全部楼层 来自 辽宁丹东
本帖最后由 jiangwe5082 于 2017-5-3 20:46 编辑
zhangsheng 发表于 2017-5-3 16:25
需要安装orpheu模块才能使用这个插件,安装C4以后自动将回合时间设置成C4当前爆炸时间。 ...


我运行后了 提示这个错误!哪点需要改进!
L 05/03/2017 - 20:38:45: Start of error session.
L 05/03/2017 - 20:38:45: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20170503.log")
L 05/03/2017 - 20:38:45: [ORPHEU] Function "InstallGameRules" not found
L 05/03/2017 - 20:38:45: [AMXX] Displaying debug trace (plugin "Fix_RoundTimer.amxx")
L 05/03/2017 - 20:38:45: [AMXX] Run time error 10: native error (native "OrpheuGetFunction")
L 05/03/2017 - 20:38:45: [AMXX]    [0] Fix_RoundTimer.sma::plugin_precache (line 27)

插件代码:



#include <amxmodx>
#include <orpheu>
#include <orpheu_memory>

#define PLUGIN  "Fix RoundTimer"
#define AUTHOR  "Rirre/Arkshine"
#define VERSION "1.1"

enum GameRulesMembers
{
        m_iRoundTimeSecs,
        m_flRoundCount
};

new const GameRulesMI[ GameRulesMembers ][] =
{
        "m_iRoundTimeSecs",
        "m_flRoundCount"
};

new g_pGameRules;
new g_c4timer, mp_c4timer;

#define set_mp_pdata(%1,%2)  ( OrpheuMemorySetAtAddress( g_pGameRules, GameRulesMI[ %1 ], 1, %2 ) )
#define get_mp_pdata(%1)     ( OrpheuMemoryGetAtAddress( g_pGameRules, GameRulesMI[ %1 ] ) )

public plugin_precache() OrpheuRegisterHook( OrpheuGetFunction( "InstallGameRules" ), "OnInstallGameRules", OrpheuHookPost );

public OnInstallGameRules() g_pGameRules = OrpheuGetReturn();

public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR);
        register_logevent("PlantedBomb", 3, "2=Planted_The_Bomb");
       
        mp_c4timer = get_cvar_pointer("mp_c4timer");
}

public plugin_cfg() g_c4timer = get_pcvar_num(mp_c4timer);

public PlantedBomb() setRoundTime( g_c4timer );

setRoundTime( const newTime )
{
        set_mp_pdata( m_iRoundTimeSecs, newTime );
        set_mp_pdata( m_flRoundCount, get_gametime() );
       
        static msgIndexRoundTime;
       
        if( msgIndexRoundTime || ( msgIndexRoundTime = get_user_msgid( "RoundTime" ) ) )
        {
                message_begin( MSG_ALL, msgIndexRoundTime );
                write_short( newTime );
                message_end();
        }
}
回复

使用道具 举报

发表于 2017-5-3 21:12:50 | 显示全部楼层 来自 云南西双版纳州景洪
忘记发注入内存的文件了,把压缩包里面的文件夹放到amxmodx的config目录

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表