←  Poradniki, Łatki oraz Pluginy

AMXX.pl: Support AMX Mod X i SourceMod

»

CoD Nowy
AutoBH dla klasy

  • +
  • -
radim - zdjęcie radim 18.10.2011

1) Dodajemy include:
#include <engine>

2) Dodajemy pod includami:
#define	FL_WATERJUMP	(1<<11)	// popping out of the water
#define	FL_ONGROUND	(1<<9)	// not moving on the ground

3) Na koniec sma dodajemy:
public client_PreThink(id)
{
	if(!ma_klase[id])
		return PLUGIN_CONTINUE
	if (entity_get_int(id, EV_INT_button) & 2) {	
		new flags = entity_get_int(id, EV_INT_flags)
		
		if (flags & FL_WATERJUMP)
			return PLUGIN_CONTINUE
		if ( entity_get_int(id, EV_INT_waterlevel) >= 2 )
			return PLUGIN_CONTINUE
		if ( !(flags & FL_ONGROUND) )
			return PLUGIN_CONTINUE
		
		new Float:velocity[3]
		entity_get_vector(id, EV_VEC_velocity, velocity)
		velocity[2] += 250.0
		entity_set_vector(id, EV_VEC_velocity, velocity)
		
		entity_set_int(id, EV_INT_gaitsequence, 6)
		
	}
	return PLUGIN_CONTINUE
}
Odpowiedz

  • +
  • -
d0naciak - zdjęcie d0naciak 19.10.2011

+, pomogłeś :]
Odpowiedz

  • +
  • -
Muzzi - zdjęcie Muzzi 19.10.2011

Ciekawe +
Odpowiedz

  • +
  • -
A może sma? - zdjęcie A może sma? 21.10.2011

#define FL_WATERJUMP (1<<11) // popping out of the water
#define FL_ONGROUND (1<<9) // not moving on the ground

Po co...?


public client_PreThink(id)
{
if(!ma_klase[id])
return PLUGIN_CONTINUE
if(entity_get_int(id, EV_INT_button) & 2)
{
new flags = entity_get_int(id, EV_INT_flags)

if (flags & (1<<11))
return PLUGIN_CONTINUE
if (entity_get_int(id, EV_INT_waterlevel) >= 2)
return PLUGIN_CONTINUE
if (!(flags & (1<<9)))
return PLUGIN_CONTINUE

new Float:velocity[3]
entity_get_vector(id, EV_VEC_velocity, velocity)
velocity[2] += 250.0
entity_set_vector(id, EV_VEC_velocity, velocity)

entity_set_int(id, EV_INT_gaitsequence, 6)

}
return PLUGIN_CONTINUE
}
Odpowiedz

  • +
  • -
radim - zdjęcie radim 21.10.2011

@up
Wiem, Twój sposób jest szybszy, ale ja po prostu tak robię od zawsze ;)
Odpowiedz

  • +
  • -
R3X - zdjęcie R3X 22.10.2011

definicje #define istnieją tylko na etapie kompilacji, więc w praktyce oba kody działają tak samo szybko; z racji tego, że pierwszy jest bardziej czytelny jest lepszy
Odpowiedz

  • +
  • -
DarkGL - zdjęcie DarkGL 22.10.2011

obecnie jest to autobh bez spowolnienia co pozwala osiągnąć bardzo duże prędkości
Odpowiedz