求助,两个倒计时插件能否合二为一
本帖最后由 一辉 于 2021-5-30 00:16 编辑一个是c4倒计时,一个是换图倒计时,换图倒计时有一个进度条,我想要一个c4倒计时也有进度条,但是我不会修改,求助大神帮忙 不知道为什么下载要花钱,我设置的是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
new sName
new nPlayers
new sMessage
// 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 != iID)
{
// Inform the teammate about the plant/defuse attempt
client_print(iArrPlayerIDs, 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
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
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 = 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 == false)
{
showtime = 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()
}
试试看行不行,现在还有人搞插件啊?{:6_179:}
zhangsheng 发表于 2021-6-1 00:11
试试看行不行,现在还有人搞插件啊?
十分感谢,插件好用,我们是内网,现在没有服务器玩了,没办法,只能自己搞个玩玩,按自己的想法配置一个 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:进度条是从左往右移动的,想改成从右到左
这两个改变能实现么?能实现的话帮帮忙,万分感谢
自己尝试照葫芦画瓢修改,不行,过不去 原来是zhang大帮助的我,看了好多帖子,好多都是你帮助别人的回复,好人啊,这么多年过去了,你竟然还在这论坛,哎,现在cs没落了,曾经多么火爆的一款游戏
页:
[1]