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

[forums.alliedmods.net] [TF2] tWeaponShootPosition v0.0.1 (2012-03-11)


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 Adminek AMXX.PL

    Admin :)

  • Bot

Reputacja: 156
Profesjonalista

  • Postów:7 492
  • Lokalizacja:AMXX.PL
Offline

Napisano 11.03.2012 14:17

This plugin is using the pre-alpha DHooks extension to hook Weapon_ShootPosition. It is required for runtime and compilation.

Weapon_ShootPosition get's called everytime a player fires a shot (and has ammo for it etc).
Since TF2 is missing a proper way to detect firing with TF2_CalcIsCritical requiring tf_weapon_criticals to be 1 and +ATTACK hooks fire even if the player has no weapons and therefore require lots of validity checks, hooking ShootPosition is probably one of the easier ways.

This plugin simply provides a forward whenever a client shoots a weapon.

Example Code:


PHP Code:

#include <sourcemod>
#include <tweaponshootposition>

public OnClientWeaponShootPosition(client, Float:position[3]) {
PrintToServer("%N is firing his weapon at %.2f %.2f %.2f", client, position[0], position[1], position[2]);
}

Feel free to strip this plugin of it's forwarding stuff and use the code directly in your plugin if you're feeling more comfortable with it.

Attached Files Dołączona grafika Get Plugin or Get Source (tWeaponShootPosition.sp - 1.6 KB) Dołączona grafika tweaponshootposition.inc (162 Bytes) Dołączona grafika tweaponshootposition.tf.txt (164 Bytes)

Wyświetl pełny artykuł




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

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