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

[EXTENSION] Socket (3.0.1)


Post New Thread Reply   
 
Thread Tools Display Modes
sfPlayer
Senior Member
Join Date: Dec 2007
Location: Germany
Old 08-11-2009 , 04:21   Re: [EXTENSION] Socket (2.4.0beta+2.1)
Reply With Quote #151

that's just a debug message, will be removed in the final version
sfPlayer is offline
Timiditas
Senior Member
Join Date: Apr 2009
Old 08-24-2009 , 19:33   Re: [EXTENSION] Socket (2.4.0beta+2.1)
Reply With Quote #152

How do you detect if socket.ext is running?
Marking it optional works fine, but detection fails. What is the correct library name to search for?
I tried
socket.ext
Socket
socket
Sockets
sockets
PHP Code:
#include <sourcemod>
#undef REQUIRE_EXTENSIONS
#include <socket>
new bool:socket_available false;

public 
bool:AskPluginLoad(Handle:myselfbool:lateString:error[], err_max)
{
    
MarkNativeAsOptional("SocketSend");
    return 
true;
}
 
public 
OnPluginStart()
{
    
socket_available LibraryExists("socket.ext");
}
 
public 
OnLibraryRemoved(const String:name[])
{
    if (
StrEqual(name"socket.ext"))
        
socket_available false;
}
 
public 
OnLibraryAdded(const String:name[])
{
    if (
StrEqual(name"socket.ext"))
        
socket_available true;
}

public 
OnMapStart()
{
    if(!
socket_available)
        
LogError ("Couldn't find sockets extension!");
    else
        
LogError ("Sockets extension found!");

__________________

Timiditas is offline
sfPlayer
Senior Member
Join Date: Dec 2007
Location: Germany
Old 08-24-2009 , 19:39   Re: [EXTENSION] Socket (2.4.0beta+2.1)
Reply With Quote #153

try socket or Socket
sfPlayer is offline
Timiditas
Senior Member
Join Date: Apr 2009
Old 08-24-2009 , 19:44   Re: [EXTENSION] Socket (2.4.0beta+2.1)
Reply With Quote #154

Solved.
Replaced
socket_available = LibraryExists("socket.ext");

by

socket_available = (GetExtensionFileStatus("socket.ext") == 1);

__________________

Timiditas is offline
Timiditas
Senior Member
Join Date: Apr 2009
Old 08-27-2009 , 02:50   Re: [EXTENSION] Socket (2.4.0beta+2.1)
Reply With Quote #155

Plugin is working as expected, if socket extension is not found.
However I still get this error in the log:
PHP Code:
[SMUnable to load extension "socket.ext.dll"
Is there a way to suppress that, or did I do something wrong?
Pls see attached sample code.
Attached Files
File Type: sp Get Plugin or Get Source (sockets_example.sp - 259 views - 2.5 KB)
__________________

Timiditas is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 08-27-2009 , 13:39   Re: [EXTENSION] Socket (2.4.0beta+2.1)
Reply With Quote #156

I think that's unavoidable because the include file tries to load the extension.
bl4nk is offline
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 08-27-2009 , 14:25   Re: [EXTENSION] Socket (2.4.0beta+2.1)
Reply With Quote #157

Quote:
Originally Posted by Timiditas View Post
Plugin is working as expected, if socket extension is not found.
However I still get this error in the log:
PHP Code:
[SMUnable to load extension "socket.ext.dll"
Is there a way to suppress that, or did I do something wrong?
Pls see attached sample code.
Add this into the code:
PHP Code:
#undef REQUIRE_EXTENSIONS
#undef AUTOLOAD_EXTENSIONS 
__________________
For admins: My plugins

For developers: Colors library
exvel is offline
Send a message via ICQ to exvel
Timiditas
Senior Member
Join Date: Apr 2009
Old 08-27-2009 , 17:33   Re: [EXTENSION] Socket (2.4.0beta+2.1)
Reply With Quote #158

Quote:
Originally Posted by exvel View Post
Add this into the code:
PHP Code:
#undef REQUIRE_EXTENSIONS
#undef AUTOLOAD_EXTENSIONS 
I already have undef'd REQUIRE_EXTENSIONS.

Adding #undef AUTOLOAD_EXTENSIONS supresses the error in the logfile, however it also prevents the extension to be loaded if the file DOES exist and you cannot load it manually.
__________________

Timiditas is offline
Kigen
BANNED
Join Date: Feb 2008
Old 08-27-2009 , 20:49   Re: [EXTENSION] Socket (2.4.0beta+2.1)
Reply With Quote #159

Quote:
szAppName : srcds.exe szAppVer : 0.0.0.0 szModName : socket.ext.dll
szModVer : 0.0.0.0 offset : 000054c4
Mmm, fun.

That is a crash by the way....
Kigen is offline
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 08-28-2009 , 01:22   Re: [EXTENSION] Socket (2.4.0beta+2.1)
Reply With Quote #160

Quote:
Originally Posted by Timiditas View Post
I already have undef'd REQUIRE_EXTENSIONS.

Adding #undef AUTOLOAD_EXTENSIONS supresses the error in the logfile, however it also prevents the extension to be loaded if the file DOES exist and you cannot load it manually.
Well, it worked for me in Save Scores.
__________________
For admins: My plugins

For developers: Colors library
exvel is offline
Send a message via ICQ to exvel
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 20:03.


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