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)

berni 03-03-2011 09:24

Re: SMLIB 0.10.0 BETA (over 300 Function Stocks) | updated 26.02.2011
 
Quote:

Originally Posted by KawMAN (Post 1427000)
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;" ?

It's not meant to iterate over all entities, the team entities are all sitting after MaxClients+1.

I can add Team_FindByName() for completion, but you can use FindTeamByName like asherkin said.

berni 03-06-2011 18:20

Re: SMLIB 0.10.1 BETA (over 300 Function Stocks) | updated 07.03.2011
 
New smlib update available: smlib 0.10.1 beta
Compatibility breaks: yes

I added a useful documentation on how to use smlib's color API: Click Me!

Changes:

Quote:

  • Added file concommands.inc
  • Added ConCommand Functions ConCommand_HasFlags(), ConCommand_AddFlags(),
    ConCommand_RemoveFlags() (Thanks to Fatony)
  • Added support for DoD:S nickname coloring to Client_PrintToChatRaw()
  • Added Parameter isChat to all Client_PrintToChat() functions
  • Fixed a bug in color parsing code
  • Enhanced color code and gamedata support
  • Added gamedata/smlib_colors.games.txt (color overriding)

Download here.

berni 03-06-2011 19:56

Re: SMLIB 0.10.1 BETA (over 300 Function Stocks) | updated 07.03.2011
 
New smlib update available: smlib 0.10.2 beta
Compatibility breaks: no

Changes:
Quote:

  • Fixed L4D2/TF2 color settings (reported in IRC)


Download here.

GoD-Tony 03-08-2011 03:54

Re: SMLIB 0.10.1 BETA (over 300 Function Stocks) | updated 07.03.2011
 
I would like to see this stock in SMLIB. It's from the Zombie:Reloaded plugin (all credit to them), and I use it regularly to check if a player is in a particular group.

PHP Code:

/**
 * Returns whether a player is in a spesific group or not.
 *
 * @param client        The client index.
 * @param groupName     SourceMod group name to check.
 * @return              True if in the group, false otherwise.
 */
stock bool:Client_IsInGroup(client, const String:groupName[])
{
    new 
AdminId:id GetUserAdmin(client);
    
    
// Validate id.
    
if (id == INVALID_ADMIN_ID)
    {
        return 
false;
    }
    
    
// Get number of groups.
    
new groupnum GetAdminGroupCount(id);
    
decl String:groupname[64];
    
    
// Validate number of groups.
    
if (groupnum 0)
    {
        
// Loop through each group.
        
for (new group 0group groupnumgroup++)
        {
            
// Get group name.
            
GetAdminGroup(idgroupgroupnamesizeof(groupname));
            
            
// Compare names.
            
if (StrEqual(groupNamegroupnamefalse))
            {
                return 
true;
            }
        }
    }
    
    
// No groups or no match.
    
return false;



berni 03-08-2011 04:30

Re: SMLIB 0.10.1 BETA (over 300 Function Stocks) | updated 07.03.2011
 
Sure, I'm gonna add this one :)

Steell 03-09-2011 12:35

Re: SMLIB 0.10.1 BETA (over 300 Function Stocks) | updated 07.03.2011
 
For some reason this code won't compile, even on your online compiler: http://p.hlxce.com/291

It keeps saying it can't find Client_HasWeapon, even though it is listed in smlib/clients.inc.

EDIT: Also, Client_HasWeapon should return a bool (you forgot the tag).

GoD-Tony 03-09-2011 14:33

Re: SMLIB 0.10.1 BETA (over 300 Function Stocks) | updated 07.03.2011
 
Quote:

Originally Posted by Steell (Post 1430366)
For some reason this code won't compile, even on your online compiler: http://p.hlxce.com/291

Compiles fine for me (smlib 0.10.1). Make sure your include file is in scripting/include/smlib/clients.inc.

Steell 03-09-2011 14:46

Re: SMLIB 0.10.1 BETA (over 300 Function Stocks) | updated 07.03.2011
 
Yep the include files are in the correct place. The weird thing is that it's also not compiling on the "web IDE" that berni posted in the OP.

Chanz 03-09-2011 15:19

Re: SMLIB 0.10.1 BETA (over 300 Function Stocks) | updated 07.03.2011
 
Seems like anywhere is a { or } missing/double.
Sorry can't locate it atm, but it seems its in the clients.inc since #include <smlib/clients> brings up the same error.

berni 03-09-2011 17:17

Re: SMLIB 0.10.1 BETA (over 300 Function Stocks) | updated 07.03.2011
 
Quote:

Originally Posted by Steell (Post 1430366)
For some reason this code won't compile, even on your online compiler: http://p.hlxce.com/291

It keeps saying it can't find Client_HasWeapon, even though it is listed in smlib/clients.inc.

EDIT: Also, Client_HasWeapon should return a bool (you forgot the tag).

That's pretty weird, it seems to work fine in th windows compiler, but on linux it just fails and I can't figure out why. Are you using the linux compiler ?

Edit: I don't know why, but somehow the linux compiler doesn't seem to like include directorys, it includes the sm clients.inc, instead of the smlib one.

Edit2: Changing <smlib/clients> to <smlib/clients.inc> seems to help, I'm gonna change all includes in the next smlib release.


All times are GMT -4. The time now is 11:38.

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