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

SMLIB 0.11 BETA (over 300 Function Stocks) | updated 15.07.2011


Post New Thread Reply   
 
Thread Tools Display Modes
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 02-26-2011 , 04:27   Re: SMLIB 0.9.7 BETA (295 Function Stocks) | updated 08.02.2011
Reply With Quote #91

Quote:
Originally Posted by psychonic View Post
Creating the handle to the convar isn't the slow part; finding the var is.

SM calls FindVar to first make sure the convar exists before looking to see if it already has a handle to it. FindVar iterates through all cvars and commands, doing string compares.

This is why it is slow even if SM already has a handle to it, and thus, why you should still cache the handle.
Do we need to FindConVar every map change? or will once suffice (storing it for the plugins lifetime)?
KyleS is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 02-26-2011 , 04:44   Re: SMLIB 0.9.7 BETA (295 Function Stocks) | updated 08.02.2011
Reply With Quote #92

Quote:
Originally Posted by Kyle12 View Post
Do we need to FindConVar every map change? or will once suffice (storing it for the plugins lifetime)?
one time is enough, it's not something that changes on mapchange.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 02-26-2011 , 11:13   Re: SMLIB 0.10.0 BETA (over 300 Function Stocks) | updated 26.02.2011
Reply With Quote #93

New smlib update available: smlib 0.10.0 beta
Compatibility breaks: yes

This is a very big release with a powerful chat color parser, allows you to
print colored text message to the chat, it basically works like exvel
' colors.inc, but it is more flexible, faster and supports more colors.
Those are the color tags you can use in eg. Client_PrintToChat() (see colors.inc in the meanwhile):


{N}, {O}, {R}, {RB}, {B}, {BR}, {T}, {L}, {GRA}, {G}, {OG}, {BLA}


More Info on Colors:
Click Me!

Changes:

Quote:
  • Renamed Function Client_SetMaxSpeed() to Entity_SetMaxSpeed()
  • Added Function Client_SetMaxSpeed()
  • Changed Client_GetActiveWeaponName() returns now the weapons entity index.
  • Fixed Weapon_SetPrimaryAmmoCount() setting the wrong property.
  • Fixed Weapon_GetPrimaryAmmoCount() getting the wrong property.
  • Added Function Convar_IsValidName(), suggested by FaTony
  • Added File colors.inc
  • Added Function Color_ChatSetSubject()
  • Added Function Color_ChatClearSubject()
  • Added Function Color_ParseChatText()
  • Added Function Color_TagToCode()
  • Added Function Color_GetChatColorInfo()
  • Added Function Color_StripFromChatText()
  • Added Function Client_PrintToChatRaw()
  • Added Function Client_PrintToChat()
  • Added Function Client_PrintToChatAll()
  • Added Function Client_HasAdminFlags()
  • Added Function Math_UnitsToMeters()
  • Added Function Math_UnitsToFeet()
  • Added Function Team_GetAnyClient()
  • Removed Function String_StripChatColors()
  • Enhanced function Team_GetEdict() (added caching)
  • Added wildcard extension suppport to File_AddToDownloadsTable()
  • Fixed some comments
  • Added check to Convar_IsValidName() if name is empty (suggested by FaTony)
  • Added File crypt.inc
  • Added Function Crypt_Base64Encode()
  • Added Function Crypt_Base64Decode()
  • Added Function Crypt_Base64MimeToUrl()
  • Added Function Crypt_Base64UrlToMime()
  • Added Function Crypt_MD5()
  • Added Function Crypt_RC4Encode()
  • Added Function Crypt_RC4EncodeBinary()
  • Added missing Comments to some functions.
  • Added ConVar Handle Caching to all functions (FindConVar is freaking expensive).
  • Updated smlib_test.sp
  • Added Function LongToIP()
  • Added Function IPToLong()
  • Added Function IsIPLocal()
  • math.inc: Fixed Functions Math_UnitsToMeters() and Math_UnitsToMeters()
  • Renamed Function Server_GetIP() to Server_GetIPString()
  • Added Function Server_GetIP (greatly enhanced the IP getting, added parameter public=true, uses the Steamtools function Steam_GetPublicIP() if available)
  • Added MAX_TEAM_NAME_LENGTH in teams.inc
Download here.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0

Last edited by berni; 03-06-2011 at 18:16.
berni is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 02-26-2011 , 11:25   Re: SMLIB 0.10.0 BETA (over 300 Function Stocks) | updated 26.02.2011
Reply With Quote #94

Quote:
Added Function Crypt_MD5()
hurray!

also
Quote:
Renamed Function Server_GetIP() to Server_GetIP()
I don't get it o.o
Leonardo is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 02-26-2011 , 17:35   Re: SMLIB 0.9.7 BETA (295 Function Stocks) | updated 08.02.2011
Reply With Quote #95

Quote:
Originally Posted by psychonic View Post
SM calls FindVar to first make sure the convar exists before looking to see if it already has a handle to it.
You're right. I only quickly looked over it before and thought that I saw the cache lookup before the FindVar call. My memory isn't what it use to be.
bl4nk is offline
Chanz
Veteran Member
Join Date: Aug 2008
Location: Germany - Stuttgart
Old 02-27-2011 , 06:08   Re: SMLIB 0.10.0 BETA (over 300 Function Stocks) | updated 26.02.2011
Reply With Quote #96

Full >90% credit goes to Berni I had have nothing little to do with it. Good job man!
__________________
[ SourceModPlugins.org ][ My Plugins ]

Thank you for donations: [ Paypal ]

Video Tutorial (German): [ Gameserver & SourceMod Plugins mit HLSW verwalten ]

Last edited by Chanz; 02-28-2011 at 03:25.
Chanz is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 02-27-2011 , 12:18   Re: SMLIB 0.10.0 BETA (over 300 Function Stocks) | updated 26.02.2011
Reply With Quote #97

Quote:
Originally Posted by Chanz View Post
Corrected:


Also full credit goes to Berni I had have nothing to do with it. Good job man!
You actually did 4 things of the change list

and yeh, I was in a hurry yesterday, change list should be fine now
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 02-28-2011 , 14:28   Re: SMLIB 0.10.0 BETA (over 300 Function Stocks) | updated 26.02.2011
Reply With Quote #98

3 more stocks:
PHP Code:
/**
 * Checks if a ConCommand has one or more flags set.
 *
 * @param    command        ConCommand name.
 * @param    flags        Flags to check.
 * @return                True if flags are set, false otherwise.
 */
stock bool:ConCommand_HasFlags(const String:command[], const flags)
{
    return 
bool:(GetCommandFlags(command) & flags);
}

/**
 * Adds one or more flags to a ConCommand.
 *
 * @param    command        ConCommand name.
 * @param    flags        Flags to add.
 * @noreturn
 */
stock ConCommand_AddFlags(const String:command[], const flags)
{
    new 
newFlags GetarFlags(command);
    
newFlags |= flags;
    
SetCommandFlags(commandnewFlags);
}

/**
 * Removes one ore more flags from a ConCommand.
 *
 * @param    command        ConCommand name.
 * @param    flags        Flags to remove
 * @noreturn
 */
stock ConCommand_RemoveFlags(const String:command[], const flags)
{
    new 
newFlags GetCommandFlags(command);
    
newFlags &= ~flags;
    
SetCommandFlags(commandnewFlags);

__________________
FaTony is offline
KawMAN
SourceMod Donor
Join Date: Sep 2007
Location: Cracov
Old 03-03-2011 , 05:28   Re: SMLIB 0.10.0 BETA (over 300 Function Stocks) | updated 26.02.2011
Reply With Quote #99

Hi,

Please add something like Team_FindByName that return team index of team with specific name or -1 when can't find.

Also in teams.inc function Team_GetEdict(index)
PHP Code:
        if (!Entity_ClassNameMatches(entity"team_manager"true)) {
            return -
1;
        } 
instead "return -1;" should't be "continue;" ?
__________________

Last edited by KawMAN; 03-03-2011 at 05:41.
KawMAN is offline
Send a message via ICQ to KawMAN Send a message via Skype™ to KawMAN
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 03-03-2011 , 08:59   Re: SMLIB 0.10.0 BETA (over 300 Function Stocks) | updated 26.02.2011
Reply With Quote #100

Quote:
Originally Posted by KawMAN View Post
Please add something like Team_FindByName that return team index of team with specific name or -1 when can't find.
LOL, at least try searching.

http://docs.sourcemod.net/api/index....d=show&id=501&
__________________
asherkin 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 02:35.


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