- 听众
- 收听
- 积分
- 373
- 主题
- 回帖
- 0
- 精华
注册时间2009-1-6
最后登录1970-1-1
该用户从未签到
|
下面代码可运行无错误但是 7 Warnings.
另外就是cmd[32],
if (strcmp(cmd, "2")==0)
囧Rz 不太懂C语法类型都不识几个 能想到的只有这个了
来个懂的帮修改优化下- #include <amxmodx>
- #include <amxmisc>
- #include <cstrike>
- #include <string>
- public plugin_init()
- {
- register_plugin("Set_Team", "0.1", "LoveHuai");
- register_clcmd("set_team_menu", "Set_Team_Menu")
- }
- public Set_Team_Menu(id, level, cid)
- {
- new menu = menu_create("队伍转移:", "Test_Menu1_Handler")
- menu_additem(menu, "转移到反恐精英", "1", ADMIN_RESERVATION)
- menu_additem(menu, "转移到恐怖分子", "2", ADMIN_RESERVATION)
- menu_setprop(menu, MPROP_EXIT, MEXIT_NEVER)
- menu_display(id, menu, 0)
- return PLUGIN_HANDLED
- }
- public Test_Menu1_Handler(id, menu, item)
- {
- if (item == MENU_EXIT)
- {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- new cmd[32], name[32], access
- menu_item_getinfo(menu, item, access, cmd, 31, name, 31, access)
- if (strcmp(cmd, "1")==0)
- {
- if (cs_get_user_team(id) == CS_TEAM_T){
- if (is_user_alive(id)) {
- user_kill(id,1);
- }
- cs_set_user_team(id,CS_TEAM_CT,CS_CT_URBAN);
- }
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- if (strcmp(cmd, "2")==0)
- {
- if (cs_get_user_team(id) == CS_TEAM_CT){
- if (is_user_alive(id)) {
- user_kill(id,1);
- }
- cs_set_user_team(id,CS_TEAM_T,CS_T_TERROR);
- }
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
复制代码 |
|