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

Help with a plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sn4k3
Senior Member
Join Date: Nov 2005
Old 03-07-2007 , 14:44   Help with a plugin
Reply With Quote #1

I try diferents makefiles and su continues crash i dont know why!

v1.0 works only have 1 cvar = su_version

but i have tryed in v1.1 remove all cvars and only stay with one = su_version

and still crash!

v1.0 have sames .a files in v1.1 (MySQL)

i try too remove all my functions and only stay convars and plugin running but server crash with convars again

can any take a look??

if any interested in help please send me a pm or post in forum and i will send link to download files
sn4k3 is offline
Send a message via MSN to sn4k3
sn4k3
Senior Member
Join Date: Nov 2005
Old 03-11-2007 , 08:37   Re: Help with a plugin
Reply With Quote #2

There is my Cpps:

Main Plugin CPP

Code:
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
//---------------------------------------------------------------------------------
// Purpose: a sample 3rd party plugin class
//---------------------------------------------------------------------------------
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <string.h>

#ifdef WIN32
#include <winsock2.h>
#define SU_OS "Windows"
#else
#include <unistd.h>
#include <errno.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/poll.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <fcntl.h>
#define SU_OS "Linux"
#endif


char *_su_gamedir;
#define SU_VERSION "1.1"
#define SU_BASEDIR "cfg/source_utils"; // the directory relative to cstrike/cfg
#define SU_LASTCOMPILEDATE ""__DATE__" At "__TIME__" By Sn4k3"
#ifdef WIN32
#pragma comment(linker, "/VERSION:"SU_VERSION"")
#pragma warning(disable:4005)
#endif
//#define SU_SOURCEMM

//#include <iostream>
//#include <iomanip>
//#include <limits>
#include <math.h>
#include "interface.h"
#include "filesystem.h"
#include "engine/iserverplugin.h"
#include "dlls/iplayerinfo.h"
#include "eiface.h"
#include "igameevents.h"
#include "convar.h"
#include "Color.h"
#include "vstdlib/random.h"
#include "engine/IEngineTrace.h"
#include "mathlib\math_base.h"

#include "MRecipientFilter.h"
#include "shake.h"
#include "IEffects.h"
#include "networkstringtabledefs.h"
#include "beam_flags.h"
//#include "gametrace.h"
//#include "bspflags.h"
#include "shareddefs.h"
/*#include "CSigMngr.h"
#include "scanfunc.h"*/
//#include "MTimer.h"
#include "SoundEmitterSystem/isoundemittersystembase.h"

#include <convar.h>
#include "icvar.h"
#define GAME_DLL 1
#include "cbase.h"
#include "engine/IStaticPropMgr.h"
#include "entityapi.h"
#include "entitylist.h"
#include "baseentity.h"
#include "engine/IEngineSound.h"
#include "engine/IVEngineCache.h"
#include "IEffects.h"
#include "offsets.h"
#include "vfuncs.h"
#include "bitbuf.h"
#include "props.h"
#include "igamemovement.h"
#include "utlvector.h"
#include "utlbuffer.h"

#include <KeyValues.h>
//#include "sp_keys.h"
//#include "iserver.h"

int maxplayers;
int tickrate;
//MTimer *g_Timer;

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

#include "su_interface.h"

// Interfaces from the engine
IVEngineServer	*engine = NULL; // helper functions (messaging clients, loading content, making entities, running commands, etc)
IFileSystem		*filesystem = NULL; // file I/O
//IGameEventManager *gameeventmanager = NULL; // game events interface
IGameEventManager2 *gameeventmanager2 = NULL; // game events interface
IPlayerInfoManager *playerinfomanager = NULL; // game dll interface to interact with players
IBotManager *botmanager = NULL; // game dll interface to interact with bots
IServerPluginHelpers *helpers = NULL; // special 3rd party plugin helpers from the engine
IServerGameClients *serverclients;
IUniformRandomStream *randomStr = NULL;
IEngineTrace *enginetrace = NULL;
IServerGameDLL *gamedll = NULL;

IVoiceServer	*pVoiceServer = NULL;
ICvar			*cvar = NULL;
INetworkStringTableContainer *networkstringtable = NULL;
IStaticPropMgrServer *staticpropmgr = NULL;
IEngineSound *enginesound = NULL;
ISpatialPartition *partition = NULL;
IVModelInfo *modelinfo = NULL;
//IVEngineCache *engineCache = NULL;
IEffects *effects = NULL; // fx
IEngineSound *esounds = NULL; // sound
ISoundEmitterSystemBase *soundemitterbase = NULL;

IPlayerInfo *playerinfo;
//IServer *iserver;
CBaseEntity *cbaseentity;
CBaseCombatWeapon *pWeapon = NULL;
CBasePlayer *cbaseplayer;
IVDebugOverlay *debugoverlay;
IServerGameEnts *gameents;

#ifdef SU_SOURCEMM
SourceHook::CallClass<IVEngineServer> *Engine_CC;
#endif

//
// The plugin is a static singleton that is exported as an interface
//

CGlobalVars *gpGlobals = NULL;
//KeyValues *kv_mysql = new KeyValues ("MySQL");
KeyValues *su_kv = new KeyValues ("SU KeyValues");


// function to initialize any cvars/command in this plugin
void InitCVars( CreateInterfaceFn cvarFactory );
//void Bot_RunAll( void );


#include "su_convars.h"
// useful helper func
/*inline bool FStrEq(const char *sz1, const char *sz2)
{
	return(Q_stricmp(sz1, sz2) == 0);
}*/

CSourceUtils g_SourceUtils;
#ifdef SU_SOURCEMM
PLUGIN_EXPOSE(CSourceUtils, g_SourceUtils);
#else
EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CSourceUtils, IServerPluginCallbacks, INTERFACEVERSION_ISERVERPLUGINCALLBACKS, g_SourceUtils );
#endif

//---------------------------------------------------------------------------------
// Purpose: constructor/destructor
//---------------------------------------------------------------------------------
CSourceUtils::CSourceUtils()
{
	m_iClientCommandIndex = 0;
}

CSourceUtils::~CSourceUtils()
{
}

#define ASSIGN_INTERFACE(VAR, TYPE, FACTORY, NAME) \
	VAR = (TYPE)InterfaceSearch(FACTORY, NAME); \
	if(VAR == NULL) \
		Msg("Unable to find an interface, ignoring");

#define ASSIGN_INTERFACE_OR_DIE(VAR, TYPE, FACTORY, NAME) \
	VAR = (TYPE)InterfaceSearch(FACTORY, NAME); \
	if(VAR == NULL) { \
		Msg("Failed to load an interface"); \
		return false; \
	}

//---------------------------------------------------------------------------------
// Purpose: called when the plugin is loaded, load the interface we need from the engine
//---------------------------------------------------------------------------------
#ifdef SU_SOURCEMM
bool CSourceUtils::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late)
{
	CreateInterfaceFn interfaceFactory = ismm->engineFactory(), gameServerFactory = ismm->serverFactory();
	PLUGIN_SAVEVARS();
#else
bool CSourceUtils::Load(	CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory )
{
#endif
/*	playerinfomanager = (IPlayerInfoManager *)gameServerFactory(INTERFACEVERSION_PLAYERINFOMANAGER,NULL);
	if ( !playerinfomanager )
	{
		Warning( "Unable to load playerinfomanager, ignoring\n" ); // this isn't fatal, we just won't be able to access specific player data
	}

	botmanager = (IBotManager *)gameServerFactory(INTERFACEVERSION_PLAYERBOTMANAGER, NULL);
	if ( !botmanager )
	{
		Warning( "Unable to load botcontroller, ignoring\n" ); // this isn't fatal, we just won't be able to access specific bot functions
	}

	// get the interfaces we want to use
	if(	!(engine = (IVEngineServer*)interfaceFactory(INTERFACEVERSION_VENGINESERVER, NULL)) ||
		!(gameeventmanager2 = (IGameEventManager2 *)interfaceFactory(INTERFACEVERSION_GAMEEVENTSMANAGER2,NULL)) ||
		!(filesystem = (IFileSystem*)interfaceFactory(FILESYSTEM_INTERFACE_VERSION, NULL)) ||
		!(helpers = (IServerPluginHelpers*)interfaceFactory(INTERFACEVERSION_ISERVERPLUGINHELPERS, NULL)) ||
		!(enginetrace = (IEngineTrace *)interfaceFactory(INTERFACEVERSION_ENGINETRACE_SERVER,NULL)) ||
		!(networkstringtable = (INetworkStringTableContainer*)interfaceFactory(INTERFACENAME_NETWORKSTRINGTABLESERVER, NULL)) ||
		!(gamedll = (IServerGameDLL*)gameServerFactory(INTERFACEVERSION_SERVERGAMEDLL, NULL)) ||
		!(effects = (IEffects*)gameServerFactory(IEFFECTS_INTERFACE_VERSION, NULL)) ||
		!(cvar = (ICvar*)interfaceFactory(VENGINE_CVAR_INTERFACE_VERSION, NULL)) ||
		!(esounds = (IEngineSound*)interfaceFactory(IENGINESOUND_SERVER_INTERFACE_VERSION, NULL)) ||
		!(playerinfomanager = (IPlayerInfoManager*)gameServerFactory(INTERFACEVERSION_PLAYERINFOMANAGER, NULL)) ||
		!(randomStr = (IUniformRandomStream *)interfaceFactory(VENGINE_SERVER_RANDOM_INTERFACE_VERSION, NULL))
		)
	{
		return false; // we require all these interface to function
	}*/

	ASSIGN_INTERFACE_OR_DIE(engine, IVEngineServer*, interfaceFactory, INTERFACEVERSION_VENGINESERVER);
	ASSIGN_INTERFACE_OR_DIE(gameeventmanager2, IGameEventManager2*, interfaceFactory, INTERFACEVERSION_GAMEEVENTSMANAGER2);
	ASSIGN_INTERFACE_OR_DIE(filesystem, IFileSystem*, interfaceFactory, FILESYSTEM_INTERFACE_VERSION);
	ASSIGN_INTERFACE_OR_DIE(playerinfomanager, IPlayerInfoManager*, gameServerFactory, INTERFACEVERSION_PLAYERINFOMANAGER);
	ASSIGN_INTERFACE_OR_DIE(helpers, IServerPluginHelpers*, interfaceFactory, INTERFACEVERSION_ISERVERPLUGINHELPERS);
	ASSIGN_INTERFACE_OR_DIE(enginetrace, IEngineTrace*, interfaceFactory, INTERFACEVERSION_ENGINETRACE_SERVER);
	ASSIGN_INTERFACE_OR_DIE(randomStr, IUniformRandomStream*, interfaceFactory, VENGINE_SERVER_RANDOM_INTERFACE_VERSION);
	ASSIGN_INTERFACE_OR_DIE(gamedll, IServerGameDLL*, gameServerFactory, "ServerGameDLL006");
	ASSIGN_INTERFACE_OR_DIE(serverclients, IServerGameClients*, gameServerFactory, INTERFACEVERSION_SERVERGAMECLIENTS);
	ASSIGN_INTERFACE_OR_DIE(effects, IEffects*, gameServerFactory, IEFFECTS_INTERFACE_VERSION);

	ASSIGN_INTERFACE(modelinfo, IVModelInfo*, interfaceFactory, VMODELINFO_SERVER_INTERFACE_VERSION);
	ASSIGN_INTERFACE(esounds, IEngineSound*, interfaceFactory, IENGINESOUND_SERVER_INTERFACE_VERSION);
	ASSIGN_INTERFACE(partition, ISpatialPartition*, interfaceFactory, INTERFACEVERSION_SPATIALPARTITION);
	ASSIGN_INTERFACE(staticpropmgr, IStaticPropMgrServer*, interfaceFactory, INTERFACEVERSION_STATICPROPMGR_SERVER);
	ASSIGN_INTERFACE(soundemitterbase, ISoundEmitterSystemBase*, interfaceFactory, SOUNDEMITTERSYSTEM_INTERFACE_VERSION);
	ASSIGN_INTERFACE(cvar, ICvar*, interfaceFactory, VENGINE_CVAR_INTERFACE_VERSION);
	ASSIGN_INTERFACE(botmanager, IBotManager*, gameServerFactory, INTERFACEVERSION_PLAYERBOTMANAGER);
	ASSIGN_INTERFACE(networkstringtable, INetworkStringTableContainer*, interfaceFactory, INTERFACENAME_NETWORKSTRINGTABLESERVER);

	#ifdef SU_SOURCEMM
	SH_ADD_HOOK_MEMFUNC(IServerGameDLL, LevelInit, gamedll, &g_SourceUtils, &CSourceUtils::LevelInit, true);
	SH_ADD_HOOK_MEMFUNC(IServerGameDLL, ServerActivate, gamedll, &g_SourceUtils, &CSourceUtils::ServerActivate, true);
	SH_ADD_HOOK_MEMFUNC(IServerGameDLL, GameFrame, gamedll, &g_SourceUtils, &CSourceUtils::GameFrame, true);
	SH_ADD_HOOK_MEMFUNC(IServerGameDLL, LevelShutdown, gamedll, &g_SourceUtils, &CSourceUtils::LevelShutdown, false);
	SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientActive, serverclients, &g_SourceUtils, &CSourceUtils::ClientActive, false); //false so this can get called /after/ FireGameEvent
	SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, serverclients, &g_SourceUtils, &CSourceUtils::ClientDisconnect, true);
	SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientPutInServer, serverclients, &g_SourceUtils, &CSourceUtils::ClientPutInServer, true);
	SH_ADD_HOOK_MEMFUNC(IServerGameClients, SetCommandClient, serverclients, &g_SourceUtils, &CSourceUtils::SetCommandClient, true);
	SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientSettingsChanged, serverclients, &g_SourceUtils, &CSourceUtils::ClientSettingsChanged, true);

	/* The following functions are pre handled, because that's how they are in IServerPluginCallbacks */
	SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientConnect, serverclients, &g_SourceUtils, &CSourceUtils::ClientConnect, false);
	SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientCommand, serverclients, &g_SourceUtils, &CSourceUtils::ClientCommand, false);

//	SH_ADD_HOOK_MEMFUNC(IGameEventManager2, FireEvent, gameeventmanager, &g_SourceUtils, &CSourceUtils::FireGameEvent, false);

	/* Get the call class for IVServerEngine so we can safely call functions
	   without invoking their hooks (when needed). */
	Engine_CC = SH_GET_CALLCLASS(engine);
	gpGlobals = g_SMAPI->pGlobals();

#else
	gpGlobals = playerinfomanager->GetGlobalVars();
#endif

//	g_Timer = new MTimer();
//	CSU_Timer::Init();

	InitCVars( interfaceFactory ); // register any cvars we have defined
	MathLib_Init( 2.2f, 2.2f, 0.0f, 2.0f );


	cvar_su_gamemod.SetValue(gamedll->GetGameDescription());
	//cvar_su_tickrate.SetValue(iserver->GetTick());
	engine->GetGameDir(_su_gamedir, 1024);

	//gameeventmanager2->LoadEventsFromFile("addons/su_events.res");

	return true;
}

//---------------------------------------------------------------------------------
// Purpose: called when the plugin is unloaded (turned off)
//---------------------------------------------------------------------------------
#ifdef SU_SOURCEMM
bool CSourceUtils::Unload(char *error, size_t maxlen)
{
#else
void CSourceUtils::Unload( void )
{
#endif
	gameeventmanager2->RemoveListener( this ); // make sure we are unloaded from the event system

//	CSU_Timer::FreeMemory();
	#ifdef SU_SOURCEMM
//	SH_REMOVE_HOOK_MEMFUNC(IGameEventManager2, FireEvent, gameeventmanager, &g_SourceUtils, &CSourceUtils::FireGameEvent, false);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, LevelInit, gamedll, &g_SourceUtils, &CSourceUtils::LevelInit, true);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, ServerActivate, gamedll, &g_SourceUtils, &CSourceUtils::ServerActivate, true);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, GameFrame, gamedll, &g_SourceUtils, &CSourceUtils::GameFrame, true);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, LevelShutdown, gamedll, &g_SourceUtils, &CSourceUtils::LevelShutdown, false);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientActive, serverclients, &g_SourceUtils, &CSourceUtils::ClientActive, true);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, serverclients, &g_SourceUtils, &CSourceUtils::ClientDisconnect, true);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientPutInServer, serverclients, &g_SourceUtils, &CSourceUtils::ClientPutInServer, true);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, SetCommandClient, serverclients, &g_SourceUtils, &CSourceUtils::SetCommandClient, true);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientSettingsChanged, serverclients, &g_SourceUtils, &CSourceUtils::ClientSettingsChanged, true);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientConnect, serverclients, &g_SourceUtils, &CSourceUtils::ClientConnect, false);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientCommand, serverclients, &g_SourceUtils, &CSourceUtils::ClientCommand, false);

	SH_RELEASE_CALLCLASS(Engine_CC);
	return true;
#else
	return ;
#endif
}

//---------------------------------------------------------------------------------
// Purpose: called when the plugin is paused (i.e should stop running but isn't unloaded)
//---------------------------------------------------------------------------------
#ifdef SU_SOURCEMM
bool CSourceUtils::Pause(char *error, size_t maxlen)
{
	return true;
}
#else
void CSourceUtils::Pause( void )
{
	return ;
}
#endif

//---------------------------------------------------------------------------------
// Purpose: called when the plugin is unpaused (i.e should start executing again)
//---------------------------------------------------------------------------------
#ifdef SU_SOURCEMM
bool CSourceUtils::Unpause(char *error, size_t maxlen)
{
	return true;
}
#else
void CSourceUtils::UnPause( void )
{
	return ;
}
#endif

#ifdef SU_SOURCEMM
void CSourceUtils::AllPluginsLoaded(void)
{
	/* We don't really need this for anything other than interplugin
	   communication and that's not used in this plugin.
	   If we really wanted, we could override the factories so other plugins can
	   request interfaces we make.  In this callback, the plugin could be
	   assured that either the interfaces it requires were either loaded in
	   another plugin or not.
	   -- SO SAYS BAILOPANTS
	*/

	return ;
}
#endif

//---------------------------------------------------------------------------------
// Purpose: the name of this plugin, returned in "plugin_print" command
//---------------------------------------------------------------------------------
#ifdef SU_SOURCEMM
const char *CSourceUtils::GetDescription(void)
{
	return "Source Utils, Version: "SU_VERSION", By Sn4k3";
}
#else
const char *CSourceUtils::GetPluginDescription( void )
{
	return "Source Utils, Version: "SU_VERSION", By Sn4k3";
}
#endif

//---------------------------------------------------------------------------------
// Purpose: SourceMM Declarations
//---------------------------------------------------------------------------------
#ifdef SU_SOURCEMM
const char *CSourceUtils::GetVersion(void)
{
	return SU_VERSION;
}
#endif


//---------------------------------------------------------------------------------
// Purpose: called on level start
//---------------------------------------------------------------------------------
#ifdef SU_SOURCEMM
bool CSourceUtils::LevelInit(const char *pMapName, const char *pMapEntities, const char *pOldLevel, const char *pLandmarkName, bool loadGame, bool background)
{
#else
void CSourceUtils::LevelInit( char const *pMapName )
{
#endif
	cvar_su_currentmap.SetValue(pMapName);
//	LoadDownPre("su_fuctions.txt");
	//Msg( "Level \"%s\" has been loaded\n", pMapName );
	//gameeventmanager2->AddListener( this, "player_death", true );

#ifdef SU_SOURCEMM
	RETURN_META_VALUE(MRES_IGNORED, true);
#else
	return ;
#endif
}

//---------------------------------------------------------------------------------
// Purpose: called on level start, when the server is ready to accept client connections
//		edictCount is the number of entities in the level, clientMax is the max client count
//---------------------------------------------------------------------------------
void CSourceUtils::ServerActivate( edict_t *pEdictList, int edictCount, int clientMax )
{
	maxplayers = clientMax;
	//tickrate = iserver->GetTick();
	cvar_su_maxplayers.SetValue(maxplayers);
	//cvar_su_tickrate.SetValue(iserver->GetTick());
}

//---------------------------------------------------------------------------------
// Purpose: called once per server frame, do recurring work here (like checking for timeouts)
//---------------------------------------------------------------------------------
void CSourceUtils::GameFrame( bool simulating )
{
//	CSU_Timer::RunEvents();
	/*if ( simulating )
	{
		Bot_RunAll();
	}*/
	//if(g_Timer->activeTimers) g_Timer->CheckTimers();
}

//---------------------------------------------------------------------------------
// Purpose: called on level end (as the server is shutting down or going to a new map)
//---------------------------------------------------------------------------------
void CSourceUtils::LevelShutdown( void ) // !!!!this can get called multiple times per map change
{
	gameeventmanager2->RemoveListener( this );
}

//---------------------------------------------------------------------------------
// Purpose: called when a client spawns into a server (i.e as they begin to play)
//---------------------------------------------------------------------------------
#ifdef SU_SOURCEMM
void CSourceUtils::ClientActive(edict_t *pEntity, bool bLoadGame)
{
#else
void CSourceUtils::ClientActive( edict_t *pEntity )
{
#endif
	return ;
}

//---------------------------------------------------------------------------------
// Purpose: called when a client leaves a server (or is timed out)
//---------------------------------------------------------------------------------
void CSourceUtils::ClientDisconnect( edict_t *pEntity )
{
}

//---------------------------------------------------------------------------------
// Purpose: called on
//---------------------------------------------------------------------------------
void CSourceUtils::ClientPutInServer( edict_t *pEntity, char const *playername )
{
	/*KeyValues *kv = new KeyValues( "msg" );
	kv->SetString( "title", "Hello" );
	kv->SetString( "msg", "Hello there" );
	kv->SetColor( "color", Color( 255, 0, 0, 255 ));
	kv->SetInt( "level", 5);
	kv->SetInt( "time", 10);
	helpers->CreateMessage( pEntity, DIALOG_MSG, kv, this );
	kv->deleteThis();*/
}

//---------------------------------------------------------------------------------
// Purpose: called on level start
//---------------------------------------------------------------------------------
void CSourceUtils::SetCommandClient( int index )
{
	m_iClientCommandIndex = index;
}

//---------------------------------------------------------------------------------
// Purpose: called on level start
//---------------------------------------------------------------------------------
void CSourceUtils::ClientSettingsChanged( edict_t *pEdict )
{
	/*if ( playerinfomanager )
	{
		IPlayerInfo *playerinfo = playerinfomanager->GetPlayerInfo( pEdict );

		const char * name = engine->GetClientConVarValue( engine->IndexOfEdict(pEdict), "name" );

		if ( playerinfo && name && playerinfo->GetName() &&
			 Q_stricmp( name, playerinfo->GetName()) ) // playerinfo may be NULL if the MOD doesn't support access to player data
													   // OR if you are accessing the player before they are fully connected
		{
			char msg[128];
			Q_snprintf( msg, sizeof(msg), "Your name changed to \"%s\" (from \"%s\"\n", name, playerinfo->GetName() );
			engine->ClientPrintf( pEdict, msg ); // this is the bad way to check this, the better option it to listen for the "player_changename" event in FireGameEvent()
												// this is here to give a real example of how to use the playerinfo interface
		}
	}*/
}

//---------------------------------------------------------------------------------
// Purpose: called when a client joins a server
//---------------------------------------------------------------------------------
#ifdef SU_SOURCEMM
bool CSourceUtils::ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
{
	return true;
}
#else
PLUGIN_RESULT CSourceUtils::ClientConnect( bool *bAllowConnect, edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen )
{
	CMD_CONTINUE;
}
#endif

//---------------------------------------------------------------------------------
// Purpose: called when a client types in a command (only a subset of commands however, not CON_COMMAND's)
//---------------------------------------------------------------------------------
#ifdef SU_SOURCEMM
void CSourceUtils::ClientCommand(edict_t *pEntity)
{
#else
PLUGIN_RESULT CSourceUtils::ClientCommand( edict_t *pEntity )
{
#endif
	const char *pcmd = engine->Cmd_Argv(0);

	if ( !pEntity || pEntity->IsFree() )
	{
		CMD_CONTINUE;
	}


/*	if ( FStrEq( pcmd, "menu" ) )
	{
		KeyValues *kv = new KeyValues( "menu" );
		kv->SetString( "title", "You've got options, hit ESC" );
		kv->SetInt( "level", 1 );
		kv->SetColor( "color", Color( 255, 0, 0, 255 ));
		kv->SetInt( "time", 20 );
		kv->SetString( "msg", "Pick an option\nOr don't." );

		for( int i = 1; i < 9; i++ )
		{
			char num[10], msg[10], cmd[10];
			Q_snprintf( num, sizeof(num), "%i", i );
			Q_snprintf( msg, sizeof(msg), "Option %i", i );
			Q_snprintf( cmd, sizeof(cmd), "option%i", i );

			KeyValues *item1 = kv->FindKey( num, true );
			item1->SetString( "msg", msg );
			item1->SetString( "command", cmd );
		}

		helpers->CreateMessage( pEntity, DIALOG_MENU, kv, this );
		kv->deleteThis();
		return CMD_OVERRIDE; // we handled this function
	}
	else if ( FStrEq( pcmd, "rich" ) )
	{
		KeyValues *kv = new KeyValues( "menu" );
		kv->SetString( "title", "A rich message" );
		kv->SetInt( "level", 1 );
		kv->SetInt( "time", 20 );
		kv->SetString( "msg", "This is a long long long text string.\n\nIt also has line breaks." );

		helpers->CreateMessage( pEntity, DIALOG_TEXT, kv, this );
		kv->deleteThis();
		return CMD_OVERRIDE; // we handled this function
	}
	else if ( FStrEq( pcmd, "msg" ) )
	{
		KeyValues *kv = new KeyValues( "menu" );
		kv->SetString( "title", "Just a simple hello" );
		kv->SetInt( "level", 1 );
		kv->SetInt( "time", 20 );

		helpers->CreateMessage( pEntity, DIALOG_MSG, kv, this );
		kv->deleteThis();
		return CMD_OVERRIDE; // we handled this function
	}
	else if ( FStrEq( pcmd, "entry" ) )
	{
		KeyValues *kv = new KeyValues( "entry" );
		kv->SetString( "title", "Stuff" );
		kv->SetString( "msg", "Enter something" );
		kv->SetString( "command", "say" ); // anything they enter into the dialog turns into a say command
		kv->SetInt( "level", 1 );
		kv->SetInt( "time", 20 );

		helpers->CreateMessage( pEntity, DIALOG_ENTRY, kv, this );
		kv->deleteThis();
		return CMD_OVERRIDE; // we handled this function
	}*/
	/*else if ( FStrEq( pcmd, "model" ) )
	{
		CPhysicsProp *crate;
		Vector vecForward;
		AngleVectors(pEntity->GetUnknown()->GetBaseEntity()->EyeAngles(), &vecForward );
		Vector vecOrigin = playerinfomanager->GetPlayerInfo(pEntity)->GetAbsOrigin() + vecForward * 32 + Vector(0,0,64);
		QAngle vecAngles( 0, playerinfomanager->GetPlayerInfo(pEntity)->GetAbsAngles().y - 90, 0 );
		crate = (CPhysicsProp *)gScanFuncs.CreateEntityByName("prop_physics");
		crate->SetModel("models/props/de_dust/du_crate_64x64.mdl");
		crate->Teleport(&vecOrigin, &vecAngles, &Vector(0,0,0));
		crate->CreateVPhysics();
	}*/

	CMD_CONTINUE;
}

//---------------------------------------------------------------------------------
// Purpose: called when a client is authenticated
//---------------------------------------------------------------------------------
#ifndef SU_SOURCEMM
PLUGIN_RESULT CSourceUtils::NetworkIDValidated( const char *pszUserName, const char *pszNetworkID )
{
	CMD_CONTINUE;
}
#endif

//---------------------------------------------------------------------------------
// Purpose: called when an event is fired
//---------------------------------------------------------------------------------
void CSourceUtils::FireGameEvent( IGameEvent *event )
{
	const char *name = event->GetName();
	//Msg( "CEmptyServerPlugin::FireGameEvent: Got event \"%s\"\n", name );
}

//---------------------------------------------------------------------------------
// Purpose: an example of how to implement a new command
//---------------------------------------------------------------------------------
/*CON_COMMAND( empty_version, "prints the version of the empty plugin" )
{
	Msg( "Version:1.0.0.0\n" );
}*/

/*CON_COMMAND( empty_log, "logs the version of the empty plugin" )
{
	engine->LogPrint( "Version:1.0.0.0\n" );
}*/

//---------------------------------------------------------------------------------
// Purpose: an example cvar
//---------------------------------------------------------------------------------
#include "su_blocks.h"
Plugin Interface

Code:
#ifndef _SU_INTERFACE_H
#define _SU_INTERFACE_H

#ifdef SU_SOURCEMM
/**
 * @brief SourceMM Plugin Specific
 *
 * @{
 */
#define SU_VERSION_ENGINE "1.1 MMS"
#define CMD_CONTINUE return
#define CMD_OVERRIDE RETURN_META(MRES_SUPERCEDE)
#include "ISmmPlugin.h"
	class CSourceUtils: public ISmmPlugin, public IGameEventListener2
	{
		/* Private Variables */
		int m_iClientCommandIndex;
		bool is_shutdown;

		/* Private Functions */
		//void* InterfaceSearch(CreateInterfaceFn factory, char *name);

	public:
		/* Public Functions */
		CSourceUtils();
		~CSourceUtils();

		const char *GetDescription();
		const char *GetVersion();

		bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late);
		bool Unload(char *error, size_t maxlen);
		bool Pause(char *error, size_t maxlen);
		bool Unpause(char *error, size_t maxlen);
		void AllPluginsLoaded(void);
		bool LevelInit(const char *pMapName, const char *pMapEntities, const char *pOldLevel, const char *pLandmarkName, bool loadGame, bool background);
		void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
		void GameFrame(bool simulating);
		void LevelShutdown(void);
		bool ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
		void ClientActive(edict_t *pEntity, bool bLoadGame);
		void ClientPutInServer(edict_t *pEntity, char const *playername);
		void ClientDisconnect(edict_t *pEntity);
		void SetCommandClient(int index);
		void ClientSettingsChanged(edict_t *pEdict);
		void ClientCommand(edict_t *pEntity); /* Use RETURN_META(MRES_SUPERCEDE) to override the gamedll */

		/* Some extra crap SourceMM requires */
		const char *GetName()
		{
			return "Source Utils";
		}

		const char *GetAuthor()
		{
			return "sn4k3";
		}

		const char *GetURL()
		{
			return "";
		}

		const char *GetLicense()
		{
			return "zlib/libpng";
		}

		const char *GetDate()
		{
			return __DATE__;
		}

		const char *GetLogTag()
		{
			return "Source Utils";
		}

		/* IGameEventListener Interface */
		void FireGameEvent(IGameEvent *event); /* KeyValues *event */
	};

	//extern SourceHook::CallClass<IVEngineServer> *Engine_CC;

	PLUGIN_GLOBALVARS();
/** @} */
#else
#define SU_VERSION_ENGINE "1.1 VSP"
#define CMD_CONTINUE return PLUGIN_CONTINUE
#define CMD_OVERRIDE return PLUGIN_STOP
#include "engine/iserverplugin.h"
class CSourceUtils: public IServerPluginCallbacks, public IGameEventListener2
{
public:
	CSourceUtils();
	~CSourceUtils();

	// IServerPluginCallbacks methods
	virtual bool			Load(	CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory );
	virtual void			Unload( void );
	virtual void			Pause( void );
	virtual void			UnPause( void );
	virtual const char     *GetPluginDescription( void );      
	virtual void			LevelInit( char const *pMapName );
	virtual void			ServerActivate( edict_t *pEdictList, int edictCount, int clientMax );
	virtual void			GameFrame( bool simulating );
	virtual void			LevelShutdown( void );
	virtual void			ClientActive( edict_t *pEntity );
	virtual void			ClientDisconnect( edict_t *pEntity );
	virtual void			ClientPutInServer( edict_t *pEntity, char const *playername );
	virtual void			SetCommandClient( int index );
	virtual void			ClientSettingsChanged( edict_t *pEdict );
	virtual PLUGIN_RESULT	ClientConnect( bool *bAllowConnect, edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen );
	virtual PLUGIN_RESULT	ClientCommand( edict_t *pEntity );
	virtual PLUGIN_RESULT	NetworkIDValidated( const char *pszUserName, const char *pszNetworkID );

	// IGameEventListener Interface
	virtual void FireGameEvent( IGameEvent * event );

	virtual int GetCommandIndex() { return m_iClientCommandIndex; }
private:
	int m_iClientCommandIndex;
};
#endif



#ifdef SU_SOURCEMM
SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, 0, bool, char const *, char const *, char const *, char const *, bool, bool);
SH_DECL_HOOK3_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0, edict_t *, int, int);
SH_DECL_HOOK1_void(IServerGameDLL, GameFrame, SH_NOATTRIB, 0, bool);
SH_DECL_HOOK0_void(IServerGameDLL, LevelShutdown, SH_NOATTRIB, 0);
SH_DECL_HOOK2_void(IServerGameClients, ClientActive, SH_NOATTRIB, 0, edict_t *, bool);
SH_DECL_HOOK1_void(IServerGameClients, ClientDisconnect, SH_NOATTRIB, 0, edict_t *);
SH_DECL_HOOK2_void(IServerGameClients, ClientPutInServer, SH_NOATTRIB, 0, edict_t *, char const *);
SH_DECL_HOOK1_void(IServerGameClients, SetCommandClient, SH_NOATTRIB, 0, int);
SH_DECL_HOOK1_void(IServerGameClients, ClientSettingsChanged, SH_NOATTRIB, 0, edict_t *);
SH_DECL_HOOK5(IServerGameClients, ClientConnect, SH_NOATTRIB, 0, bool, edict_t *, const char*, const char *, char *, int);
SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *);
//SH_DECL_HOOK2(IGameEventManager2, FireEvent, SH_NOATTRIB, 0, bool, IGameEvent *, bool);
#endif

void *InterfaceSearch(CreateInterfaceFn factory, char *name)
{
	char *iface_str, *buf;
	unsigned int len, check, i;
	void *iface;

	if(name == NULL)
		return NULL;

	/* First test if this already a valid interface name */
	iface = factory(name, NULL);
	if(iface != NULL)
		return iface;

	len = strlen(name);
	iface_str = (char*)calloc(len+1, sizeof(char));
	strcpy(iface_str, name);

	if(len > 3) {
		check = isdigit(*(iface_str+(len-3))) ? 1 : 0;
		check &= isdigit(*(iface_str+(len-2))) ? 1 : 0;
		check &= isdigit(*(iface_str+(len-1))) ? 1 : 0;
		if(check)
			iface_str[len-3] = '\0';
	}

	buf = (char*)calloc(strlen(iface_str)+8, sizeof(char));

	for(i = 0;i < 1000;i++) {
		sprintf(buf, "%s%0.3d", iface_str, i);
		iface = factory(buf, NULL);
		if(iface != NULL)
			break;
	}

	free(iface_str);
	free(buf);
	return iface;
}

#endif
Convars

Code:
#ifndef _SU_CONVARS_H
#define _SU_CONVARS_H
//---------------------------------------------------------------------------------
// Purpose: an example cvar
//---------------------------------------------------------------------------------
//static ConVar cvar_su_debug("su_debug", "0", 0, "Enable Source Utils Debug");
static ConVar cvar_su_temp_get("su_temp_get", "0", 0, "Can be used for cath returns vars");
static ConVar cvar_su_version("su_version", SU_VERSION_ENGINE, FCVAR_PLUGIN | FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY, "Source Utils Version");
static ConVar cvar_su_os("su_os", SU_OS, FCVAR_SPONLY, "Server OS System");
static ConVar cvar_su_maxplayers("su_maxplayers", 0, FCVAR_SPONLY, "Max Players/Slots");
//static ConVar cvar_su_tickrate("su_tickrate", 0, FCVAR_GAMEDLL, "TickRate Of Server");
static ConVar cvar_su_currentmap("su_currentmap", "de_dust2", FCVAR_SPONLY, "Current Map (.bsp)");
static ConVar cvar_su_gamemod("su_gamemod", "cstrike", FCVAR_SPONLY, "Current Running DLL Game Mod");
static ConVar cvar_su_lastcompile("su_lastcompile", SU_LASTCOMPILEDATE, FCVAR_SPONLY, "Last Source Utils Compile Date/Time");



#endif

Please Help!
sn4k3 is offline
Send a message via MSN to sn4k3
BAILOPAN
Join Date: Jan 2004
Old 03-11-2007 , 16:20   Re: Help with a plugin
Reply With Quote #3

Post your Makefile.
__________________
egg
BAILOPAN is offline
sn4k3
Senior Member
Join Date: Nov 2005
Old 03-12-2007 , 09:31   Re: Help with a plugin
Reply With Quote #4

Quote:
Originally Posted by BAILOPAN View Post
Post your Makefile.
the makefile i think is good because i try 3 diferents makefiles but:

Code:
#(C)2004-2006 SourceMM Development Team
# Makefile written by David "BAILOPAN" Anderson

#####################################################################
# Directories
#####################################################################

HL2SDK = /cygdrive/e/caza/hl2mod/src
PLUGIN_DIR=$(HL2SDK)/utils/Source_Utils
SMM_ROOT =$(HL2SDK)/sourcemm
SMMH_ROOT =$(HL2SDK)/sourcehook
MySQL = $(PLUGIN_DIR)/library/mysql
Mail = $(PLUGIN_DIR)/library/mail
SRCDS = /cygdrive/e/caza/hl2mod

HL2PUB = $(HL2SDK)/public
HL2SDK_TIER0 = $(HL2SDK)/public/tier0
HL2SDK_TIER1 = $(HL2SDK)/tier1

COMPILE_MM = true


#####################################################################
# Flags
#####################################################################

ARCH_CFLAGS = -mtune=i686 -march=pentium -mmmx
USER_CFLAGS =
BASE_CFLAGS = -fpermissive -D_LINUX -DNDEBUG -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -fPIC -Wno-deprecated -fno-rtti -msse
OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
DEBUG_FLAGS = -g -ggdb3 -D_DeBuG
CPP = /cygdrive/h/cygwin/opt/crosstool/gcc-3.4.1-glibc-2.3.2/i686-unknown-linux-gnu/bin/i686-unknown-linux-gnu-gcc
#CPP = /opt/crosstool/gcc-3.4.1-glibc-2.3.2/i686-unknown-linux-gnu/bin/i686-unknown-linux-gnu-gcc

# the CPU target for the build, must be i486 for now
ARCH = i486
ARCH_BIN = .so


#####################################################################
# Obs/Cpps
#####################################################################

### EDIT BELOW FOR OTHER PROJECTS ###

ifeq "$(COMPILE_MM)" "false"
	BINARY = source_utils_$(ARCH)$(ARCH_BIN)
else
	BINARY = source_utils_mm_$(ARCH)$(ARCH_BIN)
	USER_CFLAGS +=-DSU_SOURCEMM
endif

OBJECTS = convar.cpp KeyValues.cpp utlbuffer.cpp bitbuf.cpp strtools.cpp \
MRecipientFilter.cpp \
serverplugin_convar.cpp serverplugin_sourceutils.cpp
#memoverride.cpp IceKey.cpp

#####################################################################
# Plugin Lib Includes
#####################################################################

#LINK_SO =-lm -ldl tier0_i486.so vstdlib_i486.so
#LINK_ASDK = mathlib_i486.a choreoobjects_i486.a tier1_i486.a
#LINK_ASU = libmysqlclient.a libz.a libmysys.a

# sqlite3.a 

#LINK = $(LINK_SO) $(LINK_ASDK) $(LINK_ASU)

LINK =-lm -ldl tier0_i486.so vstdlib_i486.so mathlib_i486.a choreoobjects_i486.a tier1_i486.a libmysqlclient.a libz.a libmysys.a

# $(Mail)/libjwsmtp.a libpthread.so dedicated_i486.so -lm -lpthread -ldl -static-libgcc

#####################################################################
# .h Files Folders Includes
#####################################################################

INCLUDE = -I. -I$(HL2PUB) -I$(HL2PUB)/dlls -I$(HL2PUB)/engine -I$(HL2PUB)tier0 -I$(HL2PUB)/tier1 \
-I$(HL2PUB)/vstdlib -I$(HL2SDK)/tier1  -I$(HL2SDK)/game_shared -I$(HL2SDK)/dlls \
-I$(SMM_ROOT) -I$(SMMH_ROOT) \
-I$(PLUGIN_DIR) -I$(MySQL) -I$(PLUGIN_DIR)/library/parser -I$(PLUGIN_DIR)/library/sqlite3 -I$(Mail)


#####################################################################
# Compile Part (Not Touch!!!)
#####################################################################

ifeq "$(DEBUG)" "true"
	BIN_DIR = Debug/Linux
	CFLAGS = $(DEBUG_FLAGS)
else
	BIN_DIR = Release/Linux
	CFLAGS = $(OPT_FLAGS) $(USER_CFLAGS) $(BASE_CFLAGS) $(ARCH_CFLAGS)
	#$(ARCH_CFLAGS)
endif

OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)

$(BIN_DIR)/%.o: %.cpp
	$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<

all:
	mkdir -p $(BIN_DIR)
	#ln -sf $(HL2SDK_TIER1)/interface.cpp interface.cpp
	ln -sf $(HL2SDK_TIER1)/convar.cpp convar.cpp
	ln -sf $(HL2SDK_TIER1)/KeyValues.cpp KeyValues.cpp
	ln -sf $(HL2SDK_TIER1)/utlbuffer.cpp utlbuffer.cpp
	ln -sf $(HL2SDK_TIER1)/bitbuf.cpp bitbuf.cpp
	ln -sf $(HL2SDK_TIER1)/strtools.cpp strtools.cpp
	ln -sf $(HL2PUB)/IceKey.cpp IceKey.cpp
	ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so
	ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so
	ln -sf $(SRCDS)/bin/libpthread.so libpthread.so
	ln -sf $(SRCDS)/bin/dedicated_i486.so dedicated_i486.so
	ln -sf $(HL2SDK_TIER0)/memoverride.cpp memoverride.cpp
	
	ln -sf $(HL2SDK)/linux_sdk/mathlib_i486.a mathlib_i486.a
	ln -sf $(HL2SDK)/linux_sdk/choreoobjects_i486.a choreoobjects_i486.a
	ln -sf $(HL2SDK)/linux_sdk/tier1_i486.a tier1_i486.a
	
	ln -sf $(MySQL)/libmysqlclient.a libmysqlclient.a
	ln -sf $(MySQL)/libz.a libz.a
	ln -sf $(MySQL)/libmysys.a libmysys.a
	ln -sf $(MySQL)/libmysys.a libmysys.a
	ln -sf $(PLUGIN_DIR)/library/sqlite3/sqlite3.a sqlite3.a
	$(MAKE) plugin
	cp $(PLUGIN_DIR)/Release/Linux/$(BINARY) $(PLUGIN_DIR)/cstrike/addons/source_utils/bin/$(BINARY)

plugin: $(OBJ_LINUX)
	$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
	
debug:	
	$(MAKE) all DEBUG=true

default: all

clean:
	rm -rf $(BIN_DIR)/*
i try very diferent things in makefile but crash in convars
sn4k3 is offline
Send a message via MSN to sn4k3
BAILOPAN
Join Date: Jan 2004
Old 03-12-2007 , 13:27   Re: Help with a plugin
Reply With Quote #5

Code:
OBJECTS = convar.cpp KeyValues.cpp utlbuffer.cpp bitbuf.cpp strtools.cpp
Code:
LINK =-lm -ldl tier0_i486.so vstdlib_i486.so mathlib_i486.a choreoobjects_i486.a tier1_i486.a libmysqlclient.a libz.a libmysys.a
Why are you including all these objects when you're also including tier1_i486.a? Remove all of the tier1 .cpp files and change your link line to:
Code:
LINK =-lm -ldl tier1_i486.a tier0_i486.so vstdlib_i486.so mathlib_i486.a choreoobjects_i486.a libmysqlclient.a libz.a libmysys.a
tier1_i486 must be first in the link list.
__________________
egg
BAILOPAN is offline
sn4k3
Senior Member
Join Date: Nov 2005
Old 03-12-2007 , 14:08   Re: Help with a plugin
Reply With Quote #6

Quote:
Originally Posted by BAILOPAN View Post
Code:
OBJECTS = convar.cpp KeyValues.cpp utlbuffer.cpp bitbuf.cpp strtools.cpp
Code:
LINK =-lm -ldl tier0_i486.so vstdlib_i486.so mathlib_i486.a choreoobjects_i486.a tier1_i486.a libmysqlclient.a libz.a libmysys.a
Why are you including all these objects when you're also including tier1_i486.a? Remove all of the tier1 .cpp files and change your link line to:
Code:
LINK =-lm -ldl tier1_i486.a tier0_i486.so vstdlib_i486.so mathlib_i486.a choreoobjects_i486.a libmysqlclient.a libz.a libmysys.a
tier1_i486 must be first in the link list.
Thanks

i do that because i see some makefiles include tier1 obejects and tier1 libs

i go try now

Last edited by sn4k3; 03-12-2007 at 14:17.
sn4k3 is offline
Send a message via MSN to sn4k3
sn4k3
Senior Member
Join Date: Nov 2005
Old 03-12-2007 , 14:33   Re: Help with a plugin
Reply With Quote #7

Thanks work perfectly now i have other problem

18:41:22 meta unload 2
18:41:22 Plugin 2 unloaded.
18:41:24 NOTA DO HLSW: Desconectado


Plugin crash on meta unload (linux) AND (Windows)


My unload block:

Code:
#ifdef SU_SOURCEMM
bool CSourceUtils::Unload(char *error, size_t maxlen)
{
#else
void CSourceUtils::Unload( void )
{
#endif
	gameeventmanager2->RemoveListener( this ); // make sure we are unloaded from the event system

//	CSU_Timer::FreeMemory();
	#ifdef SU_SOURCEMM
//	SH_REMOVE_HOOK_MEMFUNC(IGameEventManager2, FireEvent, gameeventmanager, &g_SourceUtils, &CSourceUtils::FireGameEvent, false);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, LevelInit, gamedll, &g_SourceUtils, &CSourceUtils::LevelInit, true);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, ServerActivate, gamedll, &g_SourceUtils, &CSourceUtils::ServerActivate, true);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, GameFrame, gamedll, &g_SourceUtils, &CSourceUtils::GameFrame, true);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, LevelShutdown, gamedll, &g_SourceUtils, &CSourceUtils::LevelShutdown, false);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientActive, serverclients, &g_SourceUtils, &CSourceUtils::ClientActive, true);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, serverclients, &g_SourceUtils, &CSourceUtils::ClientDisconnect, true);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientPutInServer, serverclients, &g_SourceUtils, &CSourceUtils::ClientPutInServer, true);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, SetCommandClient, serverclients, &g_SourceUtils, &CSourceUtils::SetCommandClient, true);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientSettingsChanged, serverclients, &g_SourceUtils, &CSourceUtils::ClientSettingsChanged, true);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientConnect, serverclients, &g_SourceUtils, &CSourceUtils::ClientConnect, false);
	SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientCommand, serverclients, &g_SourceUtils, &CSourceUtils::ClientCommand, false);

	SH_RELEASE_CALLCLASS(Engine_CC);
	return true;
#else
	return ;
#endif
}

Last edited by sn4k3; 03-12-2007 at 14:39.
sn4k3 is offline
Send a message via MSN to sn4k3
BAILOPAN
Join Date: Jan 2004
Old 03-12-2007 , 15:05   Re: Help with a plugin
Reply With Quote #8

Do you have a trace of the crash?
__________________
egg
BAILOPAN is offline
sn4k3
Senior Member
Join Date: Nov 2005
Old 03-12-2007 , 17:03   Re: Help with a plugin
Reply With Quote #9

Quote:
Originally Posted by BAILOPAN View Post
Do you have a trace of the crash?
no, server is not my

any thing to debug to HLSW?
sn4k3 is offline
Send a message via MSN to sn4k3
BAILOPAN
Join Date: Jan 2004
Old 03-13-2007 , 13:31   Re: Help with a plugin
Reply With Quote #10

If it's on Linux, tell them to do this in the shell and give you the core file that srcds generates:
Code:
ulimit -c unlimited
If it's on Windows, ask them to give you the .mdmp file.
__________________
egg
BAILOPAN 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 07:56.


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