廣告廣告
  加入我的最愛 設為首頁 風格修改
首頁 首尾
 手機版   訂閱   地圖  簡體 
您是第 2009 個閱讀者
 
發表文章 發表投票 回覆文章
  可列印版   加為IE收藏   收藏主題   上一主題 | 下一主題   
能天使
個人頭像
個人文章 個人相簿 個人日記 個人地圖
初露鋒芒
級別: 初露鋒芒 該用戶目前不上站
推文 x72 鮮花 x196
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片
推文 x0
[1.6][插件] 有關修改/msg聊天說話糸統源碼的問題 更新在5樓...  (怎麼都沒有人來 求了啦)
對不起!您沒有登入,請先登入論壇


[ 此文章被能天使在2012-02-05 19:05重新編輯 ]




獻花 x0 回到頂端 [樓 主] From:香港特別行政區 | Posted:2012-01-07 18:14 |
觀眾甲
個人頭像
個人文章 個人相簿 個人日記 個人地圖
特殊貢獻獎
小有名氣
級別: 小有名氣 該用戶目前不上站
推文 x318 鮮花 x963
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

new CHARS_MIN = 6, CHARS_MAX = 26;
CHARS_MIN=最小字節
CHARS_MAX=最大字節
(1個中文字=3個字節)


獻花 x0 回到頂端 [1 樓] From:未知地址 | Posted:2012-01-07 22:42 |
能天使
個人頭像
個人文章 個人相簿 個人日記 個人地圖
初露鋒芒
級別: 初露鋒芒 該用戶目前不上站
推文 x72 鮮花 x196
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

感謝上帝的右手大大呢 哪個..管理員說話變更為綠色你僅嗎




獻花 x0 回到頂端 [2 樓] From:香港特別行政區 | Posted:2012-01-07 23:07 |
觀眾甲
個人頭像
個人文章 個人相簿 個人日記 個人地圖
特殊貢獻獎
小有名氣
級別: 小有名氣 該用戶目前不上站
推文 x318 鮮花 x963
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

將153~190行改為這個
複製程式
      if(get_pcvar_num(cmdType) == 0)
     {
           if(is_user_admin(id))
           {
                 client_color(0, id, "^x01%s^x04[^x01%s^x04] ^x03%s ^x01: %s", is_UserAlive(), iSignature, iUserName, iMessages);
                 client_print(0, print_console, "%s[%s] %s : %s", is_UserAlive(), iUserName, iSignature, iMessages);
           }
           else
           {
                 client_color(0, id, "^x01%s^x04[^x01%s^x04] ^x03%s ^x01: %s", is_UserAlive(), iSignature, iUserName, iMessages);
                 client_print(0, print_console, "%s[%s] %s : %s", is_UserAlive(), iUserName, iSignature, iMessages);
           }
     }
     else if(get_pcvar_num(cmdType) == 1)
     {      if(is_user_admin(id))
           {
                 if(equal(iMessages, "/hide"))
                 {
                       iHideTag = 1;
                       client_color(id, id, "[提示] 您的管理員標籤將由 %s 變成 %s。", iTag, iPlayerTag);
                       return PLUGIN_HANDLED;
                 }
                 if(equal(iMessages, "/show"))
                 {
                       iHideTag = 0;
                       client_color(id, id, "[提示] 您的管理員標籤將由 %s 還原成 %s。", iPlayerTag, iTag);
                       return PLUGIN_HANDLED;
                 }
           }
           else if(!is_user_admin(id))
           {
                 iHideTag = 0;
           }
           if(iHideTag == 1)
           {
                 if(!is_user_admin(id))
                 {
                       client_color(0, id, "^x01%s^x04%s ^x04[^x01%s^x04] ^x03%s ^x01: %s", is_UserAlive(), iPlayerTag, iSignature, iUserName, iMessages);
                       client_print(0, print_console, "%s%s [%s] %s : %s", is_UserAlive(), iPlayerTag, iSignature, iUserName, iMessages);
                 }
                 else
                 {
                       client_color(0, id, "^x01%s^x04%s ^x04[^x01%s^x04] ^x03%s ^x01: %s", is_UserAlive(), iPlayerTag, iSignature, iUserName, iMessages);
                       client_print(0, print_console, "%s%s [%s] %s : %s", is_UserAlive(), iPlayerTag, iSignature, iUserName, iMessages);
                 }
           }
           else if(iHideTag == 0)
           {
                 if(!is_user_admin(id))
                 {
                       client_color(0, id, "^x01%s^x04%s ^x04[^x01%s^x04] ^x03%s ^x01: %s", is_UserAlive(), iTag, iSignature, iUserName, iMessages);
                       client_print(0, print_console, "%s%s [%s] %s : %s", is_UserAlive(), iTag, iSignature, iUserName, iMessages);
                 }
                 else
                 {
                       client_color(0, id, "^x01%s^x04%s ^x04[^x01%s^x04] ^x03%s ^x01: %s", is_UserAlive(), iTag, iSignature, iUserName, iMessages);
                       client_print(0, print_console, "%s%s [%s] %s : %s", is_UserAlive(), iTag, iSignature, iUserName, iMessages);
                 }
           }
     }
     return PLUGIN_HANDLED;
}
接下來的自行研究


[ 此文章被上帝的右手^^在2012-01-08 18:06重新編輯 ]


獻花 x0 回到頂端 [3 樓] From:美國 | Posted:2012-01-08 09:47 |
能天使
個人頭像
個人文章 個人相簿 個人日記 個人地圖
初露鋒芒
級別: 初露鋒芒 該用戶目前不上站
推文 x72 鮮花 x196
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

對SMA認識不是很深 始終有一點不明白..我永遠只僅改哪一些成功品的碼.. 最簡單就是^x01 03 04 使用哪一些

複製程式
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <nvault>
#define MAX_WORDS 192

new const PLUGIN[] = "Hook system final"
new const VERSION[] = "3.5"
new const AUTHOR[] = "WS.Chu:)"
static const VAULTNAME[] = "signature"
new const SYS_PLUGIN_NAME[] = "\y插件名稱^n\r"
new const SYS_PLUGIN_AUTHOR[] = "\y插件作者^n\r"
new const SYS_PLUGIN_VERSION[] = "\y插件版本^n\r"
new const SYS_PLUGIN_DB[] = "\y資料庫^n\r"

new iMessages[256];
new iUserName[40], iTag[256], iPlayerTag[256] = "[一般玩家]";
new iUserAlive, iUserTeam;
new tUserTeam[16], tUserAlive[10];
new gSayText, gMaxplayers;
new szVault, szName[33][35];
new cmdType;
new iHideTag;
new CHARS_MIN = 0, CHARS_MAX = 256;
new SwearsNames[MAX_WORDS][32];
new gSwearsNum;

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR);
    register_clcmd("say", "cmdHookSay");
    register_clcmd("say_team", "cmdHookSayTeam");
    
    cmdType = register_cvar("amx_hook_sysf_type", "1");
    
    register_cvar(SYS_PLUGIN_NAME, PLUGIN, FCVAR_SERVER|FCVAR_SPONLY);
    register_cvar(SYS_PLUGIN_AUTHOR, AUTHOR, FCVAR_SERVER|FCVAR_SPONLY);
    register_cvar(SYS_PLUGIN_VERSION, VERSION, FCVAR_SERVER|FCVAR_SPONLY);
    register_cvar(SYS_PLUGIN_DB, VAULTNAME, FCVAR_SERVER|FCVAR_SPONLY);
    
    szVault = nvault_open(VAULTNAME) 
    
    gSayText = get_user_msgid("SayText");
    gMaxplayers = get_maxplayers();
    
    if(get_pcvar_num(cmdType) >= 3)
    {
        server_cmd("amxx pause hook_sys.amxx");
        server_print("[ERROR] Cvar ^"hook_sys_type^" effective value are ^"0^" and ^"1^".");
        server_print("[ERROR] Plugin info: %s %s %s, auto pause plugin.", PLUGIN, VERSION, AUTHOR);
    }
    
    readList()
}

readList() 
{ 
    // file to read words from 
    new szConfigdir[64];
    new szFileName[64];
    get_configsdir(szConfigdir, 63);
    formatex(szFileName, 63, "%s/swear/swearwords.ini", szConfigdir);

    if(!file_exists(szFileName))
    {
        server_print("[ERROR] Swear Filter: file %s not found.", szFileName);
        return;
    }
    new iLen 
    while(gSwearsNum < MAX_WORDS && read_file(szFileName, gSwearsNum ,SwearsNames[gSwearsNum][1], 30, iLen))
    { 
        if(SwearsNames[gSwearsNum][0] == ';') continue;
        SwearsNames[gSwearsNum][0] = iLen;
        ++gSwearsNum;
    }
    server_print("[AMXX] Swear Filter: loaded %d words", gSwearsNum);
} 

public client_authorized(id)
{
    get_user_name(id , szName[id] , charsmax(szName[]));
}

public plugin_end()
{
    nvault_close(szVault);
}

public cmdHookSay(id)
{
    read_args(iMessages, 255);
    remove_quotes(iMessages);
    
    get_user_name(id, iUserName, 31);
    
    if(!is_valid_msg(iMessages))
        return PLUGIN_HANDLED;
    
    CheckSwears(id);
    
    if(get_user_flags(id) & ADMIN_IMMUNITY)
        iTag = "[OP]";
    else if(get_user_flags(id) & ADMIN_KICK)
        iTag = "[Administrator]";
    else if(get_user_flags(id) & ADMIN_RESERVATION)
        iTag = "[VIP]";
    else
        iTag = iPlayerTag;
    
    iUserAlive = is_user_alive(id);
    
    new szKey[32], szSingature[256], iSignature[256];
    
    formatex(szKey, 31, "%s-Signature", szName[id]);
    formatex(szSingature, charsmax(szSingature), "%s", iMessages[5]);
    
    if(iMessages[0] == '/' && iMessages[1] == 'm' && iMessages[2] == 's' && iMessages[3] == 'g' && iMessages[4] == ' ')
    {
        new iMsg = strlen(iMessages);
        
        if(iMsg < CHARS_MIN)
        {
            client_color(id, id, "[香港伺服器溫馨小提示] 您所鍵入的個性簽名太短了。(下限: %d 個英文字或中文字)", CHARS_MIN - 5);
        }
        else if(iMsg > CHARS_MAX)
        {
            client_color(id, id, "[香港伺服器溫馨小提示] 您所鍵入的個性簽名太長了。(上限: %d 個英文字或 %d 個中文字)", CHARS_MAX - 5, (CHARS_MAX - 5) / 3);
        }
        else
        {
            client_color(id, id, "[香港伺服器溫馨小提示] 您現在的個性簽名:^"%s^"。", iMessages[5]);
            nvault_set(szVault, szKey, szSingature);
        }
        return PLUGIN_HANDLED;
    }
    
    if(equal(iMessages, "/delmsg"))
    {
        formatex(szSingature, charsmax(szSingature), "沒有設定稱號");
        nvault_set(szVault, szKey, szSingature);
            
        client_color(id, id, "[香港伺服器溫馨小提示] 您現在的個性簽名已經刪除。");
        
        return PLUGIN_HANDLED;
    }
    
    formatex(szKey, 31, "%s-Signature", szName[id]);
    
    if(nvault_get(szVault, szKey, szSingature, charsmax(szSingature)))
        formatex(iSignature, charsmax(iSignature), "%s", szSingature);
    else
        formatex(iSignature, charsmax(iSignature), "沒有設定稱號");
    
if(get_pcvar_num(cmdType) == 0)
     {
           if(is_user_admin(id))
           {
                 client_color(0, id, "^x01%s^x04[^x01%s^x04] ^x03%s ^x01: %s", is_UserAlive(), iSignature, iUserName, iMessages);
                 client_print(0, print_console, "%s[%s] %s : %s", is_UserAlive(), iUserName, iSignature, iMessages);
           }
           else
           {
                 client_color(0, id, "^x01%s^x04[^x01%s^x04] ^x03%s ^x01: %s", is_UserAlive(), iSignature, iUserName, iMessages);
                 client_print(0, print_console, "%s[%s] %s : %s", is_UserAlive(), iUserName, iSignature, iMessages);
           }
     }
     else if(get_pcvar_num(cmdType) == 1)
     {      if(is_user_admin(id))
           {
                 if(equal(iMessages, "/hide"))
                 {
                       iHideTag = 1;
                       client_color(id, id, "[提示] 您的管理員標籤將由 %s 變成 %s。", iTag, iPlayerTag);
                       return PLUGIN_HANDLED;
                 }
                 if(equal(iMessages, "/show"))
                 {
                       iHideTag = 0;
                       client_color(id, id, "[提示] 您的管理員標籤將由 %s 還原成 %s。", iPlayerTag, iTag);
                       return PLUGIN_HANDLED;
                 }
           }
           else if(!is_user_admin(id))
           {
                 iHideTag = 0;
           }
           if(iHideTag == 1)
           {
                 if(!is_user_admin(id))
                 {
                       client_color(0, id, "^x01%s^x04%s ^x04[^x01%s^x04] ^x03%s ^x01: %s", is_UserAlive(), iPlayerTag, iSignature, iUserName, iMessages);
                       client_print(0, print_console, "%s%s [%s] %s : %s", is_UserAlive(), iPlayerTag, iSignature, iUserName, iMessages);
                 }
                 else
                 {
                       client_color(0, id, "^x01%s^x04%s ^x04[^x01%s^x04] ^x03%s ^x01: %s", is_UserAlive(), iPlayerTag, iSignature, iUserName, iMessages);
                       client_print(0, print_console, "%s%s [%s] %s : %s", is_UserAlive(), iPlayerTag, iSignature, iUserName, iMessages);
                 }
           }
           else if(iHideTag == 0)
           {
                 if(!is_user_admin(id))
                 {
                       client_color(0, id, "^x01%s^x04%s ^x04[^x01%s^x04] ^x03%s ^x01: %s", is_UserAlive(), iTag, iSignature, iUserName, iMessages);
                       client_print(0, print_console, "%s%s [%s] %s : %s", is_UserAlive(), iTag, iSignature, iUserName, iMessages);
                 }
                 else
                 {
                       client_color(0, id, "^x01%s^x04%s ^x04[^x01%s^x04] ^x03%s ^x01: %s", is_UserAlive(), iTag, iSignature, iUserName, iMessages);
                       client_print(0, print_console, "%s%s [%s] %s : %s", is_UserAlive(), iTag, iSignature, iUserName, iMessages);
                 }
           }
     }
     return PLUGIN_HANDLED;
}

public cmdHookSayTeam(id)
{
    read_args(iMessages, 255);
    remove_quotes(iMessages);    
    
    get_user_name(id, iUserName, 31);
    
    if(!is_valid_msg(iMessages))
        return PLUGIN_HANDLED;
        
    CheckSwears(id);
        
    iUserAlive = is_user_alive(id);
    iUserTeam = get_user_team(id);
    
    if(iMessages[0] != '@')
    {
        static player;
        
        for(player = 1; player <= gMaxplayers; player++)
        {
            if(get_user_team(player) == iUserTeam)
                client_color(player, id, "^x01%s^x03%s %s ^x01: %s", is_UserAlive(), i_UserTeam(), iUserName, iMessages);
        }
    }
    else
    {
        if(get_user_flags(id) & ADMIN_ADMIN)
            iTag = "(ADMIN)"
        else
            iTag = "(PLAYER)"
        
        new iPlayers[32], iNum;
        get_players(iPlayers, iNum, "ch");
        
//        for(new i = 0; i < iNum; i++)
//        {
//            if(get_user_flags(iPlayers[i]) & ADMIN_CHAT)
//            {
//                client_color(iPlayers[i], id, "^x04%s ^x03%s ^x01: %s", iTag, iUserName, iMessages[1]);
//            }
//            else if(!is_user_admin(iPlayers[i]))
//            {
//                client_color(iPlayers[i], id, "^x04%s ^x03%s ^x01: %s", iTag, iUserName, iMessages[1]);
//            }
//        }
        for(new i = 0; i < iNum; i++) 
        { 
            if(get_user_flags(iPlayers[i]) & ADMIN_CHAT && id != iPlayers[i]) 
            { 
                client_color(iPlayers[i], id, "^x04%s ^x03%s ^x01: %s", iTag, iUserName, iMessages[1]); 
            } 
        }
        client_color(id, id, "^x04%s ^x03%s ^x01: %s", iTag, iUserName, iMessages[1]);  
    }
    return PLUGIN_HANDLED;
}

public CheckSwears(id)
{
    new pos, i = 0;
    
    while (i < gSwearsNum)
    {
        if((pos = containi(iMessages, SwearsNames[i][1])) != -1 )
        { 
            new len = SwearsNames[i][0] 
            while(len--)
            iMessages[pos++] = '*';
            continue;
        }
        ++i
    }
    return PLUGIN_HANDLED;
}

bool:is_valid_msg(const iMessages[])
{
    if(iMessages[0] == '%' || !strlen(iMessages) || equal(iMessages, "") || equal(iMessages, " "))
    {
        return false;
    }
    return true;
}

public i_UserTeam()
{
    switch(iUserTeam)
    {
        case 0: copy(tUserTeam, sizeof(tUserTeam) - 1,"( SPEC )");
        case 1: copy(tUserTeam, sizeof(tUserTeam) - 1,"( TS )");
        case 2: copy(tUserTeam, sizeof(tUserTeam) - 1,"( CT )");
        case 3: copy(tUserTeam, sizeof(tUserTeam) - 1,"( SPEC )");
    }
    return tUserTeam;
}

public is_UserAlive()
{
    if(!iUserAlive && 0 < iUserTeam < 3)
        copy(tUserAlive, sizeof(tUserAlive) - 1,"*死亡* ");
    else
        copy(tUserAlive, sizeof(tUserAlive) - 1,"");
    return tUserAlive;
}

stock client_color(index, color, const msg[], any:...) 
{
    static szMessage[192]
    szMessage[0] = 0x04
    vformat(szMessage[1], charsmax(szMessage)-1, msg, 4)
    
    static iSayText
    if (iSayText || (iSayText = gSayText))
    {
        message_begin(index ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, iSayText, _, index)
        {
            write_byte(color)
            write_string(szMessage)
        }
        message_end()
    }
}


[ 此文章被能天使在2012-01-08 18:09重新編輯 ]




獻花 x0 回到頂端 [4 樓] From:香港特別行政區 | Posted:2012-01-08 17:30 |
能天使
個人頭像
個人文章 個人相簿 個人日記 個人地圖
初露鋒芒
級別: 初露鋒芒 該用戶目前不上站
推文 x72 鮮花 x196
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

右手大 如何把管理員設為說話 [管理員稱號](稱號)玩家名:說的話。
                                                                             ↑  隊色  ↑
把玩家設:(稱號)玩家名:說的話..
                       ↑ 隊色 ↑



而玩家/管理員只有設定稱號才有 ( )  如果/delmsg ,沒有設定稱號不會顯示 ( )


[ 此文章被能天使在2012-01-30 17:54重新編輯 ]




獻花 x0 回到頂端 [5 樓] From:香港特別行政區 | Posted:2012-01-30 01:50 |

首頁  發表文章 發表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.028668 second(s),query:16 Gzip disabled
本站由 瀛睿律師事務所 擔任常年法律顧問 | 免責聲明 | 本網站已依台灣網站內容分級規定處理 | 連絡我們 | 訪客留言