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

some more help :D


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ErUs
Junior Member
Join Date: Jun 2004
Old 11-12-2005 , 06:40   some more help :D
Reply With Quote #1

can someone post working examples of how to loop through all the indexes of all the players and send them a HUD message please?

i have been trying all morning

and i cant use IServerPluginHelpers anymore.
ErUs is offline
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 11-12-2005 , 08:32  
Reply With Quote #2

UserMessageBeing takes a parameter IRecipientFilter, in this, for single hud messages, im sure you have .AddPlayer(), im sure if you look through its methods there is one called AddAllPlayers too !
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
ErUs
Junior Member
Join Date: Jun 2004
Old 11-12-2005 , 09:17  
Reply With Quote #3

thanks, i now have:
Code:
void SamplePlugin::PrintToAll( char * text, bool big )
{

	CRecipientFilter *rpf = new CRecipientFilter();

	rpf->AddAllPlayers();

	bf_write *pWrite = m_Engine->UserMessageBegin( (IRecipientFilter*) rpf, 5 );
	pWrite->WriteByte( 4 ); // Centered TextMsg
    pWrite->WriteString(text); // Message
    m_Engine->MessageEnd();

	delete rpf;
}
i got four linker errors. i have managed to narrow this down to 2.
Quote:
sample_mm error LNK2019: unresolved external symbol "public: __thiscall CRecipientFilter::CRecipientFilter(void)" (??0CRecipientFilter@@QAE@XZ) referenced in function "public: void __thiscall SamplePlugin:rintToAll(char *,bool)" (?PrintToAll@SamplePlugin@@QAEXPAD_N@Z)
*and*
sample_mm error LNK2019: unresolved external symbol "public: void __thiscall CRecipientFilter::AddAllPlayers(void)" (?AddAllPlayers@CRecipientFilter@@QAEXXZ) referenced in function "public: void __thiscall SamplePlugin:rintToAll(char *,bool)" (?PrintToAll@SamplePlugin@@QAEXPAD_N@Z)
i tried just adding Recipientfilter.cpp into the project but i get 200 compile errors. any idea what todo?
ErUs is offline
devicenull
Veteran Member
Join Date: Mar 2004
Location: CT
Old 11-12-2005 , 10:27  
Reply With Quote #4

CRecipientFilter has a bunch of virtual stuff.. it has to be implemented. I've attached the class I use, which is MRecipientFilter. Use it instead.
Attached Files
File Type: h mrecpfilter.h (1.1 KB, 183 views)
File Type: cpp mrecpfilter.cpp (1.7 KB, 186 views)
__________________
Various bits of semi-useful code in a bunch of languages: http://code.devicenull.org/
devicenull is offline
BAILOPAN
Join Date: Jan 2004
Old 11-12-2005 , 14:03  
Reply With Quote #5

You can use IServerPluginHelpers if you make a dummy wrapper for the IServerPluginCallbacks class.
__________________
egg
BAILOPAN is offline
ErUs
Junior Member
Join Date: Jun 2004
Old 11-13-2005 , 13:51  
Reply With Quote #6

thanks devicenull, but how do i obtain an instance of IPlayerInfoManager and IServerPluginHelpers ?

im not sure how to use game server factory ( visual studio wont even tell me where its defined )
ErUs is offline
za_bullet
Junior Member
Join Date: Nov 2005
Old 11-23-2005 , 04:02  
Reply With Quote #7

No sure if you are STILL looking for an answer for this......

But on the Load event for you plugin it has the following parameters

Code:
::Load(	CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory )
You get all your interfaces from that.....

so for instance if you want IPlayerInfoManager you'd have

Code:
pim = (IPlayerInfoManager *)gameServerFactory(INTERFACEVERSION_PLAYERINFOMANAGER,NULL);

NOTE: Code examples kindly donated by Mattie [Credit where credit is due!]
za_bullet is offline
Send a message via AIM to za_bullet
za_bullet
Junior Member
Join Date: Nov 2005
Old 11-23-2005 , 08:14  
Reply With Quote #8

Slight correction for V1.1. It about the same except you'd get the Load event from ISmmPlugin Interface as such

Code:
virtual bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlength, bool late) =0;
Thus your code to get the interfaces you need is like this.

Code:
	m_ServerDll = (IServerGameDLL *)((ismm->serverFactory())(INTERFACEVERSION_SERVERGAMEDLL, NULL));
	m_Engine = (IVEngineServer *)((ismm->engineFactory())(INTERFACEVERSION_VENGINESERVER, NULL));

etc. etc.

Code taken from SamplePlugin.cpp
za_bullet is offline
Send a message via AIM to za_bullet
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 08:11.


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