如何當回合完結時。。。。。求教><

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