求大神给加个权限,本人太菜研究不出来,先谢了

社区服务
高级搜索
猴岛论坛CSGO反恐精英CS个性化修改专区求大神给加个权限,本人太菜研究不出来,先谢了
发帖 回复
倒序阅读 最近浏览的帖子最近浏览的版块
0个回复

求大神给加个权限,本人太菜研究不出来,先谢了

楼层直达
dax8415

ZxID:38101097

等级: 列兵
举报 只看楼主 使用道具 楼主   发表于: 2014-06-04 0
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>

// =================================================================================================
// Declare global variables and values
// =================================================================================================
new const weapon_dod_list[36][] = { "","weapon_amerknife","weapon_gerknife","weapon_colt","weapon_luger",
"weapon_garand","weapon_scopedkar","weapon_thompson","weapon_mp44","weapon_spring","weapon_kar","weapon_bar",
"weapon_mp40","","","","","weapon_mg42","weapon_30cal","weapon_spade","weapon_m1carbine","weapon_mg34","weapon_greasegun",
"weapon_fg42","weapon_k43","weapon_enfield","weapon_sten","weapon_bren","weapon_webley","weapon_bazooka","weapon_pschreck",
"weapon_piat","weapon_fg42","","","weapon_enfield" }
new weapon_disable[36] // Stores all disabled weapons

new client_gun_changes[33] // Keeps track of how many changes a player has left
new client_chosen_class[33] // Stores the chosen weapon class by int for use with the weapon_dod_list array
new client_chosen_weapon_id[33] // Stores the weapon entity id for each gun given to a specific client - used for blocking others
new client_spawn_class[33] // Stores the initial spawn class
new client_last_spawn_class[33] // Stores the previous spawn class
new client_last_given_class[33] // Stores the last gun given from gunsave
new client_give_switch[33] // Used to hold the state of a client who dropped their weapon to determine correct class count
new client_gunsave[33] // Used for storing client /gunsave state
new client_block_state[33] // Keeps track of whether a client chose a weapon - used for other weapon entity blocking
new client_notify[33] // Keeps track of newly joined clients and if they have been notified of features
new Float:client_give_timer[33] // Stores HL timestamp when a gun was last given plus delay for use in delaying how fast weapons can be given

new class_restrictions[36] // Stores current set of class restrictions
new class_active[36] // Stores all active classes in use
new class_load // Used as a switch to load classes into class_restrictions array once
new const class_name_list[36][] = { "","","","","","mp_limitalliesgarand","mp_limitaxisscopedkar","mp_limitalliesthompson","mp_limitaxismp44",
"mp_limitalliesspring","mp_limitaxiskar","mp_limitalliesbar","mp_limitaxismp40","","","","","mp_limitaxismg42","mp_limitallies30cal",
"","mp_limitalliescarbine","mp_limitaxismg34","mp_limitalliesgreasegun","mp_limitaxisfg42","mp_limitaxisk43",
"mp_limitbritassault","mp_limitbritlight","mp_limitbritmg","","mp_limitalliesbazooka","mp_limitaxispschreck",
"mp_limitbritpiat","mp_limitaxisfg42s","mp_limitalliescarbine","","mp_limitbritsniper" }

new const messages[16][] = { "[WeaponsMod] The weapons mod is disable right now.",
"[WeaponsMod] This weapon is currently disabled.",
"[WeaponsMod] You've used up your gun changes, you must wait until respawn to change guns again.",
"[WeaponsMod] The server has reached the maximum number of this class.",
"[WeaponsMod] Weapon change recorded.",
"[WeaponsMod] You must enable /gunsave before you can choose a weapon when dead.",
"[WeaponsMod] Type /gunlist, /gunmenu, /gunbinding, or /gunsave to use the WeaponMod features!",
"[WeaponsMod] You will now respawn with the last gun chosen!",
"[WeaponsMod] You will no longer respawn with the last gun chosen!",
"[WeaponsMod] /k98 /k43 /mp40 /stg44 /fg42 /scopedfg42 /scopedk98 /mg34 /mg42",
"[WeaponsMod] /panzerschreck /garand /carbine /thompson /greasegun /bar /piat",
"[WeaponsMod] /springfield /30cal /bazooka /enfield /sten /bren /scopedenfield",
"[WeaponsMod] To bind a gun to a key, go into console and enter: bind key ^"say /weaponname^"",
"[WeaponsMod] For example, you want the 6 key to give you the K98. You would enter:",
"[WeaponsMod] bind 6 ^"say /k98^"", "[WeaponsMod] You must un-deploy before getting a new weapon!" }

new class_name[9] // Used for blocking dropped weapons to make sure we don't block touches to non weapons
new weapon_ent_kill[33] // Stores previous weapon kill state per player

new p_weapon_changes
new p_weapon_delay

new p_max_scopedfg42
new p_max_scopedenfield
new p_max_k98
new p_max_garand
new p_max_carbine
new p_max_k43
new p_max_mp40
new p_max_thompson
new p_max_stg44
new p_max_bar
new p_max_fg42
new p_max_greasegun
new p_max_bazooka
new p_max_enfield
new p_max_sten
new p_max_mg42
new p_max_mg34
new p_max_30cal
new p_max_springfield
new p_max_scopedk98
new p_max_bren
new p_max_panzerschreck
new p_max_piat

new p_disable_scopedfg42
new p_disable_scopedenfield
new p_disable_k98
new p_disable_garand
new p_disable_carbine
new p_disable_k43
new p_disable_mp40
new p_disable_thompson
new p_disable_stg44
new p_disable_bar
new p_disable_fg42
new p_disable_greasegun
new p_disable_bazooka
new p_disable_enfield
new p_disable_sten
new p_disable_mg42
new p_disable_mg34
new p_disable_30cal
new p_disable_springfield
new p_disable_scopedk98
new p_disable_bren
new p_disable_panzerschreck
new p_disable_piat

new p_weaponsmod
new p_weapon_help
new p_class_restrictions
new p_restriction_type
new p_autospawn_weapon
new p_wm_notify
new p_remove_weapons
new p_menu_restrict
new p_give_menu

// =================================================================================================
// Plugin init
// =================================================================================================
public plugin_init() {
    register_plugin("Syn's Weapon Mod","3.003","DoD Synthetic")
    register_cvar("syns_weapon_mod", "v3.003 by Synthetic - rivurs.comrivurs.com",FCVAR_SERVER|FCVAR_SPONLY)

    register_clcmd("say /gunlist","func_help_gunlist",0)
    register_clcmd("say /gunbinding","func_help_gunbiding",0)
    register_clcmd("say /gunmenu","func_gun_menu",0)
    register_clcmd("say /gunsave","func_gun_save",0)
    
    register_clcmd("say /garand","func_garand",0)
    register_clcmd("say /scopedk98","func_scopedk98",0)
    register_clcmd("say /thompson","func_thompson",0)
    register_clcmd("say /stg44","func_stg44",0)
    register_clcmd("say /springfield","func_spring",0)
    register_clcmd("say /k98","func_k98",0)
    register_clcmd("say /bar","func_bar",0)
    register_clcmd("say /mp40","func_mp40",0)
    register_clcmd("say /mg42","func_mg42",0)
    register_clcmd("say /30cal","func_30cal",0)
    register_clcmd("say /carbine","func_carbine",0)
    register_clcmd("say /mg34","func_mg34",0)
    register_clcmd("say /greasegun","func_grease",0)
    register_clcmd("say /fg42","func_fg42",0)
    register_clcmd("say /k43","func_k43",0)
    register_clcmd("say /enfield","func_enfield",0)
    register_clcmd("say /sten","func_sten",0)
    register_clcmd("say /bren","func_bren",0)
    register_clcmd("say /bazooka","func_bazooka",0)
    register_clcmd("say /panzerschreck","func_pschreck",0)
    register_clcmd("say /piat","func_piat",0)
    register_clcmd("say /scopedfg42","func_scopedfg42",0)
    register_clcmd("say /scopedenfield","func_scopedenfield",0)
    
    p_weapon_delay = register_cvar("swm_delay","5.0")
    p_weapon_changes = register_cvar("swm_changes", "20")
    
    p_max_scopedfg42 = register_cvar("swm_max_scopedfg42","5")
    p_max_scopedenfield = register_cvar("swm_max_scopedenfield","5")
    p_max_k98 = register_cvar("swm_max_k98","5")
    p_max_garand = register_cvar("swm_max_garand","5")
    p_max_carbine = register_cvar("swm_max_carbine","5")
    p_max_k43 = register_cvar("swm_max_k43","5")
    p_max_mp40 = register_cvar("swm_max_mp40","5")
    p_max_thompson = register_cvar("swm_max_thompson","5")
    p_max_stg44 = register_cvar("swm_max_stg44","5")
    p_max_bar = register_cvar("swm_max_bar","5")
    p_max_fg42 = register_cvar("swm__max_fg42","5")
    p_max_greasegun = register_cvar("swm_max_greasegun","5")
    p_max_bazooka = register_cvar("swm_max_bazooka","5")
    p_max_enfield = register_cvar("swm_max_enfield","5")
    p_max_sten = register_cvar("swm_max_sten","5")
    p_max_mg42 = register_cvar("swm_max_mg42","5")
    p_max_mg34 = register_cvar("swm_max_mg34","5")
    p_max_30cal = register_cvar("swm_max_30cal","5")
    p_max_springfield = register_cvar("swm_max_springfield","5")
    p_max_scopedk98 = register_cvar("swm_max_scopedk98","5")
    p_max_bren = register_cvar("swm_max_bren","5")
    p_max_panzerschreck = register_cvar("swm_max_panzerschreck","5")
    p_max_piat = register_cvar("swm_max_piat","5")
    
    p_disable_scopedfg42 = register_cvar("swm_disable_scopedfg42","0")
    p_disable_scopedenfield = register_cvar("swm_disable_scopedenfield","0")
    p_disable_k98 = register_cvar("swm_disable_k98","0")
    p_disable_garand = register_cvar("swm_disable_garand","0")
    p_disable_carbine = register_cvar("swm_disable_carbine","0")
    p_disable_k43 = register_cvar("swm_disable_k43","0")
    p_disable_mp40 = register_cvar("swm_disable_mp40","0")
    p_disable_thompson = register_cvar("swm_disable_thompson","0")
    p_disable_stg44 = register_cvar("swm_disable_stg44","0")
    p_disable_bar = register_cvar("swm_disable_bar","0")
    p_disable_fg42 = register_cvar("swm__disable_fg42","0")
    p_disable_greasegun = register_cvar("swm_disable_greasegun","0")
    p_disable_bazooka = register_cvar("swm_disable_bazooka","0")
    p_disable_enfield = register_cvar("swm_disable_enfield","0")
    p_disable_sten = register_cvar("swm_disable_sten","0")
    p_disable_mg42 = register_cvar("swm_disable_mg42","0")
    p_disable_mg34 = register_cvar("swm_disable_mg34","0")
    p_disable_30cal = register_cvar("swm_disable_30cal","0")
    p_disable_springfield = register_cvar("swm_disable_springfield","0")
    p_disable_scopedk98 = register_cvar("swm_disable_scopedk98","0")
    p_disable_bren = register_cvar("swm_disable_bren","0")
    p_disable_panzerschreck = register_cvar("swm_disable_panzerschreck","0")
    p_disable_piat = register_cvar("swm_disable_piat","0")
    
    p_weaponsmod = register_cvar("swm_wm","1")
    p_weapon_help = register_cvar("swm_help", "1")
    p_class_restrictions = register_cvar("swm_class_restrict","0")
    p_restriction_type = register_cvar("swm_restrict_type","1")
    p_menu_restrict = register_cvar("swm_menu_restrict","0")
    p_autospawn_weapon = register_cvar("swm_gunsave","1")
    p_wm_notify = register_cvar("swm_notify","1")
    p_remove_weapons = register_cvar("swm_remove","0")
    p_give_menu = register_cvar("swm_give_menu","1")

    register_forward(FM_SetModel,"func_remove_weapon",1)
    register_forward(FM_Touch,"func_weapon_touch",0) // Use Fakemeta since Ham_Touch does not pickup all entity touches..Broken pre/post?
    RegisterHam(Ham_Spawn,"player","func_respawn", 1)  
    RegisterHam(Ham_Killed,"player","func_client_death",0)
    register_forward(FM_PlayerPreThink,"func_prethink")
}
    
// =================================================================================================
// Give client a weapon if they meet the proper conditions
// =================================================================================================
public func_give_weapon(id,weapon_class_id) {
    // ============================
    // Handle requirements
    // ============================
    
    // See if plugin is enabled and if not, tell client
    if(!get_pcvar_num(p_weaponsmod))
    {
        client_print(id,print_chat,messages[0])
        return PLUGIN_HANDLED
    }
    
    // See if player's gun give delay has been met
    if(get_gametime() < client_give_timer[id])
        return PLUGIN_HANDLED
    
    // See if weapon is disabled and if so, tell client
    if(weapon_disable[weapon_class_id])
    {
        client_print(id,print_chat,messages[1])
        return PLUGIN_HANDLED
    }
    
    // See if client has exceeded their gun changes
    if(!client_gun_changes[id])
    {
        client_print(id,print_chat,messages[2])
        return PLUGIN_HANDLED
    }
    
    // If restrictions are enabled, see if class limit has been reached
    if(get_pcvar_num(p_class_restrictions) && class_active[weapon_class_id] == class_restrictions[weapon_class_id] && client_chosen_class[id] != weapon_class_id)
    {
        client_print(id,print_chat,messages[3])
        return PLUGIN_HANDLED
    }
    
    // See if player is alive and handle dead player gun choice notification
    if(!is_user_alive(id))
    {
        if(client_gunsave[id])
        {
            client_print(id,print_chat,messages[4])
            client_chosen_class[id] = weapon_class_id // Store weapon choice
        }
        else
        {
            client_print(id,print_chat,messages[5])
        }
        return PLUGIN_HANDLED
    }
    
« 返回列表
发帖 回复