←  Pytania

AMXX.pl: Support AMX Mod X i SourceMod

»

CoD Nowy
[ROZWIĄZANE] Obrażenia klasy

Locked

  • +
  • -
Byqu^^'s Photo Byqu^^ 12.01.2013

Witam Serdecznie.
Mam małe pytanie, jak dodać do klasy obrażenia z broni np. M4 + xxx % obrażeń z int ?
Quote

  • +
  • -
Vasto_Lorde's Photo Vasto_Lorde 12.01.2013

Do includów dodajesz:
#include <hamsandwich>
#include <codmod>
Do plugin_init dodajesz
RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
Na końcu pluginu dodajesz:
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits){
if(!is_user_connected(idattacker))
return HAM_IGNORED; 

if(!ma_perk[idattacker])
return HAM_IGNORED;

if(!is_user_connected(this))
return HAM_IGNORED;

if(get_user_team(this)==get_user_team(idattacker))
return HAM_IGNORED;

if(damage<=0)
return HAM_IGNORED;

if(get_user_weapon(idattacker)==CSW_M4A1 && is_user_connected(idattacker))
cod_inflict_damage(idattacker, this, 150.0, 0.5, idinflictor, damagebits); //150 to ile dodatkowego DMG zadaje. 0.5 to ile int to 1DMG (tutaj gdy masz 2 int zadajesz 1 dmg wiecej)

return HAM_IGNORED;
}
Quote

  • +
  • -
Byqu^^'s Photo Byqu^^ 12.01.2013

Coś takiego?
#include <amxmodx>
#include <amxmisc>
#include <codmod_frakcje>
#include <engine>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <codmod>
	   
new const nazwa[]   = "Kunka(Super Premium)";
new const opis[]    = "Posiada M4 + 12% int z niego, widzialnosc spada do 60";
new const bronie    = (1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_M4A1)|(1<<CSW_FLASHBANG)|(1<<CSW_DEAGLE);
new const zdrowie   = 200;
new const kondycja  = 250;
new const inteligencja = 300;
new const wytrzymalosc = 300;
   
new const frakcja[] = "Super Premium";
   
new ma_klase[33];
public plugin_init()
{
register_plugin(nazwa, "1.0", "amxx.pl");
cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc, frakcja);
RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
}
public cod_class_enabled(id)
{
if(!(get_user_flags(id) & ADMIN_LEVEL_H))
{
  client_print(id, print_chat, "[Kunka(Super Premium)] Nie masz uprawnien, aby uzywac tej klasy.")
  return COD_STOP;
}
set_rendering(id,kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 60);
give_item(id, "weapon_hegrenade");
give_item(id, "weapon_flashbang");
give_item(id, "weapon_flashbang");
give_item(id, "weapon_smokegrenade");
cs_set_user_nvg(id, 1);
cs_set_user_defuse(id, 1);
ma_klase[id] = true;
  
return COD_CONTINUE;
}
public cod_class_disabled(id)
{
set_rendering(id,kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 255);
	 ma_klase[id] = false;
}
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits){
if(!is_user_connected(idattacker))
return HAM_IGNORED;
if(!ma_perk[idattacker])
return HAM_IGNORED;
if(!is_user_connected(this))
return HAM_IGNORED;
if(get_user_team(this)==get_user_team(idattacker))
return HAM_IGNORED;
if(damage<=0)
return HAM_IGNORED;
if(get_user_weapon(idattacker)==CSW_M4A1 && is_user_connected(idattacker))
cod_inflict_damage(idattacker, this, 150.0, 0.5, idinflictor, damagebits); //150 to ile dodatkowego DMG zadaje. 0.5 to ile int to 1DMG (tutaj gdy masz 2 int zadajesz 1 dmg wiecej)
return HAM_IGNORED;
}
Quote

  • +
  • -
Vasto_Lorde's Photo Vasto_Lorde 12.01.2013

Oj przepraszam. Podmień całe TakeDamage
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits){
if(!is_user_connected(idattacker))
return HAM_IGNORED; 

if(!ma_klase[idattacker])
return HAM_IGNORED;

if(!is_user_connected(this))
return HAM_IGNORED;

if(get_user_team(this)==get_user_team(idattacker))
return HAM_IGNORED;

if(damage<=0)
return HAM_IGNORED;

if(get_user_weapon(idattacker)==CSW_M4A1 && is_user_connected(idattacker))
cod_inflict_damage(idattacker, this, 150.0, 0.5, idinflictor, damagebits); //150 to ile dodatkowego DMG zadaje. 0.5 to ile int to 1DMG (tutaj gdy masz 2 int zadajesz 1 dmg wiecej)

return HAM_IGNORED;
}
No i powinno być dobrze. Tam gdzie:
cod_inflict_damage
Ustaw DMG tak jak chcesz
Quote

  • +
  • -
Byqu^^'s Photo Byqu^^ 12.01.2013

#include <amxmodx>
#include <amxmisc>
#include <codmod_frakcje>
#include <engine>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <codmod>
	   
new const nazwa[]   = "Kunka(Super Premium)";
new const opis[]    = "Posiada M4 + 12% int z niego, widzialnosc spada do 60";
new const bronie    = (1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_M4A1)|(1<<CSW_FLASHBANG)|(1<<CSW_DEAGLE);
new const zdrowie   = 200;
new const kondycja  = 250;
new const inteligencja = 300;
new const wytrzymalosc = 300;
   
new const frakcja[] = "Super Premium";
   
new ma_klase[33];
public plugin_init()
{
register_plugin(nazwa, "1.0", "amxx.pl");
cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc, frakcja);
RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
}
public cod_class_enabled(id)
{
if(!(get_user_flags(id) & ADMIN_LEVEL_H))
{
  client_print(id, print_chat, "[Kunka(Super Premium)] Nie masz uprawnien, aby uzywac tej klasy.")
  return COD_STOP;
}
set_rendering(id,kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 60);
give_item(id, "weapon_hegrenade");
give_item(id, "weapon_flashbang");
give_item(id, "weapon_flashbang");
give_item(id, "weapon_smokegrenade");
cs_set_user_nvg(id, 1);
cs_set_user_defuse(id, 1);
ma_klase[id] = true;
  
return COD_CONTINUE;
}
public cod_class_disabled(id)
{
set_rendering(id,kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 255);
	 ma_klase[id] = false;
}
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits){
if(!is_user_connected(idattacker))
return HAM_IGNORED;
if(!ma_klase[idattacker])
return HAM_IGNORED;
if(!is_user_connected(this))
return HAM_IGNORED;
if(get_user_team(this)==get_user_team(idattacker))
return HAM_IGNORED;
if(damage<=0)
return HAM_IGNORED;
if(get_user_weapon(idattacker)==CSW_M4A1 && is_user_connected(idattacker))
cod_inflict_damage(idattacker, this, 0.0, 10.5, idinflictor, damagebits); //150 to ile dodatkowego DMG zadaje. 0.5 to ile int to 1DMG (tutaj gdy masz 2 int zadajesz 1 dmg wiecej)
return HAM_IGNORED;
}
Objasnienie dmg? Czyli teraz jak mam 10.5 to jak będzie mieć 2 punkty w int to będzie dodatkowo zabierać 5 tak?
Quote

  • +
  • -
Vasto_Lorde's Photo Vasto_Lorde 12.01.2013

Jak masz 10.5 to za 2 int zabiera 21DMG. Jak masz ustawione 1.0 to za 2 int zabiera 2DMG. Jak masz 2.5 to 2 int to 5DMG
Quote

  • +
  • -
Byqu^^'s Photo Byqu^^ 12.01.2013

aha kumam :D Dzięki wielkie :P
Quote

  • +
  • -
MarWit's Photo MarWit 12.01.2013

Wiadomość wygenerowana automatycznie


Ten temat został zamknięty przez moderatora.

Powód: Pomoc udzielona

Jeśli się z tym nie zgadzasz, Posted Image raportuj ten post, a moderator lub administrator rozpatrzy go ponownie.


Z pozdrowieniami,
Zespół AMXX.PL
Quote
Locked