1.5如何让匪徒埋C4后停止回合时间?代码该如何写啊!求救
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")
}
}
} set_msg_block(get_user_msgid("RoundTime"),BLOCK_SET) 大神 我用了这个命令后 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
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
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
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, pnum
get_players(players, pnum, "c")
new i
for (i = 0; i < pnum; i++)
{
if (is_user_connecting(players))
continue
client_cmd(players, "spk %s", sound)
}
}
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 请教下!! 现在1.5的娱乐比赛都打2分钟的 匪徒不RUSH 慢打埋包时间都不够
所以想做像那1.6那样的埋包方式 放C4以后设置回合时间为不限制
set_msg_block(get_user_msgid("RoundTime"),BLOCK_SET)
开局恢复回合时间为原来设置的回合时间
set_msg_block(get_user_msgid("RoundTime"),BLOCK_NOT) #include <amxmodx>
public plugin_init()
{
register_plugin("RoundTime", "1.0", "zhangsheng")
register_logevent("logevent_function_p", 3, "2=Planted_The_Bomb")
}
public logevent_function_p()
{
message_begin(MSG_ALL,get_user_msgid("RoundTime"))
write_short(40) //一局剩余时间,单位为秒,一般C4爆炸为35秒就设置为35以上
message_end()
} 需要安装orpheu模块才能使用这个插件,安装C4以后自动将回合时间设置成C4当前爆炸时间。 本帖最后由 jiangwe5082 于 2017-5-3 20:46 编辑
zhangsheng 发表于 2017-5-3 16:25
需要安装orpheu模块才能使用这个插件,安装C4以后自动将回合时间设置成C4当前爆炸时间。 ...
我运行后了 提示这个错误!哪点需要改进!{:6_190:}
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: Function "InstallGameRules" not found
L 05/03/2017 - 20:38:45: Displaying debug trace (plugin "Fix_RoundTimer.amxx")
L 05/03/2017 - 20:38:45: Run time error 10: native error (native "OrpheuGetFunction")
L 05/03/2017 - 20:38:45: 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();
}
} 忘记发注入内存的文件了,把压缩包里面的文件夹放到amxmodx的config目录