←  Problemy

AMXX.pl: Support AMX Mod X i SourceMod

»

jak zrobić ograniczenie hp

Basturek - zdjęcie Basturek 30.06.2014

Witam może wiecie jak zrobić ograniczenie żeby asyste zaliczało dopiero jak zabierze się 50% hp lub 50 HP poniżej podaje kodzik

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <codmod>
#include <fun>
 
#define VERSION "0.1"
 
#define MAX 32
#define IsPlayer(%1) (1 <= %1 <= MAX && is_user_connected(%1))

new bool:g_bAsysta[MAX+1][MAX+1];
 
public plugin_init() {
	register_plugin("Dodatkowy Exp", VERSION, "DarkGL")
 
	register_event("DeathMsg", "eventDeath", "a");
	register_event("HLTV", "newRound", "a", "1=0", "2=0") 
 
	RegisterHam(Ham_TakeDamage, "player", "fwDamage", 1);
}
 
public newRound()
{
	for(new i = 0;i <= MAX;i++){
		for(new j = 0;j <= MAX;j++)
			g_bAsysta[i][j] = false;
	}
}

public client_connect(id){
	for(new j = 0;j <= MAX;j++)	g_bAsysta[id][j] = false;
}
 
public fwDamage(iVictim, iInflicter, iAttacker, Float:fDamage, iBitDamage){
	if( (IsPlayer(iAttacker) && IsPlayer(iVictim)) && !g_bAsysta[iAttacker][iVictim] && get_user_team(iVictim) != get_user_team(iAttacker) && iVictim != iAttacker)
		g_bAsysta[iAttacker][iVictim] = true;
 
	return HAM_IGNORED;
}
 
public eventDeath(){
	new iKiller = read_data(1);
	new iVictim = read_data(2);
 
	if(IsPlayer(iKiller) && IsPlayer(iVictim) && iKiller != iVictim)
	{
		new sName[32];
		get_user_name(iVictim, sName, sizeof sName - 1);
		
		for(new i = 0 ; i <= MAX; i ++){
			if(i == iKiller)	continue;
 
			if(g_bAsysta[i][iVictim]){		
 
				set_hudmessage(255, 16, 255, -1.0, 0.30, 0, 2.0, 2.0, 0.05, 0.05, 4)
				show_hudmessage(i, "Asystowales w zabiciu gracza %s^n^n+ 1 Frag", sName);

				set_user_frags(i, get_user_frags(i)+1)
			}
 
			g_bAsysta[i][iVictim] = false;
		}
	}
}
Odpowiedz

  • +
  • -
Puchate - zdjęcie Puchate 30.06.2014

Tutaj masz wersję że asystę możesz dostać tylko gdy zabierzesz minimum 50HP zabitemu.

 

Nie testowane :P

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
//#include <codmod>
#include <fun>

#define VERSION "0.1"

#define MAX 32
#define IsPlayer(%1) (1 <= %1 <= MAX && is_user_connected(%1))

new g_bAsysta[MAX+1][MAX+1];

public plugin_init() {
	register_plugin("Dodatkowy Exp", VERSION, "DarkGL")
	
	register_event("DeathMsg", "eventDeath", "a");
	register_event("HLTV", "newRound", "a", "1=0", "2=0") 
	
	RegisterHam(Ham_TakeDamage, "player", "fwDamage", 1);
}

public newRound()
{
	for(new i = 0;i <= MAX;i++){
		for(new j = 0;j <= MAX;j++)
			g_bAsysta[i][j] = 0;
	}
}

public client_connect(id){
	for(new j = 0;j <= MAX;j++)	g_bAsysta[id][j] = 0;
}

public fwDamage(iVictim, iInflicter, iAttacker, Float:fDamage, iBitDamage){
	if( (IsPlayer(iAttacker) && IsPlayer(iVictim)) && get_user_team(iVictim) != get_user_team(iAttacker) && iVictim != iAttacker)
		g_bAsysta[iAttacker][iVictim] += floatround(fDamage);
	
	return HAM_IGNORED;
}

public eventDeath(){
	new iKiller = read_data(1);
	new iVictim = read_data(2);
	
	if(IsPlayer(iKiller) && IsPlayer(iVictim) && iKiller != iVictim)
	{
		new sName[32];
		get_user_name(iVictim, sName, sizeof sName - 1);
		
		for(new i = 0 ; i <= MAX; i ++){
			if(i == iKiller)	continue;
			
			if(g_bAsysta[i][iVictim] >= 50){		
				
				set_hudmessage(255, 16, 255, -1.0, 0.30, 0, 2.0, 2.0, 0.05, 0.05, 4)
				show_hudmessage(i, "Asystowales w zabiciu gracza %s^n^n+ 1 Frag", sName);
				
				set_user_frags(i, get_user_frags(i)+1)
			}
			
			g_bAsysta[i][iVictim] = 0;
		}
	}
}

Użytkownik Puchate edytował ten post 30.06.2014 20:59
Odpowiedz

Basturek - zdjęcie Basturek 06.07.2014

dzięki ziomuś wszystko śmiga ładnie a jak jeszcze zrobić żeby dodawało fraga do zabójstw na bf2?

Odpowiedz

  • +
  • -
Puchate - zdjęcie Puchate 12.07.2014

Tzn?

Odpowiedz

  • +
  • -
GwynBleidD - zdjęcie GwynBleidD 12.07.2014

Chyba chodzi o statystyki BF2, żeby plugin za nie odpowiedzialny "łapał" zabójstwo i wliczał je do rankingu bf2 :)
Odpowiedz

Basturek - zdjęcie Basturek 13.07.2014

dokładnie tak jak napisał GwynBleidD chodfzi o to że jak dodaje na asyste to rankingu to żeby dodawało do statystyk BF2

Odpowiedz

  • +
  • -
Puchate - zdjęcie Puchate 13.07.2014

W brzydki sposób, ale spróbuj tak:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
//#include <codmod>
#include <fun>

#define VERSION "0.1"

#define MAX 32
#define IsPlayer(%1) (1 <= %1 <= MAX && is_user_connected(%1))

new g_bAsysta[MAX+1][MAX+1];

public plugin_init() {
	register_plugin("Dodatkowy Exp", VERSION, "DarkGL")
	
	register_event("DeathMsg", "eventDeath", "a");
	register_event("HLTV", "newRound", "a", "1=0", "2=0") 
	
	RegisterHam(Ham_TakeDamage, "player", "fwDamage", 1);
}

public newRound()
{
	for(new i = 0;i <= MAX;i++){
		for(new j = 0;j <= MAX;j++)
			g_bAsysta[i][j] = 0;
	}
}

public client_connect(id){
	for(new j = 0;j <= MAX;j++)	g_bAsysta[id][j] = 0;
}

public fwDamage(iVictim, iInflicter, iAttacker, Float:fDamage, iBitDamage){
	if( (IsPlayer(iAttacker) && IsPlayer(iVictim)) && get_user_team(iVictim) != get_user_team(iAttacker) && iVictim != iAttacker)
		g_bAsysta[iAttacker][iVictim] += floatround(fDamage);
	
	return HAM_IGNORED;
}

public eventDeath(){
	new iKiller = read_data(1);
	new iVictim = read_data(2);
	
	if(IsPlayer(iKiller) && IsPlayer(iVictim) && iKiller != iVictim)
	{
		new sName[32];
		get_user_name(iVictim, sName, sizeof sName - 1);
		
		for(new i = 0 ; i <= MAX; i ++){
			if(i == iKiller)	continue;
			
			if(g_bAsysta[i][iVictim] >= 50){		
				
				set_hudmessage(255, 16, 255, -1.0, 0.30, 0, 2.0, 2.0, 0.05, 0.05, 4)
				show_hudmessage(i, "Asystowales w zabiciu gracza %s^n^n+ 1 Frag", sName);
				
				set_user_frags(i, get_user_frags(i)+1)
				
				if(callfunc_begin("client_death", "bf2rank.amxx")) {					
					
					callfunc_push_int(iKiller)
					callfunc_push_int(iVictim)
					callfunc_push_int(get_user_weapon(iKiller))
					callfunc_push_int(HIT_GENERIC)
					callfunc_push_int(0)
					callfunc_end()
				}
			}
			
			g_bAsysta[i][iVictim] = 0;
		}
	}
}

Użytkownik Puchate edytował ten post 13.07.2014 09:27
Odpowiedz