Raised This Month: $51 Target: $400
 12% 

Module: Custom Entity Data


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 02-22-2017 , 00:03   Module: Custom Entity Data
Reply With Quote #1

Description:

This module lets you bind custom user data to entities without dealing with fields like pev_iuser[1-4] or similar. The reason this module is created is that this way you are not limited by the amount of pev_* fields and plugins or the game dll won't interfere with each other (modifying the same pev_* fields).


API:

The API is pretty similar to the Trie API - you can retrieve or set cells, arrays and strings, which are identified by a string key.
When an entity is destroyed, all data bound to it gets destroyed too - that means that you have to free any handles (like Trie, Array, Stack or others) bound to that entity or they will get lost/leaked.

customentdata.inc



Install instructions:

Put customentdata_amxx.dll (Windows) or customentdata_amxx_i386.so (Linux) into $moddir/addons/amxmodx/modules.


Todo:
  • Create an "OnEntityDestroyed" hook or similar to let the user easily free any bound handles.


Downloads:

Source code on GitHub

Last edited by klippy; 02-23-2017 at 19:13. Reason: 1.0.1
klippy is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:21.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode