IGameEventManager2      m_GameEventManager = NULL;

// ---- //

IGameEvent *event = m_GameEventManager->CreateEvent( "player_chat", true );
if ( event )
{
        event->SetBool ( "teamonly", true );
        event->SetInt( "userid", 0 );
        event->SetString ( "text", "Blah blah blah" );
        m_GameEventManager->FireEvent( event );
}

=)

And yes, use Source:MetaMod anyway, you don't require it but it will make
your life a heck of a lot easier later. Trust me on that one.

You don't want to make a fantastic plugin only to find out later it can't be
run at the same time as Mani or something else popular do you?


- c0ld

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:hlcoders-
> [EMAIL PROTECTED] On Behalf Of Paul Kirby
> Sent: 07 April 2006 17:33
> To: [email protected]
> Subject: [hlcoders] FireEvent help?
>
> Hello All
>
> I am trying to fire an event within a Source Server Plug-in.
>
> In GameEvents.res there is the following:
>
> "player_chat"                   // a public player chat
> {
>   "teamonly"    "bool"          // true if team only chat
>   "userid"      "short"         // chatting player
>   "text"        "string"        // chat text
> }
>
> [code]
> CON_COMMAND_F( say_new, "Test, Console say.", FCVAR_GAMEDLL)
> {
>   KeyValues * force_event;
>   force_event = new KeyValues( "player_chat" );
>   force_event->SetInt("teamonly", true );
> /* Using 0 for userid so that it says its from the console */
>   force_event->SetInt("userid", 0 );
>   force_event->SetString("text","Blah blah blah");
>   gameeventmanager->FireEvent( force_event );
> }
> [end of code]
>
> This don't seem to want to work.
>
> Please don't say try using Source: Metamod ,due to I don't want it to use
> that.
>
> I gather that I am correct in using FireEvents(), or am I suppose to use
> FireEventClientOnly() or FireEventServerOnly() ?
>
> I want all players to see this message, and it has to be a chat message.
>
> Thanks in advance
>
> Paul
>
>
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to