查看: 5071|回复: 50

求助 添加开局金钱礼物源码

[复制链接]
发表于 2013-4-20 09:50:30 | 显示全部楼层 |阅读模式
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fun>

#define MAX_PLAYERS 32

#define GIFT_ITEM_NUM 5
new const GIFT_ITEM[GIFT_ITEM_NUM][] = {
        "item_kevlar",
        "item_assaultsuit",
        "weapon_hegrenade",
        "weapon_flashbang",
        "weapon_smokegrenade"

}

#define GIFT_MODEL "models/w_isotopebox.mdl"
#define GIFT_NAME "gift"

public plugin_init() {
        register_plugin("New Round Gift", "0.1", "VEN")
        register_logevent("logevent_round_start", 2, "0=World triggered", "1=Round_Start")
        register_event("RoundTime", "event_round_time", "bc")
        register_touch(GIFT_NAME, "player", "touch_gift")
        register_cvar("amx_newround_gift", "1")
}

public plugin_modules() {
        require_module("engine")
        require_module("fun")
}

public plugin_precache() {
        precache_model(GIFT_MODEL)
}

public logevent_round_start() {
        if (!get_cvar_num("amx_newround_gift"))
                return

        new pnum[2], origin[3], minor[2][3], maxor[2][3], bool:compare[2]
        for (new i = 1; i <= MAX_PLAYERS; ++i) {
                if (!is_user_alive(i))
                        continue

                new team = get_user_team(i) - 1
                if (team != 0 && team != 1)
                        continue

                pnum[team]++
                get_user_origin(i, origin)
                if (compare[team]) {
                        for (new j = 0; j < 3; ++j) {
                                if (origin[j] < minor[team][j])
                                        minor[team][j] = origin[j]
                                if (origin[j] > maxor[team][j])
                                        maxor[team][j] = origin[j]
                        }
                }
                else {
                        minor[team] = origin
                        maxor[team] = origin
                        compare[team] = true
                }
        }
        for (new i = 0; i < 2; ++i) {
                if (pnum[i] < 2)
                        continue

                new gift = create_entity("info_target")
                if (!gift) {
                        log_amx("ERROR: Couldn't create gift entity!")
                        continue
                }

                entity_set_string(gift, EV_SZ_classname, GIFT_NAME)
                entity_set_int(gift, EV_INT_solid, SOLID_TRIGGER)

                new Float:gift_origin[3]
                for (new j = 0; j < 3; ++j)
                        gift_origin[j] = float(random_num(minor[i][j], maxor[i][j]))
                gift_origin[2] += 40
                entity_set_vector(gift, EV_VEC_origin, gift_origin)

                entity_set_model(gift, GIFT_MODEL)
        }
}

public touch_gift(gift, id) {
        if (get_user_flags(id) & ADMIN_LEVEL_B)
        {
        new PlayerName[32], msg[512]
        get_user_name( id, PlayerName, 31)
        give_item(id, GIFT_ITEM[random(GIFT_ITEM_NUM)])
        remove_entity(gift)
        format(msg, 511, "^x04* 玩家:^x03%s^x04 打开了礼包,获得了一份神秘礼物!", PlayerName)
        client_color(0, id, msg)  
        }
        else if(get_user_flags(id)&ADMIN_USER)
        {
                client_color( id, print_chat, "^x04* 你不是战队队员^x03VIP^x04无法捡取礼包!")
        }
}
public event_round_time() {
        if (read_data(1) == get_cvar_num("mp_freezetime")) {
                new gift = 0
                while ((gift = find_ent_by_class(gift, GIFT_NAME)))
                        remove_entity(gift)
        }
}

public client_color(playerid, colorid, msg[])
{
  message_begin(playerid?MSG_ONE:MSG_ALL,get_user_msgid("SayText"),_,playerid)
  write_byte(colorid)
  write_string(msg)
  message_end()
}  



这是一个开局抢礼物送随机礼物源码 我想在随机礼物中添加  加钱5000    不知道i源码该怎样改   高手帮忙啊


发表于 2013-4-20 13:42:17 | 显示全部楼层
一楼的位置好啊..  
发表于 2013-4-20 20:41:20 | 显示全部楼层
我帮你 喝喝  
发表于 2013-4-21 05:16:00 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2013-4-21 07:05:00 | 显示全部楼层
爷爷都是从孙子走过来的。  
发表于 2013-4-21 11:32:26 | 显示全部楼层
初来乍到,请多多关照。。。嘿嘿,回个贴表明我来过。  
发表于 2013-4-21 17:24:12 | 显示全部楼层
这个贴不错!!!!!  
发表于 2013-4-22 11:56:17 | 显示全部楼层
哈哈,这么多的人都回了,我敢不回吗?赶快回一个,很好的,我喜欢  
发表于 2013-4-22 22:15:58 | 显示全部楼层
几头雾水…  
发表于 2013-4-23 19:53:18 | 显示全部楼层
不错不错,我喜欢看  
您需要登录后才可以回帖 登录 | 中文注册

本版积分规则