樂古Nakuz

標題: sma一問 [打印本頁]

作者: kining2008    時間: 6-1-2011 13:12
標題: sma一問
迎來我自己寫緊1個說話系統, 但係我有d野唔係幾明..
公開頻道叫做CS_TEAM_UNASSIGNED同埋cs_get_user_team(id)
旁觀者叫做CS_TEAM_SPECTATOR
咁死亡果陣時講野既原碼係咩??
仲有, 組別說話時既原碼都咩??

求高手幫幫手..我唔識
作者: 又畀cs板主ban左    時間: 6-1-2011 14:24
register_clcmd("say_team","function")

if(!is_user_alive(id))
{
     code...
}
作者: tony987852    時間: 6-1-2011 17:07
樓上...不如成個sma寫出黎;P
作者: kining2008    時間: 6-1-2011 19:00
仲係唔得...
error 035: argument type mismatch <argument 3>
應該點修正?
作者: tony987852    時間: 6-1-2011 21:26
睇下第幾行出錯
作者: kining2008    時間: 6-1-2011 22:26
本帖最後由 kining2008 於 6-1-2011 22:37 編輯

line 11
register_clcmd("say_team","function","say","sign_say",ADMIN_ALL,"- Colored Sign Chat")
有咩問題??
二樓那名高人叫我加上"say_team","function"的...另外果d本身已加,,
作者: chantikki    時間: 6-1-2011 22:59
本帖最後由 chantikki 於 6-1-2011 23:21 編輯

register_clcmd("say_team","function_name")

public function_name(id)
{
        new name[33]
        new test[192]
        get_user_name(id, name, 32)
        read_args(text,191)
        remove_quotes(text)

        if (equal(text, ""))
                return PLUGIN_HANDLED

        new loop
        switch (cs_get_user_team(id))
        {
                case CS_TEAM_CT:
                {
                        for (loop = 1; loop <= maxplayers; loop++)
                        {
                                if (!is_user_connected(loop)) continue;
                                if (cs_get_user_team(loop) != CS_TEAM_CT) continue;
                                client_print(loop, print_chat, "[CT隊頻] %s : %s", name, test)
                        }
                }
                case CS_TEAM_T:
                {
                        for (loop = 1; loop <= maxplayers; loop++)
                        {
                                if (!is_user_connected(loop)) continue;
                                if (cs_get_user_team(loop) != CS_TEAM_T) continue;
                                client_print(loop, print_chat, "[T隊頻] %s : %s", name, test)
                        }
                }
        }
        return PLUGIN_HANDLED
}


// 必須做的 !! 請自行修改 maxplayers 為 伺服最大人數的數值
// 本內容完全未經測試, 如有問題, 請在此貼回報
// 這是隊頻系統, 寫法只作參考, 功能未完善
作者: tony987852    時間: 6-1-2011 23:18
回復 7# chantikki


    不用return任何東西嗎?
作者: chantikki    時間: 6-1-2011 23:21
回復  chantikki


    不用return任何東西嗎?
tony987852 發表於 6-1-2011 23:18


已修正 (在最後加入return PLUGIN_HANDLED
作者: kining2008    時間: 10-1-2011 21:57
本帖最後由 kining2008 於 10-1-2011 22:00 編輯

轉唔到檔, 幫忙睇睇..
<19> error 017: undefined symbol "text"
<19> warning 215: expression has no effect
<19> error 001: expected token : ";", but found ">"
<19> error 029: invalid expression, assumed zero
<19> fatal error 107: too many error messages on one line

係我個sma第19行係e d句子:
         read_args(text,191)
參數cmd出問題?
求解答

作者: 又畀cs板主ban左    時間: 11-1-2011 06:25
register_clcmd("say_team","function_name")

public function_name(id)
{
        new name[33]
        new text[192]
        get_user_name(id, name, 32)
        read_args(text,191)
        remove_quotes(text)

        if (equal(text, ""))
                return PLUGIN_HANDLED

        new loop
        switch (cs_get_user_team(id))
        {
                case CS_TEAM_CT:
                {
                        for (loop = 1; loop <= maxplayers; loop++)
                        {
                                if (!is_user_connected(loop)) continue;
                                if (cs_get_user_team(loop) != CS_TEAM_CT) continue;
                                client_print(loop, print_chat, "[CT隊頻] %s : %s", name, test)
                        }
                }
                case CS_TEAM_T:
                {
                        for (loop = 1; loop <= maxplayers; loop++)
                        {
                                if (!is_user_connected(loop)) continue;
                                if (cs_get_user_team(loop) != CS_TEAM_T) continue;
                                client_print(loop, print_chat, "[T隊頻] %s : %s", name, test)
                        }
                }
        }
        return PLUGIN_HANDLED
}
作者: chantikki    時間: 12-1-2011 16:06
register_clcmd("say_team","function_name")

public function_name(id)
{
        new name[33]
         ...
又畀cs板主ban左 發表於 11-1-2011 06:25



唔該 !
作者: Abcdzxc555    時間: 13-1-2011 23:53
new test[192],錯左
改為new text[192]
仲有兩段client_print後面個test改番做text
作者: chantikki    時間: 16-1-2011 01:10
new test[192],錯左
改為new text[192]
仲有兩段client_print後面個test改番做text
Abcdzxc555 發表於 13-1-2011 23:53







歡迎光臨 樂古Nakuz (http://comcnocontactwww.nakuz.com/) Powered by Discuz! X3.2