zwfgdlc 发表于 2007-12-11 13:43:30

回复: 含有"HLTV"的这句代码是表示什么意思啊?

定义一个空的函数试下

register_event( "HLTV" , "EVENT_NewRound" , "a" , "1=0" , "2=0" );
public EVENT_NewRound()
{

}

Osker Lee 发表于 2007-12-11 14:55:45

回复: 含有"HLTV"的这句代码是表示什么意思啊?

定义一个空的函数后就无法编译了,错误提示如下:
错误021:已经定义的变量:"EVENT_NewRound"

zwfgdlc 发表于 2007-12-11 15:33:25

回复: 含有"HLTV"的这句代码是表示什么意思啊?

不知道原版的插件在CS1.5下报错的信息是怎么样的,加debug试下,把出错信息发上来.

Osker Lee 发表于 2007-12-11 16:36:12

回复: 含有"HLTV"的这句代码是表示什么意思啊?

原版的魔兽插件v3.0加载到CS1.5里是无法运行的,控制台会出现以下的debug信息:
L 12/11/2007 - 16:33:05: Invalid event (name "HLTV") (plugin "war3ft.amxx")
L 12/11/2007 - 16:33:05: Displaying debug trace (plugin "war3ft.amxx")
L 12/11/2007 - 16:33:05: Run time error 10: native error (native "log_amx")
L 12/11/2007 - 16:33:05: war3ft.sma:: plugin_init (line 186)
L 12/11/2007 - 16:33:10: Invalid CVAR pointer
L 12/11/2007 - 16:33:10: Displaying debug trace (plugin "war3ft.amxx")
L 12/11/2007 - 16:33:10: Run time error 10: native error (native "log_amx")
L 12/11/2007 - 16:33:10: war3ft.sma::client_connect (line 375)
L 12/11/2007 - 16:33:16: Invalid CVAR pointer
L 12/11/2007 - 16:33:16: Displaying debug trace (plugin "war3ft.amxx")
L 12/11/2007 - 16:33:16: Run time error 10: native error (native "log_amx")
L 12/11/2007 - 16:33:16: db_common.inl:: DB_FetchUniqueID (line 302)
L 12/11/2007 - 16:33:16: war3ft.sma::client_putinserver (line 321)
L 12/11/2007 - 16:33:20: Invalid CVAR pointer
L 12/11/2007 - 16:33:20: Displaying debug trace (plugin "war3ft.amxx")
L 12/11/2007 - 16:33:20: Run time error 10: native error (native "log_amx")
L 12/11/2007 - 16:33:20: events.inl::EVENT_PlayerInitialSpawn (line 361)
L 12/11/2007 - 16:33:20: events.inl::on_ResetHud (line 334)
L 12/11/2007 - 16:33:30: Invalid CVAR pointer
L 12/11/2007 - 16:33:30: Displaying debug trace (plugin "war3ft.amxx")
L 12/11/2007 - 16:33:30: Run time error 10: native error (native "log_amx")
L 12/11/2007 - 16:33:30: clientCommands.inl::CMD_Handle (line 495)
L 12/11/2007 - 16:33:30: clientCommands.inl::CMD_Handler (line 254)
L 12/11/2007 - 16:33:33: Invalid CVAR pointer
L 12/11/2007 - 16:33:33: Displaying debug trace (plugin "war3ft.amxx")
L 12/11/2007 - 16:33:33: Run time error 10: native error (native "log_amx")
L 12/11/2007 - 16:33:33: db_common.inl:: DB_UpdateTimestamp (line 265)
L 12/11/2007 - 16:33:33: war3ft.sma::client_disconnect (line 423)
L 12/11/2007 - 16:33:33: Invalid CVAR pointer
L 12/11/2007 - 16:33:33: Displaying debug trace (plugin "war3ft.amxx")
L 12/11/2007 - 16:33:33: Run time error 10: native error (native "log_amx")
L 12/11/2007 - 16:33:33: war3ft.sma:: plugin_end (line 285)
就是说下面的这句代码是不支持CS1.5的:
register_event( "HLTV" , "EVENT_NewRound" , "a" , "1=0" , "2=0" );
所以我才一直在想办法修改,希望能用别的代码去替换它啊!
楼主,下载后你自己可以测试一下.

解决War3FT3.0_RC8无法在CS1.5里运行的方法:
http://www.dt-club.net/forum/thread/70/37281.htm

魔兽插件v3.0下载地址:
http://war3ft.com/downloads/amxx/war3ft_v3.0rc9.zip

zwfgdlc 发表于 2007-12-11 17:42:34

回复: 含有"HLTV"的这句代码是表示什么意思啊?

把register_event( "HLTV" , "EVENT_NewRound" , "a" , "1=0" , "2=0" );
改成
register_logevent( "EVENT_NewRound",3,"1=triggered","2=Spawned_With_The_Bomb");
试下

Osker Lee 发表于 2007-12-11 18:04:31

回复: 含有"HLTV"的这句代码是表示什么意思啊?

代码修改后确实可以在CS1.5里运行,不过有BUG:

1. 玩家用"changerace"命令更换种族了(下一局开始时才会生效),但下一局开始时却不能自动更换种族,即玩家再也无法更换种族了.

2. 偶尔还会出现当新的一局开始时,玩家的屏幕看不到手中武器的情况,即屏幕是空的,只能看见准星.

3. 一些当局购买下局才会生效的物品,如物品保留,复活卷轴,伪装服,卧底等购买后却无法在下局生效.

所以我觉得,关键还是无法解决当新的一局开始时,如何准确定义相关的"EVENT_NewRound"函数.

zwfgdlc 发表于 2007-12-11 18:28:18

回复: 含有"HLTV"的这句代码是表示什么意思啊?

我是以玩家得到C4时触发事件来代替HLTV事件的,理论上应该是在相同的时间内触发,都是包括锁定时间在内的.这是EVENT_NewRound函数的代码.你自己看下吧

public EVENT_NewRound()
{
if ( !WC3_Check() )
{
return;
}
// Reset the global ultimate delay
g_iUltimateDelay = get_pcvar_num( CVAR_wc3_ult_delay );
// User's have not spawned yet, so lets do some pre-spawn things
new players, numplayers, i;
get_players( players, numplayers );
for ( i = 0; i < numplayers; i++ )
{
WC3_BeforeSpawn( players );
}

// Reset which spawn points are reserved....
_SHARED_SpawnReset();
// If someone restarted the game, then lets reset war3
if ( g_GameRestarting )
{
WC3_ResetGame();
}

// Randomize Chameleon if we need to
CHAM_Randomize();
// We need to determine when the buytime is up
if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO )
{
if ( get_pcvar_num( CVAR_wc3_buy_time ) )
{
   // Remove our buytime task if it exists (from a previous round)
   ( task_exists( TASK_BUYTIME ) ) ? remove_task( TASK_BUYTIME ) : 0;
   g_buyTime = true;
   set_task( get_cvar_float("mp_buytime") * 60.0, "_CS_BuyTimeOver", TASK_BUYTIME );
}
g_freezeTime = true;
}
g_EndRound = false;
}

Osker Lee 发表于 2007-12-11 19:25:48

回复: 含有&quot;HLTV&quot;的这句代码是表示什么意思啊?

添加下面的代码:
register_logevent( "EVENT_NewRound",3,"1=triggered","2=Spawned_With_The_Bomb");
然后再添加上面的"EVENT_NewRound"事件代码后,就无法编译了.错误提示如下:
已经定义的变量:"EVENT_NewRound"
难道说这个"EVENT_NewRound"事件的函数是无须定义的吗?

如果不定义这个"EVENT_NewRound"事件的函数,而是仅仅添加下面的代码:

register_logevent( "EVENT_NewRound",3,"1=triggered","2=Spawned_With_The_Bomb");


编译后确实可以在CS1.5里运行,不过有BUG:


1. 玩家用"changerace"命令更换种族了(下一局开始时才会生效),但下一局开始时却不能自动更换种族,即玩家再也无法更换种族了.

2. 偶尔还会出现当新的一局开始时,玩家的屏幕看不到手中武器的情况,即屏幕是空的,只能看见准星.

3. 一些当局购买下局才会生效的物品,如物品保留,复活卷轴,伪装服,卧底等购买后却无法在下局生效.


哎~ 真是两头难啊~

zwfgdlc 发表于 2007-12-11 19:51:35

回复: 含有&quot;HLTV&quot;的这句代码是表示什么意思啊?

把register_event( "HLTV" , "EVENT_NewRound" , "a" , "1=0" , "2=0" );
改这样试下
register_event( "ResetHUD","EVENT_NewRound","a");
不要定义EVENT_NewRound函数,这个函数已经在events.inl里定义好了.

Osker Lee 发表于 2007-12-12 15:22:00

回复: 含有&quot;HLTV&quot;的这句代码是表示什么意思啊?

代码改成下面的样子后:

register_event( "ResetHUD","EVENT_NewRound","a");
编译完确实可以在CS1.5里运行,不过还是存在上面的三个BUG.:burn:
页: 1 2 [3] 4
查看完整版本: 含有&quot;HLTV&quot;的这句代码是表示什么意思啊?