Skocz do zawartości

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

Can you help me with this ?Compile fine, but the thing i want doesnt do the thing

class error

  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
6 odpowiedzi w tym temacie

#1 MasamuneDate

    Pomocny

  • Użytkownik

Reputacja: 1
Nowy

  • Postów:60
  • Imię:Nat Davin
  • Lokalizacja:INDONESIA
Offline

Napisano 21.04.2020 11:09

Hey, i just want to ask something from this code.

 

So basicly, the thing i want is, when you headshot people, you instantly recover 50 HP, and those HP can accumulate regardless of your max health. So let say, you have 100 max health, but you managa to headshot somebody 5 times without a miss and without being hit. So that put your hp into 100 + 250 -> so you will have 350 HP

 

I Compiled everything fine, but when i headshot people, my HP doesnt recover. Anyone can help ?


  • +
  • -
  • 0

#2 MasamuneDate

    Pomocny

  • Autor tematu
  • Użytkownik

Reputacja: 1
Nowy

  • Postów:60
  • Imię:Nat Davin
  • Lokalizacja:INDONESIA
Offline

Napisano 21.04.2020 11:10

I forgot to attach the file

Załączone pliki


  • +
  • -
  • 0

#3 Misiu.

    Kochanek DarkGL

  • Power User

Reputacja: 174
Profesjonalista

  • Postów:539
  • GG:
  • Steam:steam
  • Imię:Adrian
  • Lokalizacja:Zgorzelec
Offline

Napisano 21.04.2020 11:58

Look this https://amxx.pl/topi...stwo-dla-klasy/


  • +
  • -
  • 0

PoGrywamy.pl - Pograj Razem Z Nami

 

Tatusiek serwerów:

[ONLY DD2 #2] 1shot2kill.pl

[ONLY DD2] PoGrywamy.pl

Przyjmuje płatne zlecenia!


#4 MasamuneDate

    Pomocny

  • Autor tematu
  • Użytkownik

Reputacja: 1
Nowy

  • Postów:60
  • Imię:Nat Davin
  • Lokalizacja:INDONESIA
Offline

Napisano 22.04.2020 07:58

 

its not HP / killing, but HP for each shots.

 

EDIT : ok i see the error on my health recovery. Aside that, does my code for headshot already correct ?


Użytkownik MasamuneDate edytował ten post 22.04.2020 07:59

  • +
  • -
  • 0

#5 dasiek

    Nie wiem, nie znam się, nie orientuję się, zarobiony jestem.

  • Junior Admin

Reputacja: 2 077
Godlike

  • Postów:5 706
  • Imię:Adaś
  • Lokalizacja:No teraz trochę dalej od WWy
Offline

Napisano 22.04.2020 09:54


 I havent written any class or plugin for amxx for a long time, but I have few comments -  have a Where you find the code to detect headshot?  I think you can move logic from `func_TraceAttack` to `TakeDamage`, just like that:
 

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
#include <fakemeta>
#include <codmod>
#include <colorchat>
#include <hamsandwich>

#define PLUGIN 		"Black Ops Commander"
#define VERSION 	"1.0"
#define AUTHOR 		"MasamuneDate"

new const nazwa[]   = "Black Ops Commander";
new const opis[]    = "Restore 30 HP for each headshot";
new const bronie    = 1<<CSW_TMP | 1<<CSW_G3SG1 | 1<<CSW_FIVESEVEN ;
new const zdrowie   = 25;
new const kondycja  = 10;
new const inteligencja = 0;
new const wytrzymalosc = 0;

new bool:ma_klase[33];
new hitbox[33];

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR);
	cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
	RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
}

public cod_class_enabled(id)
{
	ColorChat(id, GREEN, "Created by MasamuneDate",  nazwa);
	ma_klase[id] = true;
}

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

public TakeDamage(id, idattacker, Float:damage, Float:direction[3], traceresult, damagebits)
{
	
	if(!is_user_connected(idattacker)) {
		return HAM_IGNORED; 
	}
	
	if(!ma_klase[idattacker]) {
		return HAM_IGNORED; 
	}
		
	new hitbox = get_tr2(traceresult, TR_iHitgroup);

	if(hitbox == HIT_HEAD)
	{
		new cur_health = get_user_health(idattacker);
		new max_health = 100+cod_get_user_health(idattacker);

		new new_health = cur_health+50;
		if(new_health > max_health) {
			new_health = max_health;
		}
		set_user_health(idattacker, new_health);
	}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1041\\ f0\\ fs16 \n\\ par }
*/


  • +
  • -
  • 0

#6 MasamuneDate

    Pomocny

  • Autor tematu
  • Użytkownik

Reputacja: 1
Nowy

  • Postów:60
  • Imię:Nat Davin
  • Lokalizacja:INDONESIA
Offline

Napisano 22.04.2020 11:31

 

 I havent written any class or plugin for amxx for a long time, but I have few comments - have a Where you find the code to detect headshot? I think you can move logic from `func_TraceAttack` to` TakeDamage`, just like that:
 

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
#include <fakemeta>
#include <codmod>
#include <colorchat>
#include <hamsandwich>

#define PLUGIN "Black Ops Commander"
#define VERSION "1.0"
#define AUTHOR "MasamuneDate"

new const name [] = "Black Ops Commander";
new const description [] = "Restore 30 HP for each headshot";
new const weapons = 1 << CSW_TMP | 1 << CSW_G3SG1 | 1 << CSW_FIVESEVEN;
new const health = 25;
new const condition = 10;
new const intelligence = 0;
new const strength = 0;

new bool: ma_klase [33];
new hitbox [33];

public plugin_init ()
{
	register_plugin (PLUGIN, VERSION, AUTHOR);
	cod_register_class (name, description, weapons, health, condition, intelligence, endurance);
	RegisterHam (Ham_TakeDamage, "player", "TakeDamage");
}

public cod_class_enabled (id)
{
	ColorChat (id, GREEN, "Created by MasamuneDate", name);
	ma_klase [id] = true;
}

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

public TakeDamage (id, idattacker, Float: damage, Float: direction [3], traceresult, damagebits)
{
	
	if (! is_user_connected (idattacker)) {
		return HAM_IGNORED; 
	}
	
	if (! ma_klase [idattacker]) {
		return HAM_IGNORED; 
	}
		
	new hitbox = get_tr2 (traceresult, TR_iHitgroup);

	if (hitbox == HIT_HEAD)
	{
		new cur_health = get_user_health (idattacker);
		new max_health = 100 + cod_get_user_health (idattacker);

		new new_health = cur_health + 50;
		if (new_health> max_health) {
			new_health = max_health;
		}
		set_user_health (idattacker, new_health);
	}
}
/ * AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
* {\\ rtf1 \\ ansi \\ deff0 {\\ fonttbl {\\ f0 \\ fnil Tahoma;}} \ n \\ viewkind4 \\ uc1 \\ pard \\ lang1041 \\ f0 \\ fs16 \ n \\ par}
* /

to be honest i dont know either. I look at some plugins on alliedmodder, and try to do it myself. Because, i really dont have a basic skill, i just try to learn it by practicing, and understanding them as best as i could.
 

Note 1: I think my code for heal is alright(?) i really dont know, cause the base heal code i got from killing enemy, now i try to change it to when it doesnt kill
Note 2: Im still confused about the headshot code, because this is the first time i try it after looking at serveral similiar code on alliedmodder forum.


  • +
  • -
  • 0

#7 MasamuneDate

    Pomocny

  • Autor tematu
  • Użytkownik

Reputacja: 1
Nowy

  • Postów:60
  • Imię:Nat Davin
  • Lokalizacja:INDONESIA
Offline

Napisano 01.05.2020 03:03

up


  • +
  • -
  • 0





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

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

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