Raised This Month: $ Target: $400
 0% 

SDK Hooks 2.1 - Updated 2011-9-10


Post New Thread Closed Thread   
 
Thread Tools Display Modes
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 10-25-2009 , 16:21   Re: [EXTENSION] SDK Hooks
#31

It seems there is a limit on how big a string can be you can pass to a forward, on some maps with many entities, OnLevelInit is not getting called because mapEntities is too big.
__________________
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
Kigen
BANNED
Join Date: Feb 2008
Old 10-26-2009 , 03:17   Re: [EXTENSION] SDK Hooks
#32

There is a crash related to if a plugin is reloaded while it has a active hook.

So I guess cleaning up is needed.
Kigen is offline
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 10-26-2009 , 05:03   Re: [EXTENSION] SDK Hooks
#33

Quote:
Originally Posted by berni View Post
It seems there is a limit on how big a string can be you can pass to a forward, on some maps with many entities, OnLevelInit is not getting called because mapEntities is too big.
AFAIK the maximum string size in Pawn is 10000 bytes. Sometimes (don't know why) it allows you to create 20000 bytes strings. Anyway, I think OnLevelInit should use an array of strings for this. That should avoid the problem.
Quote:
There is a crash related to if a plugin is reloaded while it has a active hook.
So I guess cleaning up is needed.
I've ran into the same problem.
__________________
For admins: My plugins

For developers: Colors library
exvel is offline
Send a message via ICQ to exvel
Kigen
BANNED
Join Date: Feb 2008
Old 10-26-2009 , 07:05   Re: [EXTENSION] SDK Hooks
#34

My guess is a race condition crash.

Basically the extension is racing against SourceMod in this.

I've added proper clean up code but it still results in a crash.
Attached Files
File Type: mdmp Steam__570557__2009_10_26T10_36_56C812901.mdmp (63.6 KB, 248 views)
Kigen is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 10-26-2009 , 15:53   Re: [EXTENSION] SDK Hooks
#35

Quote:
Originally Posted by exvel View Post
AFAIK the maximum string size in Pawn is 10000 bytes. Sometimes (don't know why) it allows you to create 20000 bytes strings. Anyway, I think OnLevelInit should use an array of strings for this. That should avoid the problem.
Well the parameter is useless anyway, I see no need for it, as it's just the raw mapname.ent file as string with all entity classes and their properties, but I can't think of something it could be used for. So it basically does the same as the forward OnMapStart().
__________________
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
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 10-26-2009 , 17:21   Re: [EXTENSION] SDK Hooks
#36

Just because you see no need for it, doesn't mean it's useless It is a little bit bugged at the moment, but I'll fix it when I have time. And as long as you use #pragma dynamic the string length is fine, I'm using the forward successfully so.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
eXDee
Member
Join Date: May 2009
Old 10-27-2009 , 00:44   Re: [EXTENSION] SDK Hooks
#37

I'm quite new to SM scripting, and im trying to port this plugin over to SDKHooks since dukehacks doesn't work anymore.

http://forums.alliedmods.net/showthread.php?p=746250

However i have no idea what im doing, its probably a few replacements here and there but i can't get it to work.

Heres the sourcecode of it which uses dukehacks:
Code:
/*

    Version history
    ---------------
    1.0        - Initial release

*/

#include <sourcemod>
#include <sdktools>
#include <dukehacks>

#define PLUGIN_NAME                    "i3D-NoBlock"
#define PLUGIN_AUTHOR                "Tony G."
#define PLUGIN_DESCRIPTION            "Manipulates players and grenades so they can't block each other"
#define PLUGIN_VERSION                "1.0"
#define PLUGIN_URL                    "http://www.i3d.net/"

new g_CollisionOffset;

public Plugin:myinfo = {name = PLUGIN_NAME, author = PLUGIN_AUTHOR, description = PLUGIN_DESCRIPTION, version = PLUGIN_VERSION, url = PLUGIN_URL};

public OnPluginStart()
{

    g_CollisionOffset = FindSendPropInfo("CBaseEntity", "m_CollisionGroup");
    
    HookEvent("player_spawn", Event_OnPlayerSpawn, EventHookMode_Post);
    
}

public Action:Event_OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{

    new user_id = GetEventInt(event, "userid");
    new client = GetClientOfUserId(user_id);
    
    SetEntData(client, g_CollisionOffset, 2, 1, true);

}

public ResultType:dhOnEntityCreated(edict)
{
    
    new String:classname[21];
    GetEdictClassname(edict, classname, sizeof(classname)); 

    if (StrEqual(classname, "hegrenade_projectile"))
    {
        SetEntData(edict, g_CollisionOffset, 2, 1, true);
    }
    
}
I tried changing dhOnEntityCreated to simply OnEntityCreated, which won't compile OnEntitySpawned will, but it does nothing.

As i said, i have no idea what im doing heh.
eXDee is offline
Someone78
Junior Member
Join Date: Mar 2009
Location: Russia
Old 10-27-2009 , 03:51   Re: [EXTENSION] SDK Hooks
#38

eXDee,
Code:
/*

    Version history
    ---------------
    1.0        - Initial release

*/

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

#define PLUGIN_NAME                    "i3D-NoBlock"
#define PLUGIN_AUTHOR                "Tony G."
#define PLUGIN_DESCRIPTION            "Manipulates players and grenades so they can't block each other"
#define PLUGIN_VERSION                "1.0"
#define PLUGIN_URL                    "http://www.i3d.net/"

new g_CollisionOffset;

public Plugin:myinfo = {name = PLUGIN_NAME, author = PLUGIN_AUTHOR, description = PLUGIN_DESCRIPTION, version = PLUGIN_VERSION, url = PLUGIN_URL};

public OnPluginStart()
{

    g_CollisionOffset = FindSendPropInfo("CBaseEntity", "m_CollisionGroup");
    
    HookEvent("player_spawn", Event_OnPlayerSpawn, EventHookMode_Post);
    
}

public Action:Event_OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{

    new user_id = GetEventInt(event, "userid");
    new client = GetClientOfUserId(user_id);
    
    SetEntData(client, g_CollisionOffset, 2, 1, true);

}

public OnEntityCreated(entity, const String:classname[])
{
    if (StrEqual(classname, "hegrenade_projectile"))
    {
        SetEntData(entity, g_CollisionOffset, 2, 1, true);
    }
}
Someone78 is offline
daleGEND
AlliedModders Donor
Join Date: Feb 2005
Location: USA
Old 10-27-2009 , 07:25   Re: [EXTENSION] SDK Hooks
#39

Maybe I am doing something wrong, but a plugin that requires this that I want to use is not working because of an error this extension generates for my linux servers:

Quote:
L 10/27/2009 - 06:22:06: [SM] Unable to load extension "sdkhooks.ext": /**path to install**/cstrike/addons/sourcemod/extensions/sdkhooks.ext.so: undefined symbol: _Z11Native_HookPN10SourcePawn14IPluginContext EPKi
__________________
Bor3d Gaming - A Mature Online Gaming Community

Feel free to add me on STEAM as well: https://steamcommunity.com/id/b0r3d
daleGEND is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 10-27-2009 , 08:03   Re: [EXTENSION] SDK Hooks
#40

Reading the previous page is hard.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
Closed Thread



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 10:33.


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