引用 | 編輯
不想再想名字
2014-05-12 11:31 |
樓主
▼ |
||
x0
請問有沒有方法可以equal中文字?試過用下面這個, 也用了UTF-8保存, 好像沒有效果 複製程式 new const name[] = "你好嗎"; if(equal(name, "你好嗎")) { xxxxxxxxxxxx } x0
|
引用 | 編輯
弒血
2014-05-12 13:54 |
1樓
▲ ▼ |
下面是引用 不想再想名字 於 2014-05-12 11:31 發表的 請各位幫忙插件問題: 你是要取得相對應玩家名稱來觸發事件嗎 可以使用 new iname[32]; get_user_name(id, iname, charsmax(iname)); if (equal(iname, "xxx")) /xxx 你想要的玩家稱暱.. { xxxxxxx //執行的動作. } 如果判斷事件無法觸發,可能要放在玩家思考內,最好用開關判定 x0 |
引用 | 編輯
不想再想名字
2014-05-12 14:35 |
3樓
▲ ▼ |
下面是引用 s8720419 於 2014-05-12 13:54 發表的 : 感謝你的回答, 但其實我想試一下能不能用equal來對應中文字 因為我用了write_file保存資料 在read_file時會獲得中文字並進行equal(file的中文字, sma的變數) 但好像都是return false x0 |
引用 | 編輯
不想再想名字
2014-05-12 17:56 |
7樓
▲ |
下面是引用 s8720419 於 2014-05-12 17:27 發表的 : 複製程式 #include <amxmodx> new const player_data[][] = { "等級", "經驗" }; new const file[] = { "addons/amxmodx/configs/test/test.ini" }; public plugin_init() { register_plugin("Testing", "1.0", "Test"); register_clcmd("say /t", "test"); } public test(id) { new left[32], text[64], line, txtlen; while(read_file(file, line++, text, charsmax(text), txtlen)) { strtok(text, left, charsmax(left), text, charsmax(text), ' '); for(new t = 0; t < sizeof(player_data); t++) { client_print(id, print_chat, "|%s|%s|", left, player_data[t]); if(equal(left, player_data[t])) { client_print(id, print_chat, "Work"); break; } } } } x0 |