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

Sourcemod - new native


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 07-01-2015 , 04:16   Sourcemod - new native
Reply With Quote #1

Ciao guys,

I am not sure if this is the right section... I forked SourceMod on GitHub and made a new native
PHP Code:
// Searches for console variables created by given plugin
//
// @param plugin        Plugin Handle (INVALID_HANDLE uses the calling plugin).
// @return                Adt array Handle on success, INVALID_HANDLE otherwise.
// @error                Invalid plugin handle or plugin was not found.
native ArrayList GetPluginConVars(Handle plugin); 
Can you please check if the code is correct and as it should be?
I am not very good with this yet... comparsion

P.S.: I made a little testing plugin and everything seems to work fine.
PHP Code:
#include <sourcemod>

public Plugin:myinfo =
{
    
name "Test-GetPluginConVars",
    
author "Raska",
    
description "Test GetPluginConVars",
    
version "0.1",
    
url ""
}

public 
OnPluginStart()
{
    new 
Handle:hArray GetPluginConVars(FindPluginByFile("SomePlugin.smx"));
    
// new Handle:hArray = GetPluginConVars(INVALID_HANDLE);
    
    
if (hArray == INVALID_HANDLE) {
        
LogMessage("hArray = INVALID_HANDLE");
        return;
    }
    
    new 
String:sCvarName[64];
    
    for (new 
0GetArraySize(hArray); i++) {
        
GetConVarName(GetArrayCell(hArrayi), sCvarNamesizeof(sCvarName));
        
LogMessage("Array[%d] = '%s'"isCvarName);
    }
    
    
CloseHandle(hArray);

KissLick is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-01-2015 , 10:21   Re: Sourcemod - new native
Reply With Quote #2

Generally, if you want the SourceMod staff to review it, you'd create a Pull Request for it.

Having said that, I've only glanced at it, but you might want to call pContext->ThrowNativeError instead of logger->LogError. ThrowNativeError makes the SourceMod error log show a stack trace of the calling plugin.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 07-01-2015 at 10:24.
Powerlord is offline
psychonic

BAFFLED
Join Date: May 2008
Old 07-01-2015 , 10:31   Re: Sourcemod - new native
Reply With Quote #3

What is the intended use case for getting another or own plugin's convars?
psychonic is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 07-01-2015 , 12:56   Re: Sourcemod - new native
Reply With Quote #4

Quote:
Originally Posted by Powerlord View Post
Having said that, I've only glanced at it, but you might want to call pContext->ThrowNativeError instead of logger->LogError. ThrowNativeError makes the SourceMod error log show a stack trace of the calling plugin.
Ok, thanks! :-)

Quote:
Originally Posted by psychonic View Post
What is the intended use case for getting another or own plugin's convars?
So we can easily do something like:
If it's not a part of the core.

And if we would have a way to get our own plugin's convars, why not to be able to get convars of any other plugin?
KissLick is offline
psychonic

BAFFLED
Join Date: May 2008
Old 07-01-2015 , 15:02   Re: Sourcemod - new native
Reply With Quote #5

Quote:
Originally Posted by KissLick View Post
I think that it would be great if something like that were supported, but I also think that it would be better to implement it directly in core, which already has access to the plugins' var and the configs.
psychonic is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 07-01-2015 , 15:06   Re: Sourcemod - new native
Reply With Quote #6

Quote:
Originally Posted by psychonic View Post
I think that it would be great if something like that were supported, but I also think that it would be better to implement it directly in core, which already has access to the plugins' var and the configs.
Should I try to do this as a part of core? Or you (sm team) would start something else like this?
KissLick is offline
psychonic

BAFFLED
Join Date: May 2008
Old 07-01-2015 , 15:53   Re: Sourcemod - new native
Reply With Quote #7

Quote:
Originally Posted by KissLick View Post
Should I try to do this as a part of core? Or you (sm team) would start something else like this?
At the very least, I think that the existing AutoExecConfig should handle the appending of vars that are not already in the file, and possibly automatically add a comment noting any that are in an existing file but no longer in the plugin. I'm not sure if any further options are needed/wanted. I'm curious as to what the rest of the team thinks.
psychonic is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 07-01-2015 , 16:13   Re: Sourcemod - new native
Reply With Quote #8

Quote:
Originally Posted by psychonic View Post
At the very least, I think that the existing AutoExecConfig should handle the appending of vars that are not already in the file, and possibly automatically add a comment noting any that are in an existing file but no longer in the plugin. I'm not sure if any further options are needed/wanted. I'm curious as to what the rest of the team thinks.
I'm definitely up for making AutoExecConfig smarter, but it's gonna need some hard thinking and proposals to build something future-proof that can survive sloppy editing (which is definitely a must when not just creating new files).
__________________

Last edited by asherkin; 07-01-2015 at 16:14.
asherkin is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 07-02-2015 , 06:07   Re: Sourcemod - new native
Reply With Quote #9

So, can I pull request that native? Improving AutoExecConfig gonna take some time...
KissLick is offline
psychonic

BAFFLED
Join Date: May 2008
Old 07-02-2015 , 07:51   Re: Sourcemod - new native
Reply With Quote #10

While it's better than what's there now, I don't think that it makes sense to add something with planned obsolescence.
psychonic 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 18:10.


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