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

Silver Weapon


  • Zamknięty Temat jest zamknięty
Brak odpowiedzi do tego tematu

#1 gajer

    Początkujący

  • Użytkownik

Reputacja: 0
zer0.

  • Postów:10
Offline

Napisano 02.01.2009 23:10

Witam Chce przerobić ten plugin aby player z flaga dostępu H (admin_level_h) mógł ożywać tych broni no i jak zginie to zwykly payer nie moze jej podnieść


//////////////////////////
//Silver AK Mod         //                 ===  ===
//Created by: Rolnaaba  //                 (. ) (. )
//Version: 6.0          //                    () 
//////////////////////////                  _______
//
//  **WHAT IT DOES**
//  ----------------
//    This plugin allows you to buy different Silver Weapons with no recoil, higher damage,
//  and a cool model. Admins can turn on and off the whole Silver-Weapons plugin, 
//  as well as change the cost of the Silver weapons. The Silver Weapons only last one
//  round so do as much damage as u can!
//  
//  **ADMIN COMANDS**
//  -----------------
//  admin_silverweapons 1/0 ---(if 1 the plugin if on , if 0 the plugin is off)
//  admin_AKcost  ---(the amount the AK will cost to buy Default is 10000)
//  admin_M4cost  ---(the amount the M4 will cost to buy Default is 10000)
//  admin_MPcost  ---(the amount the MP5 Navy will cost to buy Default is 10000)
//
//  **CLIENT COMANDS**
//  ------------------
//  /silverprice  ---(list the price of all the weapons)
//  /silvermenu  ---(opens the menu to buy the weapons)
//  
//  **SPECIAL THANKS TO**
//  ---------------------
//  --wonsae, he helped to create the plugin and has my undieing gratatude!!
//  (he fixed almost ever problem I came in contact with)
//  --ThomasNguyen, the whole plugin was his idea, I just made it, and wonsae made it work

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <fakemeta>

new g_Menu;
new bool:hasAK[33] = false;
new bool:hasM4[33] = false;
new bool:hasMP[33] = false;
new CVAR_ENABLE;
new CVAR_DAMAGE;
new CVAR_AKCOST;
new CVAR_M4COST;
new CVAR_MP5COST;

new gKiller = 0;
new gVictim = 0;
new gHeadshot = 0;
new gWeapon[33];
new gChangeDeathEvent = 0;

new bool:g_restart_attempt[33];

public plugin_init() {
	register_plugin("SilverWeapons", "6.0a", "Rolnaaba");
	
	g_Menu = register_menuid("Silver Weapons");
	register_menucmd(g_Menu, 1023, "silvermenu");
	register_clcmd("say /silvermenu", "showmenu");
	
	CVAR_ENABLE = register_cvar("admin_silverweapons", "1");
	CVAR_DAMAGE = register_cvar("admin_silverdamage", "2");
	CVAR_AKCOST = register_cvar("admin_AKcost", "15000"); 
	CVAR_M4COST = register_cvar("admin_M4cost", "15000");
	CVAR_MP5COST = register_cvar("admin_MPcost", "15000");
	
	register_event("CurWeapon","event_curweapon","be", "1=1");
	register_event("Damage", "event_damage", "be");
	
	//to detect Player Spawn, WHAT FUN!! (THANKS TO VEN)
	register_event("ResetHUD", "event_hud_reset", "be");
	register_clcmd("fullupdate", "clcmd_fullupdate") ;
	register_event("TextMsg", "event_restart_attempt", "a", "2=#Game_will_restart_in");
	
	register_message(get_user_msgid("DeathMsg"), "Hook_DeathMsg");
}   

public clcmd_fullupdate() {
	return PLUGIN_HANDLED_MAIN;
}

public event_restart_attempt() {
	new players[32], num;
	get_players(players, num, "a");
	for (new i; i < num; ++i)
		g_restart_attempt[players[i]] = true;
}
 
public event_hud_reset(id) {
	if (g_restart_attempt[id]) {
		g_restart_attempt[id] = false;
		return;
	}
	event_player_spawn(id);
}

public plugin_precache() {    
	precache_model("models/SilverAK/v_ak47.mdl");
	precache_model("models/SilverAK/p_ak47.mdl");
	precache_model("models/SilverM4/v_m4a1.mdl");
	precache_model("models/SilverM4/p_m4a1.mdl");
	precache_model("models/SilverMP/v_mp5.mdl");
	precache_model("models/SilverMP/p_mp5.mdl");
}   

public silvermenu(id, key) {
	switch(key) {
		case 0: SetAK(id);
		case 1: SetM4(id);
		case 2: SetMP5(id);
		default: return PLUGIN_HANDLED;
	}
	return PLUGIN_HANDLED;
}

public showmenu(id) {
	new akcost = get_pcvar_num(CVAR_AKCOST);
	new m4cost = get_pcvar_num(CVAR_M4COST);
	new mp5cost = get_pcvar_num(CVAR_MP5COST);
	
	new menu[512];
	format(menu, 511, "rSilver Weaponsw^n^n1. Buy Silver AK           y($%i)w^n2. Buy Silver M4A1       y($%i)w^n3. Buy Silver MP5         y($%i)w^n^n0. Exit^n", akcost, m4cost, mp5cost);
	
	new keys = (1<<0|1<<1|1<<2|1<<9);
	show_menu(id, keys, menu, -1, "Silver Weapons");
}

public SetAK(id) {
	if(!get_pcvar_num(CVAR_ENABLE)) {    
		client_print(id,print_chat,"Silver Weapons Mod is disabled, sorry");
		return PLUGIN_HANDLED;
	} else {
		new money = cs_get_user_money(id);
		new price = get_pcvar_num(CVAR_AKCOST);
		
		if(!is_user_alive(id)) {
			client_print(id, print_chat, "You can only buy Silver Weapons when alive");
		} else if(hasAK[id]) {
			client_print(id, print_chat, "You already have a silver AK");
		} else if(money < price) {
			client_print(id, print_chat, "You can't afford that!");
		} else {
			hasAK[id] = true;
			strip_user_weapons(id);
			cs_set_user_money(id, money - price);
			
			give_item(id,"weapon_ak47");
			give_item(id,"ammo_762nato");
			give_item(id,"ammo_762nato");
			give_item(id,"ammo_762nato");
			
			client_print(id,print_chat,"You have bought the Silver AK for %i doallars",price);
		}
	}
	return PLUGIN_HANDLED;
}

public SetM4(id) {   
	if(get_pcvar_num(CVAR_ENABLE) == 0) {     
		client_print(id,print_chat,"Silver Weapons Mod is disabled");    
		return PLUGIN_HANDLED; 
	} else {
		new money = cs_get_user_money(id);
		new price = get_pcvar_num(CVAR_M4COST);
		
		if(!is_user_alive(id)) {
			client_print(id, print_chat, "You can only buy Silver Weapons when alive");
		} else if(hasM4[id]) {
			client_print(id, print_chat, "You already have a silver M4");
		} else if(money < price) {
			client_print(id, print_chat, "You can't afford that!");
		} else {  
			hasM4[id] = true; 
			strip_user_weapons(id);
			cs_set_user_money(id,cs_get_user_money(id) - price);
			
			give_item(id,"weapon_m4a1");
			give_item(id,"ammo_556nato");
			give_item(id,"ammo_556nato");
			give_item(id,"ammo_556nato");
			
			client_print(id,print_chat,"You have bought the Silver M4A1 for %i dollars",price);
		}	 
	} 
	return PLUGIN_HANDLED;
}

public SetMP5(id) {
	if(get_pcvar_num(CVAR_ENABLE) == 0) {     
		client_print(id,print_chat,"This mod is disabled");    
		return PLUGIN_HANDLED;  
	} else {
		new money = cs_get_user_money(id);
		new price = get_pcvar_num(CVAR_MP5COST);
		
		if(!is_user_alive(id)) {
			client_print(id, print_chat, "You can only buy Silver Weapons when alive");
		} else if(hasMP[id]) {
			client_print(id, print_chat, "You already have a silver MP5NAVY");
		} else if(money < price) {
			client_print(id, print_chat, "You can't afford that!");
		} else {
			hasMP[id] = true;
			strip_user_weapons(id);   
			cs_set_user_money(id,cs_get_user_money(id) - price);
			
			give_item(id,"weapon_mp5navy");
			give_item(id,"ammo_9mm");
			give_item(id,"ammo_9mm");
			give_item(id,"ammo_9mm");
			give_item(id,"ammo_9mm");
			
			client_print(id,print_chat,"You have bought the Silver MP5NAVY for %i dollars",price);
		}
	} 	
	return PLUGIN_HANDLED; 
}

public event_curweapon(id) { 
	new clip, ammo, weapon = get_user_weapon(id, clip, ammo);
	
	if(hasAK[id] == true && weapon == CSW_AK47) { 
		set_pev(id, pev_viewmodel, "models/SilverAK/v_ak47.mdl");
		set_pev(id, pev_weaponmodel, "models/SilverAK/p_ak47.mdl");
		
		if(pev(id, pev_button) & IN_ATTACK) {
			set_pev(id, pev_punchangle, Float:{0.0, 0.0, 0.0});
		}
	}
	if(hasM4[id] == true && weapon == CSW_M4A1) {
		set_pev(id, pev_viewmodel, "models/SilverM4/v_m4a1.mdl");
		set_pev(id, pev_weaponmodel, "models/SilverM4/p_m4a1.mdl");
		
		if(pev(id, pev_button) & IN_ATTACK)  {   
			set_pev(id, pev_punchangle, Float:{0.0, 0.0, 0.0});
		}
	}
	if(hasMP[id] == true && weapon == CSW_MP5NAVY) {
		set_pev(id, pev_viewmodel, "models/SilverMP/v_mp5.mdl");
		set_pev(id, pev_weaponmodel, "models/SilverMP/p_mp5.mdl");
		
		if(pev(id, pev_button) & IN_ATTACK) {   
			set_pev(id, pev_punchangle, Float:{0.0, 0.0, 0.0});
		}
	}
	return PLUGIN_CONTINUE;
}

public event_damage(id) {
	new victim_id = id;
	
	if(!is_user_connected(victim_id)) return PLUGIN_CONTINUE;
	
	new dmg_take = read_data(2);
	new dmgtype = read_data(3);
	
	new Float:multiplier = get_pcvar_float(CVAR_DAMAGE);
	new Float:damage = dmg_take * multiplier;
	
	new health = get_user_health(victim_id);
	
	new iWeapID, attacker_id = get_user_attacker(victim_id, iWeapID);
	
	if(!is_user_connected(attacker_id) || !is_user_alive(victim_id)) {
		return PLUGIN_HANDLED;
	}
	
	if(iWeapID == CSW_AK47 && hasAK[attacker_id] == true) {
		if(floatround(damage) >= health) {
			if(victim_id == attacker_id) {
				return PLUGIN_CONTINUE;
			}else{
				log_kill(attacker_id, victim_id, "ak47", 0);
			}
			return PLUGIN_CONTINUE;
			
		} else {
			if(victim_id == attacker_id) return PLUGIN_CONTINUE;
			
			FAKE_DAMAGE(victim_id, "weapon_ak47", damage, dmgtype);
		}
	} else if( iWeapID == CSW_M4A1 && hasM4[attacker_id] == true  ) {
		
		if( floatround(damage) >= health ) {
			if( victim_id == attacker_id ) {
				return PLUGIN_CONTINUE;
			}else{
				log_kill( attacker_id, victim_id, "m4a1", 0 );
			}
			return PLUGIN_CONTINUE;
			
		}else {
			if(victim_id == attacker_id) return PLUGIN_CONTINUE;
			
			FAKE_DAMAGE(victim_id, "weapon_m4a1", damage, dmgtype);
		}
	} else if(iWeapID == CSW_MP5NAVY && hasMP[attacker_id] == true ) {
		
		if(floatround(damage) >= health) {
			if( victim_id == attacker_id ) {
				return PLUGIN_CONTINUE;
			}else{
				log_kill(attacker_id, victim_id, "mp5navy", 0);
			}
			return PLUGIN_CONTINUE;
			
		}else {
			if( victim_id == attacker_id ) return PLUGIN_CONTINUE;
			
			FAKE_DAMAGE(victim_id, "weapon_mp5navy", damage, dmgtype);
		}
	}
	return PLUGIN_CONTINUE;
}

stock log_kill(killer, victim, weapon[],headshot) {
	user_kill(victim, 1);
	
	gKiller = killer;
	gVictim = victim;
	gHeadshot = headshot;
	copy(gWeapon, 32, weapon);
	
	gChangeDeathEvent = 1;
	
	// Update killers scorboard with new info
	message_begin(MSG_ALL, get_user_msgid("ScoreInfo"))
	write_byte(killer)
	write_short(get_user_frags(killer))
	write_short(get_user_deaths(killer))
	write_short(0)
	write_short(get_user_team(killer))
	message_end()
	
	// Update victims scoreboard with correct info
	message_begin(MSG_ALL, get_user_msgid("ScoreInfo"))
	write_byte(victim)
	write_short(get_user_frags(victim))
	write_short(get_user_deaths(victim))
	write_short(0)
	write_short(get_user_team(victim))
	
	/*
	message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0);
	write_byte(killer);
	write_byte(victim);
	write_byte(headshot);
	write_string(weapon);
	message_end();
	
	new kfrags = get_user_frags( killer );
	set_user_frags( killer, kfrags++ );
	new vfrags = get_user_frags( victim );
	set_user_frags( victim, vfrags++ );
	*/
	
	return  PLUGIN_CONTINUE;
}  

public event_player_spawn(id) { 
	new clip, ammo, weapon = get_user_weapon(id, clip, ammo);
	new CsTeams:team = cs_get_user_team(id);
	
	if(hasAK[id] && weapon == CSW_AK47) { 
		hasAK[id] = false;
		set_pev(id, pev_viewmodel, "models/v_ak47.mdl");
		set_pev(id, pev_weaponmodel, "models/p_ak47.mdl");
		
		if (team == CS_TEAM_T) {
			give_item(id,"weapon_glock18");
			give_item(id,"ammo_9mm");
			give_item(id,"weapon_knife");
		} else {
			give_item(id,"weapon_usp");
			give_item(id,"ammo_45acp");
			give_item(id,"ammo_45acp");
			give_item(id,"weapon_knife");
		}
	} else if(hasM4[id] && weapon == CSW_M4A1) {
		hasM4[id] = false;
		set_pev(id, pev_viewmodel, "models/v_m4a1.mdl");
		set_pev(id, pev_weaponmodel, "models/p_m4a1.mdl");
		
		if (team == CS_TEAM_T) {
			give_item(id,"weapon_glock18");
			give_item(id,"ammo_9mm");
			give_item(id,"weapon_knife");
		} else {
			give_item(id,"weapon_usp");
			give_item(id,"ammo_45acp");
			give_item(id,"ammo_45acp");
			give_item(id,"weapon_knife");
		}
	} else if(hasMP[id] && weapon == CSW_MP5NAVY) {
		hasMP[id] = false;
		set_pev(id, pev_viewmodel, "models/v_mp5.mdl");
		set_pev(id, pev_weaponmodel, "models/p_mp5.mdl");
		
		if (team == CS_TEAM_T) {
			give_item(id,"weapon_glock18");
			give_item(id,"ammo_9mm");
			give_item(id,"weapon_knife");
		} else {
			give_item(id,"weapon_usp");
			give_item(id,"ammo_45acp");
			give_item(id,"ammo_45acp");
			give_item(id,"weapon_knife");
		}
	}
	return PLUGIN_CONTINUE;
}

//thanks to ojos.inc, god I love that include lol
stock FAKE_DAMAGE(idvictim, szClassname[], Float:takedmgdamage, damagetype) {
	new entity = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"trigger_hurt"));
	if(entity) {
		new szDamage[16];
		format(szDamage,15,"%f",takedmgdamage * 2);
		DISPATCH_KEYVALUE(entity,"dmg",szDamage);
		
		format(szDamage,15,"%i",damagetype);
		DISPATCH_KEYVALUE(entity,"damagetype",szDamage);
		
		dllfunc(DLLFunc_Spawn, entity);
		
		set_pev(entity, pev_classname, szClassname);
		dllfunc(DLLFunc_Touch, entity, idvictim);
		
		engfunc(EngFunc_RemoveEntity, entity);
		return 1;
	}
	return 0;
}

stock DISPATCH_KEYVALUE(idEntity, szKeyName[], szValue[]) {
	set_kvd(0, KV_KeyName, szKeyName);
	set_kvd(0, KV_Value, szValue);
	set_kvd(0, KV_fHandled, 0);
	return dllfunc(DLLFunc_KeyValue, idEntity, 0);
}

public Hook_DeathMsg(msg_id, msg_dest, entid) {
	if(gChangeDeathEvent) {
		//As of AMX Mod X 1.5, the middle parameter of set_* no longer does anything.
		set_msg_arg_int(1, 1, gKiller);
		set_msg_arg_int(2, 1, gVictim);
		set_msg_arg_int(3, 1, gHeadshot);
		set_msg_arg_string(4, gWeapon);
		
		gChangeDeathEvent = 0;
		
		return PLUGIN_CONTINUE;
	}
	return PLUGIN_CONTINUE;
}


Z góry ThX :)[/code]
  • +
  • -
  • 0




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

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