如何当回合完结时。。。。。求教><

Home Home
引用 | 编辑 96066289
2012-06-29 20:22
楼主
推文 x0
如何编写当回合完结时自动随机一个Tr


求教。。。
不要Amxx

献花 x0
引用 | 编辑 96066289
2012-06-30 00:58
1楼
  
~~~~~~~~~~~~~~~
没人懂?- -失望ToT

献花 x0
引用 | 编辑 ccw111
2012-06-30 17:22
2楼
  
register_logevent( "Event_RouneEnd" , 2 , "1=RouneEnd" )

等我一会再写
( 要测试 )

献花 x1
引用 | 编辑 96066289
2012-06-30 17:56
3楼
  
谢谢你 ~ 写好会否公开SMA? 表情

献花 x0
引用 | 编辑 ccw111
2012-06-30 18:17
4楼
  
下面是引用 96066289 于 2012-06-30 17:56 发表的 : 到引言文
谢谢你 ~ 写好会否公开SMA? 表情

我在想能不能不用数组就能写好

献花 x1
引用 | 编辑 96066289
2012-06-30 18:27
5楼
  
加油 努力!!
我支持你
/\/\
\  /
 \/
^^

献花 x0
引用 | 编辑 ccw111
2012-06-30 18:52
6楼
  
#include < amxmodx >
#include < cstrike >

public plugin_init( )
{
     register_logevent( "Event_RoundEnd" , 2 , "1=Round_End" );
}

public Event_RoundEnd( )
{
     new iPlayer[ 32 ] , iCount;
     get_players( iPlayer , iCount );
     new iSelected , iRanNum;
     new TempID;
     while( !iSelected )
     {
           iRanNum = random( iCount );
           TempID = iPlayer[ iRanNum ];
           if( cs_get_user_team( TempID ) != CS_TEAM_T )
           {
                 cs_set_user_team( TempID , CS_TEAM_T )
                 iSelected ++;
                 return PLUGIN_HANDLED_MAIN;
           }
     }
     return PLUGIN_HANDLED_MAIN;
}
类似这样就是了,但我未测试过
不过要加在不同插件的话,应该要作一些修改

献花 x1
引用 | 编辑 96066289
2012-06-30 19:02
7楼
  
iSelected ++是否=1个TR?

献花 x0
引用 | 编辑 ccw111
2012-06-30 19:14
8楼
  
下面是引用 96066289 于 2012-06-30 19:02 发表的 : 到引言文
iSelected ++是否=1个TR?
可以这样说,因为我现在写的是回合结束抽一个TR
不过我会把iSelected当成是一个真假值

当它大于0,即是系统已经抽出了TR
如果它是0,即是系统未抽出TR

献花 x1
引用 | 编辑 96066289
2012-06-30 19:20
9楼
  
可以把这系统抽出tr2个 表情

献花 x0
引用 | 编辑 ccw111
2012-06-30 19:31
10楼
  
下面是引用 96066289 于 2012-06-30 19:20 发表的 : 到引言文
可以把这系统抽出tr2个 表情
稍作修改就可以了
不过也要debug( 不是指插件有错误 )
是要防止运行时,因部分特殊情况而令插件失效

例如没CT的时候,while就会不断迥圈

献花 x1
引用 | 编辑 96066289
2012-06-30 19:41
11楼
  
是否把iSelected ++ 改为iSelected +=2 ?

献花 x0
引用 | 编辑 ccw111
2012-06-30 19:51
12楼
  
#include < amxmodx >
#include < cstrike >

public plugin_init( )
{
    register_logevent( "Event_RoundEnd" , 2 , "1=RountEnd" );
}

public Event_RoundEnd( )
{
    new iPlayer[ 32 ] , iCount;
    get_players( iPlayer , iCount );
    new iSelected , iRanNum;
    new TempID;
    while( iSelected < 2 )
    {
        iRanNum = random( iCount );
        TempID = iPlayer[ iRanNum ];
        if( cs_get_user_team( TempID ) != CS_TEAM_T )
        {
            cs_set_user_team( TempID , CS_TEAM_T )
            iSelected ++;
            return PLUGIN_HANDLED_MAIN;
        }
    }
    return PLUGIN_HANDLED_MAIN;
}

我改了的地方是while
另外不用给我花了

献花 x0
引用 | 编辑 96066289
2012-06-30 19:54
13楼
  
谢谢你
/\/\
\  /
 \/

献花 x0
引用 | 编辑 96066289
2012-06-30 20:13
14楼
  
对不起!您没有登入,请先登入论坛


献花 x0
引用 | 编辑 ccw111
2012-06-30 20:37
15楼
  
下面是引用 96066289 于 2012-06-30 20:13 发表的 : 到引言文
浏览此文章需要威望
if( maxplayer >= 1 )
else if(maxplayer >= 8 )
else if(maxplayer >= 16 )

我可以告诉你,这3个中只有第一个case能执行
为什么?

maxplayer >= 8 基本上和 maxplayer >= 1 一样
maxplayer >= 16也是一样的情况
下面的两个CASE自然就不会执行(因为第一个已经符合了)

因此你使需要这样做
if( maxplayer >= 1 && maxplayer < 8 )
else if( maxplayer >= 8 && maxplayer < 16 )

献花 x0
引用 | 编辑 96066289
2012-06-30 20:41
16楼
  
- -谢谢你的教学!!^^

献花 x0
引用 | 编辑 ccw111
2012-06-30 23:40
17楼
  
register_logevent("Event-RoundEnd", 2, "1=Round_End")

正确是这个

我刚刚对自己编写的amxx进行了测试了,
证实是可以使用的

如果你无法使用的话,
你可以给我源码,帮助你检查

献花 x0