Raised This Month: $81 Target: $400
 20% 

[STOCK] Custom Data Entities


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
SVC
Junior Member
Join Date: Mar 2021
Old 04-03-2023 , 12:23   [STOCK] Custom Data Entities
Reply With Quote #1

Hello again!. This time I come to share this series of functions that I created a while ago for the dynamic handling of data in entities.

_______________________________________

CUSTOM ENTITIES DATA

Q: Do you need to handle a large amount of data associated with entities?.
Q: Tired of always using internal entity data (pev -> iuser1, iuser2, fuser1, vuser1, etc...)? .
Q: Ran out of pevs available to use?.

A: Don't worry, here is the solution. Just use this series of functions/stocks that will make your job much easier. And the best thing is that you can work with a wide variety of data, which will be associated with the entity you want (even players [YES, YOU READ WELL, PLAYERS!]).


WHAT IS THIS UTILITY

Custom Entities Data (CED) is based on the module of the same name published here, which, as its name suggests, allows you to manage an infinite number of data associated with a specific entity.

For example: I have an entity and I want to store the "state" data. So I would do this:
PHP Code:
CED_SetCell(entity"state"entity_state
And to get it I just do:
PHP Code:
new state
CED_GetCell
(entity"state"state)

print(
"the entity state is: %d"state
It can work with:
  • CELLS (they can be integers/floats/logical -> int/float/bool)
  • STRING
  • ARRAY

HOW IS IT USED?

It has 8 main stocks for data management:

● Save/update data:
PHP Code:
CED_SetCell
CED_SetString
CED_SetArray 
● Load data
PHP Code:
CED_GetCell
CED_GetString
CED_GetArray 
● Clears (deletes) all data saved in the entity
PHP Code:
CED_Clear 
● Same as above, but for all entities; frees the memory used to store the data (MANDATORY TO USE [preference every time the server changes maps and/or where needed])
PHP Code:
CED_Free 
WHAT DIFFERENCES IT FROM THE MODULE?

I have never seen the source code of the module, but it is known that since it is a (*theory*) module, it is faster when performing operations (although the times we are living in, your PC will not hang for using this....)

But above all, the named module does not work well, so I found myself in need of making this stock.

CODE

Inside the include there are several examples for handling data. I will also leave some examples
Attached Files
File Type: inc custom_entities_data.inc (15.5 KB, 62 views)

Last edited by SVC; 04-11-2023 at 08:42.
SVC is offline
 


Thread Tools
Display Modes

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 10:54.


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