Access SourceMod core?
I'm really new to SourceMod extensions, but I'm well versed with c++. How would I access the g_Players global from an extension? For example:
PHP Code:
Also, I know about forwarding to plugins, but is it possible the other way around? Can we use natives created by plugins in extensions? Thanks :mrgreen: |
Re: Access SourceMod core?
Look in smsdk_config.h and uncomment
Code:
#define SMEXT_ENABLE_PLAYERHELPERS This is the public version of g_Players / CPlayer. Quote:
|
Re: Access SourceMod core?
Thanks. Makes sense now. Short and simple :)
Is there an easy way to hook client connect, disconnect, map start, player move, etc? I'm making an extension where certain information is added to a stack every time these actions take place. I would do that in a plugin, but I need an external library to do calculations, and the library isn't opensource so I am not able to make a wrapper. What does this mean anyway? SH_DECL_HOOK1_void(IServerGameClients, ClientDisconnect, SH_NOATTRIB, 0, edict_t *); I know it's a sourcehook, but how would someone know what kind of macro to use? I looked through the extensions forum but I am not sure how people are finding out how to form their hooks. |
Re: Access SourceMod core?
Quote:
For movement, I'm not sure offhand what the best way to check would be (other than checking position each frame). |
Re: Access SourceMod core?
There is a OnPlayerRunCmd forward in pawn, so I basically need the same hook. Anyhow, I'll look through the documentation. Thanks again.
|
Re: Access SourceMod core?
Quote:
However, If you still want that function despite that, you can use SourceHook to hook it much like SDKTools does in extensions/sdktools/hooks.cpp. |
Re: Access SourceMod core?
Wonderful. Just what I needed.
I just realized something. You're the person that took SDK Hooks from 1.0 to 2.1. Thanks a lot for working so hard on that :) I wanted to let you know that your work doesn't go unappreciated. By the way, if I want to retrieve the model name (if it exists) of every entity that is loaded during level initialization, I use IEntityFactoryDictionary with Bintools and create a hook, right? |
Re: Access SourceMod core?
Quote:
|
Re: Access SourceMod core?
On second thought, you could just use a manual VPHook on CBaseEntity::Spawn. I think that most or all overrides will also call the one in the base class, or you could also add them for the specific classes that you need to check the model of.
|
Re: Access SourceMod core?
This right?:
SH_ADD_MANUALVPHOOK(manual hook name, representative instance pointer, handler, post or not) EDIT: nvm, figured it out. I did the first thing you suggested. I just realized I posted in the wrong forum. I'll create a different thread in the coding forum. |
All times are GMT -4. The time now is 05:44. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.