搜索
查看: 2587|回复: 4

一个Bug,每局时间不见了!

[复制链接]
发表于 2008-3-4 20:53:18 | 显示全部楼层 |阅读模式 来自 中国–广东–佛山–三水区
一个noobjectives.sma的插件,这个插件是可以去掉C4,
但存在一个Bug,每局时间不见了!
请问如何修改才可以按正常那样!谢谢


/* AMX Mod X
*   No Objectives
*
* (c) Copyright 2007 by VEN
*
* This file is provided as is (no warranties)
*
*        DESCRIPTION
*                Plugin allow to remove all map objectives or objectives of certain type.
*                Round timer will be disbled for maps that doesn't contain any objectives.
*
*        CVARS
*                no_objectives (flags: acde, default: acde, "": disable the plugin)
*                        a - remove "as" (vip assasination) objectives
*                        c - remove "cs" (hostage rescue) objectives
*                        d - remove "de" (bomb defuse) objectives
*                        e - remove "es" (T escape) objectives
*                Note: map change on CVar change required.
*
*        VERSIONS
*                0.3
*                        - added support for all objective entities
*                        - fixed: timer wasn't shown on multi objective maps if objectives wasn't completely removed
*                        - improvements in objective modes routine
*                0.2
*                        - disabled round timer
*                        - added no_objectives CVar
*                0.1
*                        - initial version
*/

// plugin's main information
#define PLUGIN_NAME "No Objectives"
#define PLUGIN_VERSION "0.3"
#define PLUGIN_AUTHOR "VEN"

#include <amxmodx>
#include <fakemeta>

new const g_objective_ents[][] = {
        "func_bomb_target",
        "info_bomb_target",
        "hostage_entity",
        "monster_scientist",
        "func_hostage_rescue",
        "info_hostage_rescue",
        "info_vip_start",
        "func_vip_safetyzone",
        "func_escapezone"
}

#define OBJTYPE_AS (1<<0)
#define OBJTYPE_CS (1<<2)
#define OBJTYPE_DE (1<<3)
#define OBJTYPE_ES (1<<4)
#define OBJTYPE_ALL (OBJTYPE_AS | OBJTYPE_CS | OBJTYPE_DE | OBJTYPE_ES)

#define CVAR_NAME "no_objectives"
#define CVAR_DEFAULT OBJTYPE_ALL

new const g_objective_type[] = {
        OBJTYPE_DE,
        OBJTYPE_DE,
        OBJTYPE_CS,
        OBJTYPE_CS,
        OBJTYPE_CS,
        OBJTYPE_CS,
        OBJTYPE_AS,
        OBJTYPE_AS,
        OBJTYPE_ES
}

new const bool:g_objective_prim[] = {
        true,
        true,
        true,
        false,
        false,
        false,
        false,
        true,
        true
}

#define HIDE_ROUND_TIMER (1<<4)

new g_msgid_hideweapon

new g_pcvar_no_objectives

new g_no_objectives = CVAR_DEFAULT & OBJTYPE_ALL

public plugin_precache() {
        if ((g_pcvar_no_objectives = get_cvar_pointer(CVAR_NAME))) {
                new cvar_val[8]
                get_pcvar_string(g_pcvar_no_objectives, cvar_val, sizeof cvar_val - 1)
                g_no_objectives = read_flags(cvar_val) & OBJTYPE_ALL
        }

        if (g_no_objectives)
                register_forward(FM_Spawn, "forward_spawn")
}

public plugin_init() {
        register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)

        if (!g_pcvar_no_objectives) {
                new cvar_defval[8]
                get_flags(CVAR_DEFAULT, cvar_defval, sizeof cvar_defval - 1)
                register_cvar(CVAR_NAME, cvar_defval)
        }

        if (is_objective_map())
                return

        g_msgid_hideweapon = get_user_msgid("HideWeapon")
        register_message(g_msgid_hideweapon, "message_hide_weapon")
        register_event("ResetHUD", "event_hud_reset", "b")
        set_msg_block(get_user_msgid("RoundTime"), BLOCK_SET)
}

public forward_spawn(ent) {
        if (!pev_valid(ent))
                return FMRES_IGNORED

        static classname[32], i
        pev(ent, pev_classname, classname, sizeof classname - 1)
        for (i = 0; i < sizeof g_objective_ents; ++i) {
                if (equal(classname, g_objective_ents)) {
                        if (!(g_no_objectives & g_objective_type))
                                return FMRES_IGNORED

                        engfunc(EngFunc_RemoveEntity, ent)
                        return FMRES_SUPERCEDE
                }
        }

        return FMRES_IGNORED
}

public message_hide_weapon() {
        set_msg_arg_int(1, ARG_BYTE, get_msg_arg_int(1) | HIDE_ROUND_TIMER)
}

public event_hud_reset(id) {
        message_begin(MSG_ONE, g_msgid_hideweapon, _, id)
        write_byte(HIDE_ROUND_TIMER)
        message_end()
}

bool:is_objective_map() {
        new const classname[] = "classname"
        for (new i = 0; i < sizeof g_objective_ents; ++i) {
                if (g_objective_prim && engfunc(EngFunc_FindEntityByString, FM_NULLENT, classname, g_objective_ents))
                        return true
        }

        return false
}
 楼主| 发表于 2008-3-6 09:19:50 | 显示全部楼层 来自 中国–广东–佛山–三水区

回复: 一个Bug,每局时间不见了!

Post by Cr@zyTreE
插件的主要功能是什么啊?怎么要去掉C4呢?什么类型服务器用这个?


这个是针对魔兽版的服务器中存在的一个Bug,
是这样的,做过魔兽服的都应该知道魔兽插件存在一个“极为讨厌的Bug”
就是刷包得经验!因现在还未有办法解决这个问题,为有把C4撤掉!

landyhsu帮我改的那个最新noobjectives.sma已经可以做到!C4去掉了!
但另外一个问题又来了,没了C4,每局时间到了,没有出现CT win 或 T win
要等到其中一方输掉,才可以进行下一局!
这下烦了。。。
不知道这个noobjectives.sma能否修写一下,实现不需CT win 或 T win,
一到时间就轮到下一局,即我设定每局为2分钟,到了2分钟,服务器按正常的
宣判那一方胜出,没有了任务目标C4,如何决解那一方胜出呢?
能否按相方剩余玩家来决定,谢谢!
回复 0 1

使用道具 举报

发表于 2008-3-4 21:52:51 | 显示全部楼层 来自 中国–上海–上海–松江区

回复: 一个Bug,每局时间不见了!

根据原作者VEN的提示,修改并测试了一下,可以显示时间并去掉了C4

本帖子中包含更多资源

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

×
回复

使用道具 举报

 楼主| 发表于 2008-3-4 21:58:26 | 显示全部楼层 来自 中国–广东–佛山–三水区

回复: 一个Bug,每局时间不见了!

landyhsu 实在太感谢你了!
回复

使用道具 举报

发表于 2008-3-5 20:12:54 | 显示全部楼层 来自 中国–广东–深圳

回复: 一个Bug,每局时间不见了!

Post by landyhsu
根据原作者VEN的提示,修改并测试了一下,可以显示时间并去掉了C4

插件的主要功能是什么啊?怎么要去掉C4呢?什么类型服务器用这个?
回复

使用道具 举报

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

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