搜索
查看: 1605|回复: 4

超出16000金钱源码(英文的)(汉化我不会)

[复制链接]
发表于 2006-6-9 14:38:21 | 显示全部楼层 |阅读模式 来自 中国–广东–东莞
[PHP]#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define MONEY_TIER 8000 // DON'T MESS WITH, Money total at which the plugin switches over keeping track of money
new money_total[33] // Keep track of peeps money if above MONEY_TIER
new gmsg_Money
new bool:g_new_game
new maxmoney
new startmoney


public client_connect(id)
        {
        set_cvar_float("mp_startmoney", 801.0) // So you can track when to change to amx_startmoney ammount, I know.. a crude method
        money_total[id] = 0
}


public read_gmsg_Money(id) {
        if(!is_user_connected(id)) return PLUGIN_HANDLED
       
        new current_total = read_data(1)
       
        if(current_total == 801){                        // If CS is spawning you with mp_startmoney default
                current_total = get_pcvar_num(startmoney)                // current total is actually amx_startmoney
                cs_set_user_money(id, current_total,0)                        // so set user money to amx_startmoney
                money_total[id] = 0 // reset
        }
        if(current_total >= MONEY_TIER && !money_total[id]) // If first time above MONEY_TIER
                {
                money_total[id] = current_total // Keep track of current total
                send_moneymsg(id,1) // send money msg of current total
               
                return PLUGIN_CONTINUE
        }
        if(money_total[id]) // If was over tier on last money message
                {
                money_total[id] += current_total - MONEY_TIER  // figure the term of current total - tier
               
                if(money_total[id] < MONEY_TIER){  // If less then tier set user money to money_total[id] and stop keeping track
                        cs_set_user_money(id,money_total[id],1)
                        money_total[id] = 0
                }
                else{
                        send_moneymsg(id,1) // else send money message
                }
               
                return PLUGIN_CONTINUE               
        }
       
        return PLUGIN_CONTINUE
}


public send_moneymsg(id,flash)
        {
        cs_set_user_money(id,MONEY_TIER,flash) //Set user money to tier ammount so easy to track add and subtract terms
       
        static MAXAMMOUNT
       
        MAXAMMOUNT = get_pcvar_num(maxmoney)
       
        if(money_total[id] > MAXAMMOUNT)
                money_total[id] = MAXAMMOUNT
       
        message_begin( MSG_ONE , gmsg_Money , {0,0,0}, id) //Send money message with ammount stored in money_total[id]
        write_long(money_total[id])
        write_byte(flash)
        message_end()
}


public find_money_target(id, level, cid)
        {
        if(!cmd_access(id, level, cid, 3))
                return PLUGIN_HANDLED
       
        new target[16], ammount[8], players[32]
        new num
       
        read_argv(1,target,15)
        read_argv(2,ammount,7)
       
        if(target[0] == '@'){    //If trying to give a team money
                if(target[1] == 'C' || target[1] == 'c'){
                        get_players(players, num ,"e", "CT")
                }
                else if(target[1] == 'T' || target[1] == 't'){
                        get_players(players, num ,"e", "TERRORIST")
                }
                else{
                        console_print(id, "*** No known team by that name. ***")
                        return PLUGIN_HANDLED
                }
               
        }
        else if(target[0] == '#'){  //If trying to give a player(userid) money
                new userid = str_to_num(target[1])
                players[0] = find_player("k", userid)
        }
        else{  // else search for matching name to try and give money
                players[0] = find_player("bl", target)
        }
       
       
        if(players[0] == 0){  //If no target(s) could be found
                console_print(id, "*** No target(s) could be found. ***")
                return PLUGIN_HANDLED
        }
        else  
        give_money(players, str_to_num(ammount))
       
       
        return PLUGIN_HANDLED
}


public give_money(players[], ammount)
        {
        new i
        while(players){
                if(money_total[players]){
                        money_total[players] += ammount // Keep track of current total
                        send_moneymsg(players,1) // send money msg of current total
                }
                else if( (cs_get_user_money(players) + ammount) >= MONEY_TIER){
                        money_total[players] = cs_get_user_money(players) + ammount // Keep track of current total
                        send_moneymsg(players,1) // send money msg of current total
                }
                else{
                        ammount += cs_get_user_money(players)
                        cs_set_user_money(players,ammount,1)
                        money_total[players] = 0
                }
               
                ++i
        }
       
}


public get_cmd_info()
        {
        new s_id[3], s_ammount[8]
        new id,ammount
        new num_args = read_argc()
       
        if(num_args < 2){ // If no id set
                server_print("*** Not enough arguments when using set_user_um() ***")
                return PLUGIN_HANDLED
        }
       
        read_argv(1,s_id,2) // Get id and see if valid
        id = str_to_num(s_id)
        if(!is_user_connected(id))
                return PLUGIN_HANDLED
       
        if(num_args < 3){  // If only id sent set id's money to 0
                set_user_um(id,0,1)
                return PLUGIN_HANDLED
        }
       
        read_argv(2,s_ammount,7) // Get ammount
        ammount = str_to_num(s_ammount)
       
        if(num_args < 4){ // If no flash specified then flash
                set_user_um(id,ammount,1)
                return PLUGIN_HANDLED
        }
        else{
                set_user_um(id,ammount,0) // Don't flash
                return PLUGIN_HANDLED
        }
       
        return PLUGIN_HANDLED
}


public set_user_um(id,ammount,flash)
        {
        if(ammount < MONEY_TIER){
                cs_set_user_money(id,ammount,flash)
                money_total[id] = 0
        }
        else{
                money_total[id] = ammount // Keep track of current total
                send_moneymsg(id,flash) // send money msg of current total
        }
}

public event_new_game() {
        g_new_game = true
}

public event_new_round() {
        if (g_new_game) {
                g_new_game = false
                new startmon
                startmon = get_pcvar_num(startmoney)
                new i
                for (i = 0 ; i < 32 ; i++) {}
                {
                        money_total = startmon
                }
        }
}  


public plugin_init()
        {
        register_plugin("Unlimited Money","1.2","NL)Ramon(NL & Vantage aka Mouse")
       
        register_event("Money","read_gmsg_Money","b")
        register_event("TextMsg", "event_new_game", "a", "2=#Game_Commencing", "2=#Game_will_restart_in")
        register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
       
        startmoney = register_cvar("amx_startmoney", "800")
        maxmoney = register_cvar("amx_maxmoney", "99999")
       
        register_concmd("amx_setmoney", "find_money_target",ADMIN_LEVEL_A, "{@team, #userid, or name(can be partial)} <ammount>")
       
        register_srvcmd("set_user_um", "get_cmd_info")
        //        register_srvcmd("get_user_um", "get_user_um")
       
        gmsg_Money = get_user_msgid("Money")
       
        return PLUGIN_CONTINUE
}
[/PHP]

:byebye: :byebye: :byebye:
发表于 2006-6-9 15:32:37 | 显示全部楼层 来自 中国–福建–福州

回复: 超出16000金钱源码(英文的)(汉化我不会)

好象跟那个捡钱掉钱的差不多~~~~~~
回复

使用道具 举报

发表于 2006-6-9 16:32:37 | 显示全部楼层 来自 中国–上海–上海–松江区

回复: 超出16000金钱源码(英文的)(汉化我不会)

不是有SMA源文件的吗,要源码干吗呀...........晕
回复

使用道具 举报

 楼主| 发表于 2006-6-9 17:14:26 | 显示全部楼层 来自 中国–广东–东莞

回复: 超出16000金钱源码(英文的)(汉化我不会)

Post by topstar
不是有SMA源文件的吗,要源码干吗呀...........晕


忘了晕:cold: :cold: :cold:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
回复

使用道具 举报

发表于 2006-6-9 18:03:15 | 显示全部楼层 来自 中国–黑龙江–大庆

回复: 超出16000金钱源码(英文的)(汉化我不会)

这个不好
有个金钱无上线的好
回复

使用道具 举报

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

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