tides 发表于 2010-4-23 18:58:46

8秒内连杀奖励代码

从我的插件分离出来的,喜欢的朋友试试
#include <amxmodx>
#include <csx>

new g_KillSum         //连续杀人数量记录
new g_HeatshotSum   //爆头记录
new Float:g_Time   //保存杀人开始,结束时间
new gg_HeatshotSum

native cs_get_user_money2(index)
native cs_set_user_money2(index, money, flash=1)

public plugin_init(){
        register_plugin("连杀奖励","1.0", "3344")
        register_event("DeathMsg","eDeathMsg","a")
        register_cvar("RewardConsecutive","34000")//连杀基数
}


//连杀插入**********************************************************************
public eDeathMsg(){
        new killer,victim,wpnname
        read_data(4 , wpnname , 3)
        if(equal(wpnname,"c4")) return
               
        killer=read_data(1)
        if(!killer) return
        victim=read_data(2)
        if(get_user_team(killer)==get_user_team(victim)) return
        if(killer == victim) return

        if(get_cvar_num("RewardConsecutive") > 0){
                new Float:TimeNow = get_gametime()
                new param
                param = killer
                g_KillSum++
                g_HeatshotSum += read_data(3)
                g_Time = TimeNow
               
                if(g_KillSum==1){
                        g_Time = TimeNow
                        gg_HeatshotSum = read_data(3)
                }
                if(g_KillSum==2){
                        g_Time = TimeNow
                        gg_HeatshotSum = read_data(3)
                }
                if (g_KillSum==3){
                        g_Time = TimeNow
                        gg_HeatshotSum = read_data(3)
                       
                        if(floatround(g_Time - g_Time)<=8)
                                set_task(8.0 + g_Time - g_Time, "TimeEnd", 3344+killer, param, 1)
                        else{
                                g_KillSum--
                                g_HeatshotSum-=gg_HeatshotSum
                                g_Time = g_Time
                                g_Time = g_Time
                                gg_HeatshotSum = gg_HeatshotSum
                                gg_HeatshotSum = gg_HeatshotSum
                        }
                }
        }
}
//******************************************************************************
public TimeEnd(param[]){
        new id = param
        new time_total = floatround(g_Time - g_Time)
        if (time_total<=0)
                time_total = 1

        new Rewardmoney=(g_HeatshotSum+g_KillSum)*get_cvar_num("RewardConsecutive")/time_total
        cs_set_user_money2(id,cs_get_user_money2(id)+Rewardmoney)
       
        new name, Cmsg
        get_user_name(id, name, 31)
        format(Cmsg,sizeof Cmsg - 1,"!G『!T连杀奖!G』!T%s!W在!T%d!W秒内,连挂!T%d!W敌,!T%d!W爆头.!G奖励金钱!T%d",name,time_total,g_KillSum,g_HeatshotSum,Rewardmoney)
        client_color(0, id, Cmsg)
       
        set_hudmessage(100, 100, 255, 0.7, 0.25, 0, 6.0, 4.0, 0.5, 0.15, 3)
        show_hudmessage(0,"%s^n在%d秒内,连杀%d敌(%d爆头)^n奖励%d",name,time_total,g_KillSum,g_HeatshotSum,Rewardmoney)
       
        g_KillSum = 0
        g_HeatshotSum = 0
}

public client_disconnect(id){
        if(task_exists(3344+id))
                remove_task(3344+id)
       
        g_KillSum = 0
        g_HeatshotSum = 0
}

public client_color(playerid, colorid, msg[]){
        while(replace(msg,127,"!W","^x01")){}
        while(replace(msg,127,"0x02","^x02")){}
        while(replace(msg,127,"!T","^x03")){}
        while(replace(msg,127,"!G","^x04")){}
        message_begin(playerid?MSG_ONE:MSG_ALL,get_user_msgid("SayText"),_,playerid)
        write_byte(colorid)
        write_string(msg)
        message_end()
        client_print(playerid, print_console,msg)
}

PKEC 发表于 2010-4-25 13:15:46

有图片显示么?

baidu2008 发表于 2010-5-1 11:59:27

文件名是什么呢?

asa366 发表于 2010-5-2 22:33:12

好东西,谢谢分享

tides 发表于 2010-5-7 21:31:41

好效果图

hotbadman 发表于 2010-5-8 11:31:55

还是憨豆版比较强大.

tides 发表于 2010-5-9 08:42:31

还是憨豆版比较强大.

有源码我看看吗

PKEC 发表于 2010-6-27 05:56:32

正需要,不过你这介绍看的有点头晕

wangyang5008 发表于 2010-7-3 12:37:08

无限金钱版的,晕,不喜欢
页: [1]
查看完整版本: 8秒内连杀奖励代码