AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   SMLIB 0.11 BETA (over 300 Function Stocks) | updated 15.07.2011 (https://forums.alliedmods.net/showthread.php?t=148387)

naris 01-31-2011 12:29

Re: SMLIB 0.9.2 BETA (269 Function Stocks) | updated 28.01.2011
 
Quote:

Originally Posted by berni (Post 1402047)
Did you actually test it or do you just think so ?

I just tried it out for you:

Compile time with includes: 1.00 seconds
Compile time without: 1.00 seconds

Did you try modifying and including only 1 of the includes, such as #include <smlib/world> or are you continually including EVERYTHING by using #include <smlib>?

Did you try this using a large system where multiple source files need 1 or 2 functions from 1 or 2 files instead of everything? I do not have time to test this at the moment, especially since this is Month End, but I will get back to you when I do.

Quote:

Originally Posted by berni (Post 1402047)
Also wrong, Functions of <sourcemod> and <sdktools> (fake included in smlib.inc) are used in almost every include file.
Again, they aren't really included for the compiler as it will cancel before in smlib.inc.

So, #include the files required for those functions (<sourcemod> & <sdktools> and whichever <smlib/*> files that might be required, as you almost did in smlibs/clients.inc (instead of the generic <smlib> include), it's not that difficult.

Quote:

Originally Posted by berni (Post 1402047)
SourcePawn just isn't C++, so we have to take what we get.

While it's true that SourcePawn isn't C++, the basic concepts are the same and are still applicable.

FaTony 01-31-2011 12:41

Re: SMLIB 0.9.4 BETA (278 Function Stocks) | updated 31.01.2011
 
The preprocessor include system is almost the same in both languages.

berni 01-31-2011 12:52

Re: SMLIB 0.9.2 BETA (269 Function Stocks) | updated 28.01.2011
 
Quote:

Originally Posted by naris (Post 1403830)
Did you try modifying and including only 1 of the includes, such as #include <smlib/world> or are you continually including EVERYTHING by using #include <smlib>?

You should have read the latest update changes, this doesn't need to be discussed anymore.

Quote:

Originally Posted by berni (Post 1403567)
Redesigned the smlib includes to allow including of single smlib includes and save some milli seconds.

And no, I thought he is talking about just removing #smlib out of every include file, and still use #include <smlib> in the plugin.

naris 01-31-2011 12:59

Re: SMLIB 0.9.4 BETA (278 Function Stocks) | updated 31.01.2011
 
Doh! :oops:

Sorry about that, Indeed I should of read the last update changes

berni 01-31-2011 13:12

Re: SMLIB 0.9.4 BETA (278 Function Stocks) | updated 31.01.2011
 
By the way, the sourcemod compiler automatically includes <sourcemod> (with all its 60 subincludes), even if you don't have it specified in your plugin.
If you want to complain, I would start there :wink:

naris 01-31-2011 16:42

Re: SMLIB 0.9.4 BETA (278 Function Stocks) | updated 31.01.2011
 
This function needs to be fixed:

PHP Code:

/**
 * Returns whether the entity has specific Spawnflags.
 *
 * @param entity            Entity index.
 * @param flags                Flags value.
 * @return                    True if the entity has the spawnflags set, false otherwise.
 */
stock bool:Entity_HasSpawnFlags(entityflags)
{    
    return 
Entity_GetSpawnFlags flags;



naris 01-31-2011 16:48

Re: SMLIB 0.9.4 BETA (278 Function Stocks) | updated 31.01.2011
 
Quote:

Originally Posted by berni (Post 1403869)
By the way, the sourcemod compiler automatically includes <sourcemod> (with all its 60 subincludes), even if you don't have it specified in your plugin.
If you want to complain, I would start there :wink:

Yeah, that's true -- but those are mostly native declarations and not so many stocks.

Also, you usually need to use parts of most of the sourcemod includes in any given plugin while many of the smlib includes are more stand-alone without really needing the others.

naris 01-31-2011 16:58

Re: SMLIB 0.9.4 BETA (278 Function Stocks) | updated 31.01.2011
 
The Entity_Flags look suspect, are EFL_KEEP_ON_RECREATE_ENTITIES and EFL_HAS_PLAYER_CHILD both supposed to be bit 4?

PHP Code:

enum Entity_Flags
{
    
EFL_KILLME =                            (1<<0),    // This entity is marked for death -- This allows the game to actually delete ents at a safe time
    
EFL_DORMANT    =                            (1<<1),    // Entity is dormant, no updates to client
    
EFL_NOCLIP_ACTIVE =                        (1<<2),    // Lets us know when the noclip command is active.
    
EFL_SETTING_UP_BONES =                    (1<<3),    // Set while a model is setting up its bones.
    
EFL_KEEP_ON_RECREATE_ENTITIES =         (1<<4), // This is a special entity that should not be deleted when we restart entities only

    
EFL_HAS_PLAYER_CHILD=                    (1<<4),    // One of the child entities is a player.

    
EFL_DIRTY_SHADOWUPDATE =                (1<<5),    // Client only- need shadow manager to update the shadow... 


Also, you might want to define it as

PHP Code:

enum Entity_Flags (<<= 1)
{


instead of specifying the value for each bit.

berni 01-31-2011 20:34

Re: SMLIB 0.9.4 BETA (278 Function Stocks) | updated 31.01.2011
 
Quote:

Originally Posted by naris (Post 1404064)
This function needs to be fixed:

PHP Code:

stock bool:Entity_HasSpawnFlags(entityflags


http://users.alliedmods.net/%7Esawce/crab.gif

Quote:

Originally Posted by naris (Post 1404072)
Also, you usually need to use parts of most of the sourcemod includes in any given plugin while many of the smlib includes are more stand-alone without really needing the others.

Like you say, only parts, I use ~20% of all sm includes in plugins.

Quote:

Originally Posted by naris (Post 1404082)
The Entity_Flags look suspect, are EFL_KEEP_ON_RECREATE_ENTITIES and EFL_HAS_PLAYER_CHILD both supposed to be bit 4?

Also, you might want to define it as

PHP Code:

enum Entity_Flags (<<= 1)
{


instead of specifying the value for each bit.

It looks suspect to me too, I also wondered back then, but we copied it straight from Valve's hl2sdk and it's used there widely,
so I'm quite sure it's correct :wink:
I think it's ok like it is now.

zeroibis 02-01-2011 23:56

Re: SMLIB 0.9.4 BETA (278 Function Stocks) | updated 31.01.2011
 
I just wanted to note that using:
stock Client_GiveWeapon(client, const String:className[], bool:switchTo=true);

will override any restrictions that other mods may have on the weapon.

For example you can use this command to give a zombie weapons in a ZR server. I do not know if this was intended or not. Note however that the normal GivePlayerItem command does not allow zombies to get weapons.


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

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