搜索
查看: 3281|回复: 5

Grief.QQ进来下,管理员给发僵尸币源码问题

[复制链接]
发表于 2009-6-19 15:01:39 | 显示全部楼层 |阅读模式 来自 广西南宁
些插件是Grief.QQ搞的吧,
但有个地方就是选择发给多少钱时按8不显示选择的要发多少币,后我加上一句,但选择第二个时要按6次第8项才行。帮忙看下是哪里不对?

#include <amxmodx>
#include <amxmisc>
#include <zombieplague>

#define PLUGIN "[ZP] 给予弹药包"
#define VERSION "0.5"
#define AUTHOR "[Grief.QQ]"

#define MENU_SIZE    256
#define MENU_PLAYERS 7

new g_iMenuPosition
new g_iMenuPlayers[32]
new g_iMenuOption[32]
new g_iMenuSettings[32]

const PACKS_1 = 200 //给予十个僵尸币(可修改)
const PACKS_2 = 500 //给予五十个僵尸币(可修改)

public plugin_init()
{
        register_plugin(PLUGIN,VERSION,AUTHOR)
        register_menucmd(register_menuid("\r在线玩家列表:"),1023,"actionMenu")
        register_clcmd("zp_money","ZP_GIVE_MONEY",ADMIN_IMMUNITY,"- displays Players")
        AddMenuItem("给予玩家弹药包","zp_money",ADMIN_IMMUNITY,PLUGIN)
}

public ZP_GIVE_MONEY( id, lvl, cid )
{
        if( cmd_access( id, lvl, cid, 0 ) )
        {
                g_iMenuOption[id] = 0
                g_iMenuSettings[id] = 0

                showMenu( id, g_iMenuPosition = 0 )
        }
        return PLUGIN_HANDLED
}

public showMenu( id, pos )
{
        if( pos < 0 ) return
       
        new i, j
        new szMenuBody[MENU_SIZE]
        new iCurrKey = 0
        new szUserName[32]
        new iStart = pos * MENU_PLAYERS
        new iNum
       
        get_players( g_iMenuPlayers, iNum )
       
        if( iStart >= iNum )
                iStart = pos = g_iMenuPosition = 0
       
        new iLen = format( szMenuBody, MENU_SIZE-1, "\r在线玩家列表:\R%d/%d^n\w^n", pos+1, (iNum / MENU_PLAYERS + ((iNum % MENU_PLAYERS) ? 1 : 0 )) )
        new iEnd = iStart + MENU_PLAYERS
        new iKeys = (1<<9|1<<7)
       
        if( iEnd > iNum )
                iEnd = iNum
       
        for( i = iStart; i < iEnd; i++ )
        {
                j = g_iMenuPlayers[i]
                get_user_name( j, szUserName, 31 )
                iKeys |= (1<<iCurrKey++)
                iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "%d. %s^n", iCurrKey, szUserName )

        }

        if ( g_iMenuSettings[id] )
                iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n8. 给予%d个僵尸币^n" ,PACKS_2)
  
        else
                iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n8. 给予%d个僵尸币^n" ,PACKS_1)
        

        if( iEnd != iNum )
        {
                format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n9. 更多玩家^n0. %s", pos ? "返回" : "退出" )
                iKeys |= (1<<8)
        }
        else

                format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n0. %s", pos ? "返回" : "退出" )
       
        show_menu( id, iKeys, szMenuBody, -1 )
       
        return
}

public actionMenu( id, key )
{
        switch( key )
        {
                case 7: {
                                ++g_iMenuOption[id]
                                g_iMenuOption[id] %= 7
                       
                                switch(g_iMenuOption[id])
                                {
                                        case 0: g_iMenuSettings[id] = 0
                                        case 1: g_iMenuSettings[id] = 1

                                }     
                                showMenu( id, g_iMenuPosition )
                        }
                case 8: showMenu( id, ++g_iMenuPosition ) // 翻页
                case 9: showMenu( id, --g_iMenuPosition ) // 返回

                default:
                {
                        new player = g_iMenuPlayers[g_iMenuPosition * MENU_PLAYERS + key]
                       
                        switch(g_iMenuSettings[id])
                        {
                                case 0: zp_set_user_ammo_packs(player, zp_get_user_ammo_packs(player) + PACKS_1);
                                case 1: zp_set_user_ammo_packs(player, zp_get_user_ammo_packs(player) + PACKS_2);

                        }
                }
        }
        return PLUGIN_HANDLED
}
发表于 2009-6-20 17:40:20 | 显示全部楼层 来自 广东广州
不知道你哪儿弄来的,我都是测试了没问题才发的。。。
回复

使用道具 举报

发表于 2009-6-22 00:00:47 | 显示全部楼层 来自 山东临沂
是啊是啊,[Grief.QQ] 这个插件很好用,尤其在测试僵尸服务器方面给了很大的方便。
我也借这个插件请教一个问题:如何让插件不定义MENU菜单前排显示,而是让插件的先后顺序来排序。
回复

使用道具 举报

发表于 2009-6-28 01:18:39 | 显示全部楼层 来自 河南南阳
测试F的话直接调5000不就行了..
回复

使用道具 举报

发表于 2012-8-28 09:26:17 | 显示全部楼层 来自 山东菏泽
可以在这个源码上面添加扣除僵尸币吗??
回复

使用道具 举报

发表于 2013-2-14 12:30:07 | 显示全部楼层 来自 辽宁鞍山
可以在这个源码上面添加扣除僵尸币吗??
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表