不知道为什么下载要花钱,我设置的是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()
}
|