Raised This Month: $ Target: $400
 0% 

Set max entities as size of the array


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kryzu
Senior Member
Join Date: Feb 2009
Old 06-02-2010 , 11:36   Set max entities as size of the array
Reply With Quote #1

What method would be the best for that?:

I want to set the size of the global array.

PHP Code:
New Name[MAXENTS+1
__________________
Kryzu is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-02-2010 , 11:53   Re: Set max entities as size of the array
Reply With Quote #2

sizeof Name
__________________
Arkshine is offline
Kryzu
Senior Member
Join Date: Feb 2009
Old 06-02-2010 , 12:01   Re: Set max entities as size of the array
Reply With Quote #3

Ok. Seems my english sucks...

I want to get how many func_door there are on the map and then set it as the size of Name.
__________________
Kryzu is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-02-2010 , 12:07   Re: Set max entities as size of the array
Reply With Quote #4

Don't understand the last part of your sentence.
__________________
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-02-2010 , 12:11   Re: Set max entities as size of the array
Reply With Quote #5

by default, max entity is 900 + (maxplayers * 15)

So it's 1380

But if some launch option are set, it can be more.

Put 2048 if you have a doubt.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Kryzu
Senior Member
Join Date: Feb 2009
Old 06-02-2010 , 14:42   Re: Set max entities as size of the array
Reply With Quote #6

Quote:
Originally Posted by Arkshine View Post
Don't understand the last part of your sentence.
I want to count how much func_breakables there are on the map and then set this value to size of array.

PHP Code:
new MyArray[ENTITIESONMAP+1]; 
__________________
Kryzu is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-02-2010 , 14:06   Re: Set max entities as size of the array
Reply With Quote #7

900 + 15 * ( maxplayers - 1 )
__________________
Arkshine is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 06-02-2010 , 15:39   Re: Set max entities as size of the array
Reply With Quote #8

Something like this?

Code:
#include <amxmodx> #include <fakemeta> #define PLUGIN  "func_breakable count" #define AUTHOR  "Alucard" #define VERSION "1.0" #define MAX_ENTS 1380 new gMaxEntities, gTotal; new array[MAX_ENTS]; new const Entity[] = "func_breakable"; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR);     gMaxEntities = global_get(glb_maxEntities);         static szClass[32];     for(new i = 1; i < g_MaxEntities; ++i)     {         if(!pev_valid(i) ) continue;                 pev(i, pev_classname, szClass, 31);                 if(!equal(szClass, Entity) ) continue;                 gTotal++;     } }

and then, you have array[gTotal] or if you use a loop:

Code:
for(new i = 0; i < gTotal; i++) {     something = array[i]; }

Another method is using dynamic arrays.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 06-02-2010 , 15:41   Re: Set max entities as size of the array
Reply With Quote #9

I had this same question a while ago. Check my threads that I've made; it should be somewhere toward the middle. There is pretty much always another way to get things done when you're coding, though. Let me know what you need this array for.

EDIT: It's titled something about linking an entity to a bool.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Kryzu
Senior Member
Join Date: Feb 2009
Old 06-03-2010 , 01:38   Re: Set max entities as size of the array
Reply With Quote #10

Million hugs, Alucard!

@wrecked_

In fact i didn't need the func_brekable counting stuff. I just wanted to see, how it works.
What i needed was getting how much ents are there on the map(ty Alucard, again), so i can set it as the size of the arrays in what i save a data about ents, for example ent classname orsmth.
__________________
Kryzu is offline
Reply



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 05:17.


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