AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Coding MM:S Plugins & SM Extensions (https://forums.alliedmods.net/forumdisplay.php?f=75)
-   -   MRecipient Filter for CS:GO (https://forums.alliedmods.net/showthread.php?t=194160)

Old and Slow 08-25-2012 19:28

MRecipient Filter for CS:GO
 
Trying to port a MetaMod:Source plugin from CS:S to CS:GO. Seems like there are changes to the interface that is used by the old MRecipient Filter.

Does anyone have an updated one working for CS:GO? I looked but didn't find answers to all the questions.

Thanks.

Ajaxx 08-25-2012 23:29

Re: MRecipient Filter for CS:GO
 
What error are you receiving? Don’t know if you saw earlier but in MRecipientFilter.cpp I was having a problem with
Code:

edict_t *pPlayer = engine->PEntityOfEntIndex(i)
asherkin suggested I replace with
Code:

edict_t* pPlayer = (edict_t *)(gpGlobals->pEdicts + i)
that worked for me.

Old and Slow 08-26-2012 05:32

Re: MRecipient Filter for CS:GO
 
Code:

make -f Makefile dmg_mm
MRecipientFilter.cpp: In member function virtual int MRecipientFilter::GetRecipientCount() const:
MRecipientFilter.cpp:17: error: const class CUtlVector<int, CUtlMemory<int, int> > has no member named Size
MRecipientFilter.cpp: In member function void MRecipientFilter::AddAllPlayers():
MRecipientFilter.cpp:37: error: class IVEngineServer has no member named PEntityOfEntIndex
MRecipientFilter.cpp: In member function void MRecipientFilter::AddRecipient(int):
MRecipientFilter.cpp:57: error: class IVEngineServer has no member named PEntityOfEntIndex
make[1]: *** [Debug.csgo/MRecipientFilter.o] Error 1
make: *** [all] Error 2

Your fix should take care of the last 2. Not sure about the "Size" one - I didn't see any differences in public/irecipientfilter.h and this compiled using the CSS HL2SDK...

Also, how did you resolve the "Say" message? It appears that engine->UserMesageBegin() has changed. Did its use change as well?

I used this:

Code:

void DmgPlugin::SayText (                      //say text to individual player
    int        aIndex,                        //player index, 1::max
    const char  *aSzMsg)                        //message
{
    char *message = NULL;
    message = (char*) malloc(strlen(aSzMsg)+4);
    sprintf(message, "%s \n", aSzMsg);

    MRecipientFilter mrf;
    mrf.AddRecipient(aIndex);
    int msg_type = 3;                          //SayText
    bf_write *msg = engine->UserMessageBegin((IRecipientFilter *)&mrf, msg_type);

    msg->WriteByte(aIndex);
    msg->WriteString(message);
    msg->WriteByte(0);
    engine->MessageEnd();
    free(message);
}

Is it still valid?

Thanks for your help.

Old and Slow 08-26-2012 05:41

Re: MRecipient Filter for CS:GO
 
Quote:

Not sure about the "Size" one - I didn't see any differences in public/irecipientfilter.h and this compiled using the CSS HL2SDK...
Looks like there was a warning not to use Size() because it was depricated in the CSS version - in public/tier1/utlvector.h

So, that's fixed by using Count() instead.

Old and Slow 08-26-2012 17:20

Re: MRecipient Filter for CS:GO
 
OK, I looked in the source for SourceMod - UserMessages.cpp and found the correct call for UserMessageBegin(). Looks like the plug-in is sending out "say" commands as it should.


All times are GMT -4. The time now is 00:03.

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