Skocz do zawartości

  • Zaloguj korzystając z Facebooka Zaloguj korzystając z Twittera Zaloguj przez Steam Zaloguj poprzez Google      Logowanie »   
  • Rejestracja

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

[TF2] TF2Attributes (v1.0.0, 03/08/2013)


  • 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:7173
  • Lokalizacja:AMXX.PL
Offline

Napisano 08.03.2013 10:08

The description line up there should be pretty self-explanatory.This basically offers a bunch of natives for setting, getting, and modifying attributes on any entity that has m_AttributeList (GetEntSendPropOffs(entity, "m_AttributeList") > 0).Available natives are all listed in the .inc file, so definitely go read that! It's redundant to copy all of them here, but just know that you're probably looking for: Code: Address:TF2Attrib_SetByName(iEntity, String:strAttrib[], Float:flValue)Address:TF2Attrib_GetByName(iEntity, String:strAttrib[])bool:TF2Attrib_RemoveByName(iEntity, String:strAttrib[])bool:TF2Attrib_RemoveAll(iEntity)The other natives exist to modify the attributes whose addresses are returned by the first two functions.There's also a stock TF2Attrib_IsIntegerValue(iDefIndex), which takes in an attribute definition index (as returned by TF2Attrib_GetDefIndex(Address:pAttrib)), and returns true if the attribute is stored as an integer rather than as a float (items_game's definitions of this aren't accurate, so I hardcoded the stock for the attributes that I found were stored as ints, such as "kill eater").Any attribute index that returns true for TF2Attrib_IsIntegerValue should be used with a Float: tag rather than float() for TF2Attrib_SetByName, TF2Attrib_SetValue, and TF2Attrib_SetInitialValue, as in the following code block, if you want the number to match up to what appears/happens in game. Code: new value = 20;new Address:pAttrib = TF2Attrib_SetByName(entity, "kill eater", Float:value); //sets strange kill count to 20, DO NOT USE 20.0value = 30;TF2Attrib_SetValue(pAttrib, Float:value); //sets strange kill count to 30new result = _:TF2Attrib_GetValue(pAttrib);PrintToChatAll("%d", result); //prints "30" to chatOne last note, attributes get wiped if the weapon/wearable entity gets removed, but attributes added to players will not get reset, and you will have to remove them on your own. However, set bonuses that you remove will get reapplied when the player regenerates.Installation (YOU WILL NEED AN SM 1.5 SNAPSHOT SINCE THIS MAKES USE OF GetEntityAddress AND LoadFromAddress AND StoreToAddress):1) Place tf2attributes.smx in the server's sourcemod plugins folder (normally "addons/sourcemod/plugins/").2) Place tf2.attributes.txt in the server's sourcemod gamedata folder (normally "addons/sourcemod/gamedata/").3) Write or install a plugin that uses these natives. If writing the plugin, you will need to #include , which means you will need to place tf2attributes.inc in the "include" folder of wherever you develop/compile SourceMod plugins.tf2attributes_example.sp is an example plugin that offers several root-level admin commands to test out the various natives. You can ignore it if you want to.Cvars:tf2attributes_version - do not touch.This registers a plugin library (via RegPluginLibrary) named "tf2attributes". Changelog: Code: 03/08/2013 - v1.0.0*Initial releasePlanned Features:TF2Attrib_GetByDefIndex(iEntity, iDefIndex), to get an attribute off an item by its defindex rather than by its name. It's nearly done, will be in the next update, I just wanted to push this first.Known Bugs:I would not recommend using TF2Attrib_SetDefIndex() at all. It doesn't behave as you'd expect it to, and while it does set the definition index of a given attribute, the game still treats it as the original attribute, though when it goes to look up the attribute by name it uses the 'new name' (as if it were actually the new attribute index). This messes up calls to GetByName and SetByName, so just... don't do it.... Did I forget anything? Attached Files Dołączona grafika Get Plugin or Get Source (tf2attributes.sp - 10.4 KB) Dołączona grafika tf2attributes.inc (6.2 KB) Dołączona grafika tf2.attributes.txt (2.2 KB) Dołączona grafika Get Plugin or Get Source (tf2attributes_example.sp - 11.0 KB) Dołączona grafika tf2attributes.smx (5.8 KB)

Wyświetl pełny artykuł




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

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