企鹅【Amxmodx插件天书】实例1

Home Home
引用 | 編輯 xjwlcs.cn
2014-06-26 18:27
樓主
推文 x0
企鹅【Amxmodx插件天书】实例1

Hello world!

[backcolor=rgb(254,]向全世界宣布:我要做插件~~~~囧,自己做几个简单插件与大家分享啊呵呵

废话不说了,直接上代码。

本节的目标
在游戏中按Y后输入“/test”后,游戏中显示 hello world! 字样
如图:

相关代码如下
---------------------------------------分割线-------------------------------
#include <amxmodx>
#include <amxmisc>
#include <fun>




#define PLUGIN "HP to AP"
#define VERSION "1.0"
#define AUTHOR "呆笨企鹅"


public plugin_init()
        {  
        register_plugin(PLUGIN, VERSION, AUTHOR)          //注册插件
        register_clcmd("say /test", "cmd_showtext")        //设置插件激活命令,"cmd_showtext"是执行"say /test"之后的动作



public cmd_showtext(id) {  

        client_print(id, print_chat, "[TEST] hello world")      //显示文字提示

}
---------------------------------------分割线-------------------------------

本帖包含附件
檔名: zip helloworld.rar   (2022-06-09 14:21 / 1 KB)   下載次數:3


獻花 x1
引用 | 編輯 造粪大神
2014-07-07 10:19
1樓
  
感謝支持

獻花 x0
引用 | 編輯 p62104821
2014-07-12 23:26
2樓
  
client_print(id, print_chat, "[TEST] hello world")
此句應該只會在自己了聊天視窗顯示?
register_clcmd("say /test", "cmd_showtext")
會在大家的聊天窗輸入/test (例如這個是打開菜單指令
打開菜單後會在自己的聊天窗說hello world

獻花 x0