搜索
查看: 1700|回复: 5

求助,两个倒计时插件能否合二为一

[复制链接]
发表于 2021-5-30 00:13:34 | 显示全部楼层 |阅读模式 来自 北美地区
本帖最后由 一辉 于 2021-5-30 00:16 编辑

一个是c4倒计时,一个是换图倒计时,换图倒计时有一个进度条,我想要一个c4倒计时也有进度条,但是我不会修改,求助大神帮忙

本帖子中包含更多资源

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

×
 楼主| 发表于 2021-5-30 00:19:55 | 显示全部楼层 来自 北美地区
不知道为什么下载要花钱,我设置的是0啊

c4倒计时

#include <amxmod>
#include <amxmisc>

#define MAX_CHAR_NAME                32
#define MAX_CHAR_MESSAGE        25
#define MAX_NUMBER_PLAYERS        32

#define TERRORIST_ID                1
#define COUNTER_TERRORIST_ID        2

#define BOMBCOUNTDOWN_TASK_ID        8038

new g_iBomberID, g_iDefuserID, g_iC4Timer

// Inform players of planting or defusing attempts
public InformPlantDef(iID)
{
        new iArrPlayerIDs[MAX_NUMBER_PLAYERS]
        new sName[MAX_CHAR_NAME]
        new nPlayers
        new sMessage[MAX_CHAR_MESSAGE]
       
        // Get the name of the planter/defuser
        get_user_name(iID, sName , MAX_CHAR_NAME-1)
       
        // If he/she is a terrorist...
        if (get_user_team(iID) == TERRORIST_ID)
        {
                get_players(iArrPlayerIDs, nPlayers, "e", "TERRORIST")
                g_iBomberID = iID
                sMessage = ""
        }
        // If he/she is a counter terrorist...
        else
        {
                get_players(iArrPlayerIDs, nPlayers, "e", "CT")
                g_iDefuserID = iID
                sMessage = ""
        }
       
        // For every player in the same team
        for (new iPlayer=0; iPlayer<nPlayers; iPlayer++)
        {
                // If it isnt the planter/defuser
                if (iArrPlayerIDs[iPlayer] != iID)
                {
                        // Inform the teammate about the plant/defuse attempt
                        client_print(iArrPlayerIDs[iPlayer], print_center, "", sName, sMessage)                       
                }
        }
}

// Stops the bomb countdown
public DisableBomb()
{
        g_iC4Timer = 0
        remove_task(BOMBCOUNTDOWN_TASK_ID)
}

// Called when someone planted the bomb
public PlantedBomb()
{
        new sName[MAX_CHAR_NAME]
        get_user_name(g_iBomberID, sName, MAX_CHAR_NAME-1)
        client_print(0, print_center, "", sName)
        g_iC4Timer = get_cvar_num("mp_c4timer")
        set_task(1.0, "BombCountdown", BOMBCOUNTDOWN_TASK_ID, "", 0, "b")
}

// Called while bomb is ticking
public BombCountdown()
{
        // If we havent reached 0 yet, print number of seconds to blow
        if (--g_iC4Timer > 0)        {
                set_hudmessage(0, 0, 255, -1.0, 0.80, 0, 1.0, 6.0, 0.6, 0.6, 937)
                show_hudmessage(0,  "C4: %d秒", g_iC4Timer )
        }
       
        // Else, the bomb has exploded and we remove the countdown timer task
        else
                remove_task(8038)
}

// Called when bomb has been defused
public DefusedBomb()
{
        new sName[MAX_CHAR_NAME]
        get_user_name(g_iDefuserID, sName, MAX_CHAR_NAME)
        client_print(0,print_center,"", sName)
        client_print(g_iDefuserID,print_center,"", sName)
        DisableBomb()
}

public plugin_init()
{
        register_plugin("Bomb Countdown","0.1","Van der Cal")
        // Bomb events
        register_event("SendAudio", "PlantedBomb", "a", "2&%!MRAD_BOMBPL")
        register_event("SendAudio", "DefusedBomb", "a", "2&%!MRAD_BOMBDEF")
        register_event("SendAudio", "DisableBomb", "a", "2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
        register_event("TextMsg"  , "DisableBomb", "a", "2&#Game_C","2&#Game_w")
       
        register_event("BarTime"  , "InformPlantDef", "be", "1=10", "1=5","1=3")
       
        return PLUGIN_CONTINUE
}


地图倒计时

#include <amxmodx>
#include <engine>

new g_msgBarTime, bool:showtime[33] = false
public plugin_init()
{
        register_plugin("AMXX Timeleft Bar", "1.0", "Cheap_Suit")
        register_cvar("amx_timeleft_bar", "20")
       
        g_msgBarTime = get_user_msgid("BarTime")
}

public client_PreThink(id)
{
        if(!is_user_connected(id))
                return PLUGIN_CONTINUE
        if(!get_cvar_float("mp_timelimit"))
                return PLUGIN_CONTINUE
        new timeleft = (get_timeleft() + 1)       
        if(timeleft <= get_cvar_num("amx_timeleft_bar"))
        {
                client_print(id, print_center, "距离换地图时间剩余 %d 秒", timeleft)
                if(showtime[id] == false)
                {
                        showtime[id] = true
                        ProgressBar(id, timeleft)
                        set_task(float(timeleft), "removeProgressBar", id)
                }
        }
        return PLUGIN_CONTINUE
}

public removeProgressBar(id)
{
        ProgressBar(id, 0)
}

stock ProgressBar(id, seconds)
{
        message_begin(MSG_ONE, g_msgBarTime, {0, 0, 0}, id)
        write_byte(seconds)
        write_byte(0)
        message_end()
}

回复

使用道具 举报

发表于 2021-6-1 00:11:52 | 显示全部楼层 来自 德国
试试看行不行,现在还有人搞插件啊?


本帖子中包含更多资源

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

×
回复

使用道具 举报

 楼主| 发表于 2021-6-1 18:39:31 | 显示全部楼层 来自 北美地区
zhangsheng 发表于 2021-6-1 00:11
试试看行不行,现在还有人搞插件啊?

十分感谢,插件好用,我们是内网,现在没有服务器玩了,没办法,只能自己搞个玩玩,按自己的想法配置一个
回复

使用道具 举报

 楼主| 发表于 2021-6-1 20:13:14 | 显示全部楼层 来自 北美地区
zhangsheng 发表于 2021-6-1 00:11
试试看行不行,现在还有人搞插件啊?

还想改动两个地方,能帮忙么
1 :set_hudmessage(0, 0, 255, -1.0, 0.80, 0, 1.0, 6.0, 0.6, 0.6, 937)
    show_hudmessage(0,  "C4: %d秒", g_iC4Timer )
这是显示倒计时的颜色和坐标.再不改变他的位置,想把进度条改到他的下边,颜色改成一样
2:进度条是从左往右移动的,想改成从右到左
这两个改变能实现么?能实现的话帮帮忙,万分感谢
自己尝试照葫芦画瓢修改,不行,过不去
回复

使用道具 举报

 楼主| 发表于 2021-6-1 21:35:03 | 显示全部楼层 来自 北美地区
原来是zhang大帮助的我,看了好多帖子,好多都是你帮助别人的回复,好人啊,这么多年过去了,你竟然还在这论坛,哎,现在cs没落了,曾经多么火爆的一款游戏
回复

使用道具 举报

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

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