←  Prośby o Klasę/Perk

AMXX.pl: Support AMX Mod X i SourceMod

»

Klasa
Proszę o Klasę "Rusher"

  • +
  • -
SevSon-'s Photo SevSon- 19.04.2014

Nazwa Klasy: Rusher

Inteligencja: 0

Zycie: 25

Wytrzymalosc: 0

Kondycja: 50

Bronie: m3,usp

Opis: 1/7 z m3, pelen magazynek za zabicie

 

 

 

Z gory dzięki  ;)

Quote

  • +
  • -
Warjat's Photo Warjat 19.04.2014

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

#define DMG_BULLET (1<<1) 


new const nazwa[]   = "Rusher";
new const opis[]    = "1/7 z m3, pelen magazynek za zabicie";
new const bronie    = (1<<CSW_M3);
new const zdrowie   = 25;
new const kondycja  = 50;
new const inteligencja = 0;
new const wytrzymalosc = 0;

new const max_clip[31] = { -1, 13, -1, 10,  1,  7,  1,  30, 30,  1,  30,  20,  25, 30, 35, 25,  12,  20, 
10,  30, 100,  8, 30,  30, 20,  2,  7, 30, 30, -1,  50 };

new ma_klase[33];

public plugin_init()
{
	register_plugin(nazwa, "1.0", "amxx.pl");

	cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
	
	register_event("DeathMsg", "Death", "a");
}

public cod_class_enabled(id)
{
	ma_klase[id] = true;

}

public cod_class_disabled(id)
{
	ma_klase[id] = false;

}
public Death()
{
	new attacker = read_data(1);
	if(!is_user_connected(attacker))
		return PLUGIN_CONTINUE;
	
	if(ma_klase[attacker])
	{
		new weapon = get_user_weapon(attacker);
		if(max_clip[weapon] > 0)
			set_user_clip(attacker, max_clip[weapon]);
	}
	return PLUGIN_CONTINUE;
}

stock set_user_clip(id, ammo)
{
	new weaponname[32], weaponid = -1, weapon = get_user_weapon(id, _, _);
	get_weaponname(weapon, weaponname, 31);
	while ((weaponid = engfunc(EngFunc_FindEntityByString, weaponid, "classname", weaponname)) != 0)
		if (pev(weaponid, pev_owner) == id) {
		set_pdata_int(weaponid, 51, ammo, 4);
		return weaponid;
	}
	return 0;
}
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)	
{
	if(!is_user_connected(idattacker))
		
	return HAM_IGNORED;
	
	if(!ma_klase[idattacker])
		
	return HAM_IGNORED;
	
	if(damagebits & DMG_BULLET)
		
{
	new weapon = get_user_weapon(idattacker);
	
	if(weapon == CSW_M3 && damage > 20.0 && random_num(1,7) == 1)
		
		cod_inflict_damage(idattacker, this, float(get_user_health(this))-damage+1.0, 0.0, idinflictor, damagebits);
		
	}
	return HAM_IGNORED;
}

Nie jestem pewny czy zadziała 

Quote

  • +
  • -
same's Photo same 19.04.2014

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

#define DMG_BULLET (1<<1)


new const nazwa[] = "Rusher";
new const opis[] = "1/7 z m3, pelen magazynek za zabicie";
new const bronie    = (1<<CSW_USP)|(1<<CSW_M3);
new const zdrowie = 25;
new const kondycja = 50;
new const inteligencja = 0;
new const wytrzymalosc = 0;

new const max_clip[31] = { -1, 13, -1, 10, 1, 7, 1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 };

new ma_klase[33];

public plugin_init()
{
    register_plugin(nazwa, "1.0", "amxx.pl");

    cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
    
    register_event
("DeathMsg", "Death", "a");
}

public cod_class_enabled(id)
{
    ma_klase[id] = true;

}

public cod_class_disabled(id)
{
    ma_klase[id] = false;

}
public Death()
{
    new attacker = read_data(1);
    if(!is_user_connected(attacker))
        return PLUGIN_CONTINUE;
    
    
if(ma_klase[attacker])
    {
        new weapon = get_user_weapon(attacker);
        if(max_clip[weapon] > 0)
            set_user_clip(attacker, max_clip[weapon]);
    }
    return PLUGIN_CONTINUE;
}

stock set_user_clip(id, ammo)
{
    new weaponname[32], weaponid = -1, weapon = get_user_weapon(id, _, _);
    get_weaponname(weapon, weaponname, 31);
    while ((weaponid = engfunc(EngFunc_FindEntityByString, weaponid, "classname", weaponname)) != 0)
        if (pev(weaponid, pev_owner) == id) {
        set_pdata_int(weaponid, 51, ammo, 4);
        return weaponid;
    }
    return 0;
}
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)    
{
    if(!is_user_connected(idattacker))
        
    
return HAM_IGNORED;
    
    
if(!ma_klase[idattacker])
        
    
return HAM_IGNORED;
    
    
if(damagebits & DMG_BULLET)
        
{
    new weapon = get_user_weapon(idattacker);
    
    
if(weapon == CSW_M3 && damage > 20.0 && random_num(1,7) == 1)
        
        cod_inflict_damage
(idattacker, this, float(get_user_health(this))-damage+1.0, 0.0, idinflictor, damagebits);
        
    
}
    return HAM_IGNORED;
}

Zadziala na 100%. :)

Quote