Skocz do zawartości

  • Zaloguj korzystając z Facebooka Zaloguj korzystając z Twittera Zaloguj przez Steam Zaloguj poprzez Google      Logowanie »   
  • Rejestracja

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.

  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie
Modyfikacja

Przerobienie Pluginu.

Modyfikacja

  • Zamknięty Temat jest zamknięty
1 odpowiedź w tym temacie

#1 RaQ

    Nowy

  • Użytkownik

Reputacja: 0
zer0.

  • Postów:6
Offline

Napisano 17.02.2009 13:17

Przedstawiam wam plugin ,dzięki któremu CT może podnosić pake i kłaść .. i ja właśnie bym chciał żeby CT mogło tylko pake podnosić ale nie kłaść



/* AMX Mod X
*   CT Bomb Stealer
*
* (c) Copyright 2006-2007 by VEN
*
* This file is provided as is (no warranties)
*
*     DESCRIPTION
*       Plugin allows to CTs collect/drop/plant the dropped bomb.
*       CT bomb carrier has a VIP model and also radar+score mark.
*       Drop/plant and VIP model/marks features can be disabled.
*
*     MODULES
*       fakemeta
*       cstrike
*
*     CVARS
*       cbs_drop (0: OFF, 1: ON, default: 1) - controls drop feature
*       cbs_plant (0: OFF, 1: ON, default: 1) - controls plant feature
*       cbs_model (0: OFF, 1: ON, default: 1) - controls model feature
*         Note: clients with cl_minmodels 1 will not obey this CVar
*       cbs_marks (0: OFF, 1: ON, default: 1) - controls marks feature
*         Note: also controls model mode for clients with cl_minmodels 1
*
*     VERSIONS
*       0.2b  fixed: potentially possible error on backpack touch
*             fixed: for cbs_plant 0 bomb wasn't dropped on death/disconnect
*             fixed: for cbs_plant 0 bomb wasn't removed on respawn
*             fixed: defkit wasn't dropped on death (not a plugin's fault)
*             fixed: back defkit submodel was forced on bomb pickup
*             fixed: back defkit submodel was removed on bomb drop/plant
*             improved pcvar natives support autodetection
*             some other minor improvements
*       0.1   first release
*/

#include <amxmodx>
#include <fakemeta>
#include <cstrike>

// plugin's main information
#define PLUGIN_NAME "CT Bomb Stealer"
#define PLUGIN_VERSION "0.2beta"
#define PLUGIN_AUTHOR "VEN"

// comment to disable
#define BOMB_MAP_CHECK

// CVars names
#define CVAR_NAME_DROP "cbs_drop"
#define CVAR_NAME_PLANT "cbs_plant"
#define CVAR_NAME_MODEL "cbs_model"
#define CVAR_NAME_MARKS "cbs_marks"

// CVars default values
#define CVAR_DVAL_DROP "1"
#define CVAR_DVAL_PLANT "1"
#define CVAR_DVAL_MODEL "1"
#define CVAR_DVAL_MARKS "1"

new const g_class_model[][] = {"urban", "gsg9", "sas", "gign"}
new const g_vip_model[] = "vip"

new const CsInternalModel:g_internal_model[] = {CS_CT_URBAN, CS_CT_GSG9, CS_CT_SAS, CS_CT_GIGN}
new CsInternalModel:g_old_model

#define ATTRIB_NONE 0
#define ATTRIB_VIP (1<<2)

new /* const */ g_game_bomb_pickup[] = "#Game_bomb_pickup"
new /* const */ g_game_bomb_drop[] = "#Game_bomb_drop"
new /* const */ g_cant_be_dropped[] = "#Weapon_Cannot_Be_Dropped"
new const g_log_dropped[] = "Dropped_The_Bomb"

new const g_flags_e[] = "e"
new const g_flags_ae[] = "ae"
new const g_ct[] = "CT"

new const g_classname[] = "classname"
new const g_weapon_c4[] = "weapon_c4"
new const g_item_thighpack[] = "item_thighpack"

#define CLIENT_START_INDEX 1

new g_carrier
new g_max_clients
new g_msgid_text
new g_msgid_attrib
new g_ipsz_item_thighpack

new bool:g_collecting

// initial AMX Mod X version with the PCVar system implemented
#define PCVAR_AMXX_INIT_VER_NUM 170

// determine whether PCVar system can be used
#if defined AMXX_VERSION_NUM
	#if AMXX_VERSION_NUM >= PCVAR_AMXX_INIT_VER_NUM
		#define PCVAR_SYSTEM
	#endif
#endif

#if defined PCVAR_SYSTEM
	new g_pcvar_drop
	new g_pcvar_plant
	new g_pcvar_model
	new g_pcvar_marks

	#define CVAR_DROP get_pcvar_num(g_pcvar_drop)
	#define CVAR_PLANT get_pcvar_num(g_pcvar_plant)
	#define CVAR_MODEL get_pcvar_num(g_pcvar_model)
	#define CVAR_MARKS get_pcvar_num(g_pcvar_marks)
#else
	new g_cvar_drop[] = CVAR_NAME_DROP
	new g_cvar_plant[] = CVAR_NAME_PLANT
	new g_cvar_model[] = CVAR_NAME_MODEL
	new g_cvar_marks[] = CVAR_NAME_MARKS

	#define CVAR_DROP get_cvar_num(g_cvar_drop)
	#define CVAR_PLANT get_cvar_num(g_cvar_plant)
	#define CVAR_MODEL get_cvar_num(g_cvar_model)
	#define CVAR_MARKS get_cvar_num(g_cvar_marks)
#endif

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

#if defined PCVAR_SYSTEM
	g_pcvar_drop = register_cvar(CVAR_NAME_DROP, CVAR_DVAL_DROP)
	g_pcvar_plant = register_cvar(CVAR_NAME_PLANT, CVAR_DVAL_PLANT)
	g_pcvar_model = register_cvar(CVAR_NAME_MODEL, CVAR_DVAL_MODEL)
	g_pcvar_marks = register_cvar(CVAR_NAME_MARKS, CVAR_DVAL_MARKS)
#else
	register_cvar(g_cvar_drop, CVAR_DVAL_DROP)
	register_cvar(g_cvar_plant, CVAR_DVAL_PLANT)
	register_cvar(g_cvar_model, CVAR_DVAL_MODEL)
	register_cvar(g_cvar_marks, CVAR_DVAL_MARKS)
#endif

#if defined BOMB_MAP_CHECK
	if (!engfunc(EngFunc_FindEntityByString, FM_NULLENT, g_classname, "func_bomb_target"))
		return
#endif

	register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
	register_event("WeapPickup", "event_c4_pickup", "be", "1=6")
	register_event("TextMsg", "event_plant_try", "be", "2=#C4_Plant_At_Bomb_Spot")
	register_event("ScoreAttrib", "event_bomb_attrib", "bc", "2=2")
	register_event("DeathMsg", "event_death", "a")

	register_logevent("logevent_bomb_drop_plant", 3, "2=Dropped_The_Bomb")
	register_logevent("logevent_bomb_drop_plant", 3, "2=Planted_The_Bomb")

	register_forward(FM_Touch, "forward_touch")

	register_clcmd("drop", "clcmd_drop")

	g_max_clients = global_get(glb_maxClients)

	g_ipsz_item_thighpack = engfunc(EngFunc_AllocString, g_item_thighpack)

	g_msgid_text = get_user_msgid("TextMsg")
	g_msgid_attrib = get_user_msgid("ScoreAttrib")
}

public forward_touch(ent, id) {
	if (!(CLIENT_START_INDEX <= id <= g_max_clients) || ent <= g_max_clients || g_collecting || cs_get_user_team(id) != CS_TEAM_CT)
		return FMRES_IGNORED

	new const c4 = engfunc(EngFunc_FindEntityByString, FM_NULLENT, g_classname, g_weapon_c4)

	if (!c4 || pev(c4, pev_owner) != ent || !(pev(ent, pev_flags) & FL_ONGROUND))
		return FMRES_IGNORED

	g_collecting = true
	g_old_model = CS_DONTCHANGE
	new CsInternalModel:new_model = CS_DONTCHANGE

	if (CVAR_MODEL) {
		static model[8]
		cs_get_user_model(id, model, sizeof model - 1)
		for (new i = 0; i < sizeof g_internal_model; ++i) {
			if (equali(model, g_class_model[i])) {
				g_old_model = g_internal_model[i]
				break
			}
		}

		if (g_old_model == CS_DONTCHANGE)
			g_old_model = g_internal_model[random(sizeof g_internal_model)]

		new_model = CS_CT_VIP
	}

	static name[32]
	get_user_name(id, name, sizeof name - 1)
	msg_ct_bomb_text(name, g_game_bomb_pickup)

	cs_set_user_team(id, CS_TEAM_T)
	dllfunc(DLLFunc_Touch, ent, id)
	cs_set_user_team(id, CS_TEAM_CT, new_model)
	if (!cs_get_user_defuse(id))
		set_pev(id, pev_body, 0)

	g_carrier = id

	if (!CVAR_PLANT)
		cs_set_user_plant(id, 0)

	if (CVAR_MARKS)
		msg_score_attrib(id, ATTRIB_VIP)

	return FMRES_SUPERCEDE
}

public event_c4_pickup(id) {
	g_collecting = false
}

public clcmd_drop(id) {
	if (!is_user_alive(id) || !user_has_weapon(id, CSW_C4) || cs_get_user_team(id) != CS_TEAM_CT || CVAR_DROP)
		return PLUGIN_CONTINUE

	static arg[sizeof g_weapon_c4 + 1], dummy
	read_argv(1, arg, sizeof g_weapon_c4)
	if ((arg[0] == '^0' && get_user_weapon(id, dummy, dummy) == CSW_C4) || equal(arg, g_weapon_c4)) {
		msg_center_text(id, g_cant_be_dropped)

		return PLUGIN_HANDLED
	}

	return PLUGIN_CONTINUE
}

public event_plant_try(id) {
	if (cs_get_user_team(id) == CS_TEAM_CT && !cs_get_user_plant(id))
		// hide the message
		msg_center_text(id, "")
}

public event_bomb_attrib() {
	new const id = read_data(1)
	if (is_user_connected(id) && cs_get_user_team(id) == CS_TEAM_CT && CVAR_MARKS)
		msg_score_attrib(id, ATTRIB_VIP)
}

public logevent_bomb_drop_plant() {
	new const carrier = g_carrier
	g_carrier = 0
	static logarg[80], name[32]
	read_logargv(0, logarg, sizeof logarg - 1)
	parse_loguser(logarg, name, sizeof name - 1)
	new const id = get_user_index(name)
	new const bool:connected = bool:is_user_connected(id)
	if ((!connected && id != carrier) || (connected && cs_get_user_team(id) != CS_TEAM_CT))
		return

	read_logargv(2, logarg, sizeof g_log_dropped)
	if (equal(logarg, g_log_dropped))
		msg_ct_bomb_text(name, g_game_bomb_drop)

	if (!connected)
		return

	static model[8]
	cs_get_user_model(id, model, sizeof model - 1)
	if (equali(model, g_vip_model))
		cs_set_user_team(id, CS_TEAM_CT, g_old_model)

	new const can_defuse = cs_get_user_defuse(id)
	if (!is_user_alive(id)) {
		if (can_defuse) {
			// for some reason a defusal kit will not be created automatically in this case

			// so unset a defuse skill
			cs_set_user_defuse(id, 0)

			// and create defusal kit manually
			new const ent = engfunc(EngFunc_CreateNamedEntity, g_ipsz_item_thighpack)
			if (!ent)
				return

			static Float:origin[3]
			pev(id, pev_origin, origin)
			engfunc(EngFunc_SetOrigin, ent, origin)
			set_pev(ent, pev_spawnflags, SF_NORESPAWN)
			set_pev(ent, pev_iuser4, FL_KILLME) // a custom defusal kit mark
			dllfunc(DLLFunc_Spawn, ent)
		}

		return
	}

	if (CVAR_MARKS)
		msg_score_attrib(id, ATTRIB_NONE)

	set_pev(id, pev_body, can_defuse)
}

public event_death() {
	new const id = read_data(2)
	if (id == g_carrier && !cs_get_user_plant(id))
		// this will allow bomb auto drop
		cs_set_user_plant(id, 1, 0)
}

public client_disconnect(id) {
	if (id == g_carrier && !cs_get_user_plant(id))
		// this will allow bomb auto drop
		cs_set_user_plant(id, 1, 0)
}

public event_new_round() {
	new ent = FM_NULLENT
	while ((ent = engfunc(EngFunc_FindEntityByString, ent, g_classname, g_item_thighpack))) {
		if (pev(ent, pev_iuser4) & FL_KILLME)
			// for some reason it's necessary to remove a custom defusal kits manually
			engfunc(EngFunc_RemoveEntity, ent)
	}

	if (is_user_alive(g_carrier) && user_has_weapon(g_carrier, CSW_C4) && !cs_get_user_plant(g_carrier))
		// this will allow bomb auto strip
		cs_set_user_plant(g_carrier, 1, 0)

	g_carrier = 0
	static player[32], num
	get_players(player, num, g_flags_e, g_ct)
	if (!num)
		return

	static id, model[8]
	for (new i = 0; i < num; ++i) {
		id = player[i]
		cs_get_user_model(id, model, sizeof model - 1)
		if (equali(model, g_vip_model)) {
			cs_set_user_team(id, CS_TEAM_CT, g_old_model)
			return
		}
	}
}

msg_ct_bomb_text(/* const */ name[], /* const */ message[]) {
	static player[32], num
	get_players(player, num, g_flags_ae, g_ct)
	if (!num)
		return

	for (new i = 0; i < num; ++i) {
		message_begin(MSG_ONE, g_msgid_text, _, player[i])
		write_byte(print_center)
		write_string(message)
		write_string(name)
		message_end()
	}
}

msg_score_attrib(id, attrib) {
	message_begin(MSG_ALL, g_msgid_attrib)
	write_byte(id)
	write_byte(attrib)
	message_end()
}

msg_center_text(id, /* const */ message[]) {
	message_begin(MSG_ONE, g_msgid_text, _, id)
	write_byte(print_center)
	write_string(message)
	message_end()
}

  • +
  • -
  • 0

#2 wizu

    Godlike

  • Przyjaciel

Reputacja: 224
Profesjonalista

  • Postów:1217
  • GG:
  • Lokalizacja:Sanok
Offline

Napisano 17.02.2009 15:52

http://amxx.pl/viewt...?t=2886&start=0
  • +
  • -
  • 0





Również z jednym lub większą ilością słów kluczowych: Modyfikacja

Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych