求助玩家菜单··
我想请教下玩家菜单打开后左边一般都是白色1.,2.,3.等等一直到8.这个是在一个服里看到的1-8数字觉得很漂亮。但是不知道怎么修改。我在plmenu的TXT文件里用\y〖\r1\y〗这种弄出来。游戏中显示的1.〖1〗前面白色1.还在。有知道这种怎么修改出来的么。知道的来告诉下。。谢谢了。。 /* 由by:yzmzx在08年08月27日改写*/#include <amxmodx>
#include <amxmisc>
#define PLUGIN "ServerMenu"
#define VERSION "1.3"
#define AUTHOR "yzmzx"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd( "opmenu","ShowMenu", -1, "Shows The Server Menu" )
register_menucmd(register_menuid("\y【\d征战\r管理员菜单\y】"), 1023, "MenuCommand" )
return PLUGIN_CONTINUE
}
public ShowMenu( id )
{
new szMenuBody
new keys
//怎么给菜单选项加颜色\r \y \d \w分别代表什么颜色[红 黄 灰 白]
new nLen = format( szMenuBody, 511, "\y【\d征战\r管理员菜单\y】^n" )
nLen += format( szMenuBody, 511-nLen, "^n\w1. \r【\yOP踢出玩家\r】" )
nLen += format( szMenuBody, 511-nLen, "^n\w2. \r【\yOP禁封玩家\r】" )
nLen += format( szMenuBody, 511-nLen, "^n\w3. \r【\yOP给予伤害\r】" )
nLen += format( szMenuBody, 511-nLen, "^n\w4. \r【\yOP队伍控制\r】" )
nLen += format( szMenuBody, 511-nLen, "^n\w5. \r【\yOP投票换图\r】" )
nLen += format( szMenuBody, 511-nLen, "^n\w6. \r【\yOP直接换图\r】" )
nLen += format( szMenuBody, 511-nLen, "^n\w7. \r【\yOP移除禁封\r】" )
nLen += format( szMenuBody, 511-nLen, "^n\w8. \r【OP重惩作弊】" )
nLen += format( szMenuBody, 511-nLen, "^n^n\w0. \y退出" )
keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<9)
show_menu( id, keys, szMenuBody, -1 )
return PLUGIN_CONTINUE
}
public MenuCommand( id, key )
{
switch( key )
{
case 0: {
client_cmd(id, "amx_kickmenu" )
}
case 1: {
client_cmd(id, "amx_banmenu" )
}
case 2: {
client_cmd(id, "amx_slapmenu" )
}
case 3: {
client_cmd(id, "amx_teammenu" )
}
case 4: {
client_cmd(id, "amx_votemapmenu" )
}
case 5: {
client_cmd(id, "amx_mapmenu" )
}
case 6: {
client_cmd(id, "removeiplist" )
}
case 7: {
client_cmd(id, "amx_czmenu" )
}
case 9: {
client_print( id, print_chat, "[菜单退出]" )
}
}
return PLUGIN_HANDLED
} 3# homework
这个是OP管理菜单。我想要玩家playermenu.sma这个玩家菜单插件里1.2.3.4.5能设置图中效果。怎么操作呢大哥。 :L你把菜单源码发上来。。。这个容易。。 #include <amxmodx>
#include <amxmisc>
/* Player Menus */
#define MAX_MENU_NUM 40
new g_MenuName[ MAX_MENU_NUM ]
new g_MenuCmd[ MAX_MENU_NUM ]
new PMenuName[] = "Player Menu"
new g_MenuItem[] = {
"Next",
"Back",
"Exit"
}
new g_cNum
new g_menuPosition
public plugin_init() {
register_plugin("Player Menu","0.1","nwb13")
register_menucmd(register_menuid( PMenuName ),1023,"actionPlMenu")
register_clcmd("say menu","PlMenu",ADMIN_ALL, "display player menu" )
new configs
get_configsdir(configs, 63)
format(configs, 63, "%s/%s", configs, "plmenu.ini")
loadSettings(configs)
}
loadSettings(plmenuconfig[]) {
if (!file_exists(plmenuconfig))
return 0
new temp
new a, pos = 0
while ( g_cNum < MAX_MENU_NUM && read_file(plmenuconfig,pos++,temp,255,a) ) {
if ( temp == ';' )
continue
if (parse(temp,g_MenuName,31,g_MenuCmd,31) < 2)
continue
++g_cNum
}
return 1
}
public PlMenu(id){
if (is_user_connected(id))
disPlayerMenu(id,g_menuPosition = 0)
return PLUGIN_HANDLED
}
disPlayerMenu(id,pos) {
if (pos < 0)return
new menuBody
new b = 0
new start = pos * 8
if (start >= g_cNum )
start = pos = g_menuPosition = 0
new len = format(menuBody,511,"\y%s\R%d/%d^n\w^n",PMenuName,pos+1,( g_cNum / 8 + ((g_cNum % 8) ? 1 : 0 )) )
new end = start + 8
new keys = MENU_KEY_0
if (end > g_cNum )
end = g_cNum
for (new a = start; a < end; ++a) {
keys |= (1<<b)
len += format(menuBody,511-len,"%d. %s^n",++b,g_MenuName)
}
if (end != g_cNum ) {
format(menuBody,511-len,"^n9. %s...^n0. %s", g_MenuItem, pos ? g_MenuItem : g_MenuItem)
keys |= MENU_KEY_9
}
else format(menuBody,511-len,"^n0. %s",pos ? g_MenuItem : g_MenuItem)
show_menu(id,keys,menuBody,-1,PMenuName)
}
public actionPlMenu(id,key){
switch(key){
case 8:{
disPlayerMenu(id,++g_menuPosition)
}
case 9:{
disPlayerMenu(id,--g_menuPosition)
}
default:{
new menuitem = g_menuPosition * 8 + key
client_cmd(id,"%s",g_MenuCmd)
}
}
return PLUGIN_HANDLED
} 5# yeweinan
playermenu源码我发上来了。。 7# ckn911
#include <amxmodx>
#include <amxmisc>
/* Player Menus */
#define MAX_MENU_NUM 40
new g_MenuName[ MAX_MENU_NUM ]
new g_MenuCmd[ MAX_MENU_NUM ]
new PMenuName[] = "玩家菜单"
new g_MenuItem[] = {
"下一页",
"返回",
"退出"
}
new g_cNum
new g_menuPosition
public plugin_init() {
register_plugin("玩家菜单","0.1","nwb13")
register_menucmd(register_menuid( PMenuName ),1023,"actionPlMenu")
register_clcmd("say menu","PlMenu",ADMIN_ALL, "display player menu" )
new configs
get_configsdir(configs, 63)
format(configs, 63, "%s/%s", configs, "plmenu.ini")
loadSettings(configs)
}
loadSettings(plmenuconfig[]) {
if (!file_exists(plmenuconfig))
return 0
new temp
new a, pos = 0
while ( g_cNum < MAX_MENU_NUM && read_file(plmenuconfig,pos++,temp,255,a) ) {
if ( temp == ';' )
continue
if (parse(temp,g_MenuName,31,g_MenuCmd,31) < 2)
continue
++g_cNum
}
return 1
}
public PlMenu(id){
if (is_user_connected(id))
disPlayerMenu(id,g_menuPosition = 0)
return PLUGIN_HANDLED
}
disPlayerMenu(id,pos) {
if (pos < 0)return
new menuBody
new b = 0
new start = pos * 8
if (start >= g_cNum )
start = pos = g_menuPosition = 0
new len = format(menuBody,511,"\y%s\R%d/%d^n\w^n",PMenuName,pos+1,( g_cNum / 8 + ((g_cNum % 8) ? 1 : 0 )) )
new end = start + 8
new keys = MENU_KEY_0
if (end > g_cNum )
end = g_cNum
for (new a = start; a < end; ++a) {
keys |= (1<<b)
len += format(menuBody,511-len,"\y[\r%d\y]\w %s^n",++b,g_MenuName)
}
if (end != g_cNum ) {
format(menuBody,511-len,"^n\y[\r9\y]\w %s...^n0. %s", g_MenuItem, pos ? g_MenuItem : g_MenuItem)
keys |= MENU_KEY_9
}
else format(menuBody,511-len,"^n\y[\r0\y]\w %s",pos ? g_MenuItem : g_MenuItem)
show_menu(id,keys,menuBody,-1,PMenuName)
}
public actionPlMenu(id,key){
switch(key){
case 8:{
disPlayerMenu(id,++g_menuPosition)
}
case 9:{
disPlayerMenu(id,--g_menuPosition)
}
default:{
new menuitem = g_menuPosition * 8 + key
client_cmd(id,"%s",g_MenuCmd)
}
}
return PLUGIN_HANDLED
} 8# yeweinan
插件编译出来了。编译时候出现上面图片那句话没有影响吧。
页:
[1]
2