千喜哥 发表于 2009-3-31 23:00:28

帮忙看下为什么这个插件编译不成功

本帖最后由 千喜哥 于 2009-3-31 23:03 编辑

/*
-=MONEY-GIVE=-

Each player can be donated to other players.

================================================

-=VERSIONS=-

Releaseed(Time in JP)        Version         comment
------------------------------------------------
2005/01/29                1.02                main release
2005/01/29                1.03                Rename
2005/03/11                1.04                Can donate to the immunity.
                                        Bot was stopped in the reverse.
2006/03/15                1.05                Any bugfix
================================================

-=INSTALLATION=-

Compile and install plugin. (configs/plugins.ini)

================================================

-=USAGE=-

Client command / say donate
-show donate menu

Server command / amx_donate_max
-A limit of amount of money to have
-default $16000

================================================

-=SpecialThanks=-
Idea        Mr.Kaseijin
Tester        Mr.Kaseijin
        orutiga
        justice

================================================
*/
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
new g_menuPosition
new g_menuPlayers
new g_menuPlayersNum
new g_menuOption
new g_menuSettings
new g_coloredMenus
new money
public plugin_init()
{
register_plugin("MONEY-GIVE","1.05","+ARUKARI-")
register_clcmd("say donate","cmdDonateMenu")
register_clcmd("say_team donate","cmdDonateMenu")
register_cvar("amx_donate_max","16000")
register_menucmd(register_menuid("Donate Menu"),1023,"actionDonateMenu")
return PLUGIN_CONTINUE
}

public plugin_modules() {
        require_module("cstrike")
}

public actionDonateMenu(id,key) {
        switch (key) {
                case 7: {
                        ++g_menuOption
                        g_menuOption %= 7
                       
                        switch (g_menuOption) {
                                case 1: g_menuSettings = 1000
                                case 2: g_menuSettings = 3000
                                case 3: g_menuSettings = 3500
                                case 4: g_menuSettings = 5000
                                case 5: g_menuSettings = 10000
                                case 6: g_menuSettings = 16000
                        }
                        displayDonateMenu(id,g_menuPosition)
        }
                case 8: displayDonateMenu(id,++g_menuPosition)
                case 9: displayDonateMenu(id,--g_menuPosition)
        default: {
                new player = g_menuPlayers * 7 + key]

                new name2
                get_user_name(player,name2,31)

                new name
                get_user_name(id,name,31)

                money = g_menuSettings
       
                new setidmoney
                new setplmoney
                new maxmoney = get_cvar_num("amx_donate_max")
                setplmoney = (cs_get_user_money(player) + money)

                if (cs_get_user_money(id) < money){
                        client_print(id,print_chat,"[銀行轉帳系統] 你並沒有足夠的金錢給別人!!想當慈善家也是要有本錢的(0.0)")
                        return PLUGIN_HANDLED
                }else if (maxmoney < (setplmoney)){
                        new overplmoney
                        overplmoney= (maxmoney - cs_get_user_money(player))
                        setidmoney = (cs_get_user_money(id) - overplmoney)
                        cs_set_user_money(id,setidmoney)
                        cs_set_user_money(player,maxmoney)
                        client_print(id,print_chat,"【愛心捐獻】 ^%s 捐獻了 $%d 元給 ^%s,說聲謝謝吧(o.o)",name,money,name2)
                        client_print(player,print_chat,"【愛心捐獻】 $%d 的金錢施捨來自於 ^%s",money,name)
                        return PLUGIN_HANDLED
                }else{
                        setidmoney = (cs_get_user_money(id) - money)
                        cs_set_user_money(id,setidmoney)
                        cs_set_user_money(player,setplmoney)
                        client_print(id,print_chat,"【愛心捐獻】 ^%s 捐獻了 $%d 元給 ^%s,說聲謝謝吧(o.o)",name,money,name2)
                        client_print(player,print_chat,"【愛心捐獻】 $%d 的金錢施捨來自於 ^%s",money,name)
                        return PLUGIN_HANDLED
                }

                displayDonateMenu(id,g_menuPosition)
                }
        }
        return PLUGIN_HANDLED
}


displayDonateMenu(id,pos) {
if (pos < 0)return

get_players(g_menuPlayers,g_menuPlayersNum)

new menuBody
new b = 0
new i
new name, team
new start = pos * 7

if (start >= g_menuPlayersNum)
    start = pos = g_menuPosition = 0

new len = format(menuBody,511, g_coloredMenus ?
    "\yDonate Menu\R%d/%d^n\w^n" : "【愛心捐獻】: 玩家列表 %d/%d^n^n",
    pos+1,(g_menuPlayersNum / 7 + ((g_menuPlayersNum % 7) ? 1 : 0 )) )
   
new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8

if (end > g_menuPlayersNum)
    end = g_menuPlayersNum

for (new a = start; a < end; ++a) {
    i = g_menuPlayers
    get_user_name(i,name,31)
    get_user_team(i,team,3)

    if ( is_user_bot(i)||i == id) {
      ++b   
      if ( g_coloredMenus )
      len += format(menuBody,511-len,"\d%d. %s\R%s^n\w", b,name,team)
      else
      len += format(menuBody,511-len,"\d%d. %s\R%s^n\w", b,name,team)
    }
    else
    {
      keys |= (1<<b)

      len += format(menuBody,511-len, g_coloredMenus ?
      "%d. %s\y\R%s^n\w" : "%d. %s\R%s^n",++b,name,team)
    }
}

if ( g_menuOption )
    len += format(menuBody,511-len,"^n8. 捐獻金錢總額 : $ %d^n",g_menuSettings )
else
    len += format(menuBody,511-len,"^n8. 捐獻金錢總額 : $ 0^n")

if (end != g_menuPlayersNum) {
    format(menuBody,511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
    keys |= MENU_KEY_9
}
else format(menuBody,511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")

show_menu(id,keys,menuBody,-1,"Donate Menu")
}

public cmdDonateMenu(id,level,cid)
{
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
g_menuOption = 0
g_menuSettings = 0

displayDonateMenu(id,g_menuPosition = 0)
return PLUGIN_HANDLED
}
这个是DT一个朋友发的转帐插件代码

千喜哥 发表于 2009-4-3 16:11:41

为什么没人帮忙呢?

8874323 发表于 2009-4-3 16:49:24

..........

千喜哥 发表于 2009-4-3 22:49:59

谢谢斑竹!!!!
页: [1]
查看完整版本: 帮忙看下为什么这个插件编译不成功