Go Back   Steam Users' Forums > Steam Tool Discussions > Source Coding

Reply
 
Thread Tools Display Modes
Old 11-05-2007, 02:40 AM   #1
jhyap
 
 
 
Guest
Posts: n/a
gameeventmanager failing to create an event

Hi I am creating an event from the client side and sending it to the server side

I have loaded the resource file which defines the event:

Code:
gameeventmanager->LoadEventsFromFile("resource/modevents.res");
And then creating the event this way:

Code:
IGameEvent* pEvent = gameeventmanager->CreateEvent("flag_capture");

if(pEvent)
{
	pEvent->SetString("playername", pLocalPlayer->GetPlayerName());
	pEvent->SetInt("flagid", m_captureFlagID);
	gameeventmanager->FireEvent(pEvent);
}
But the pEvent pointer is always NULL when I check in the debugger. Why is the gameeventmanager not being able to create the event? Any ideas.

While creating another event which is again defined in the same modevents.res file the event is created and I am able to fire the event.

Thanks. Any help is appreciated very much.
 
Reply With Quote
Old 11-05-2007, 03:59 AM   #2
Marine
 
Join Date: Sep 2006
Reputation: 9
Posts: 2,691
Oh dear, no no no :P

Don't send events from client > Server. Always let the server control scoring stuff, and important events. Otherwise an unscruplious user could just edit his game and send data saying "I've captured a, b and c flags"...
Marine is offline   Reply With Quote
Old 11-05-2007, 04:13 AM   #3
jhyap
 
 
 
Guest
Posts: n/a
Hi Marineio,

Thanks for the reply.

But actually I don't understand your point. I understand that the logic about whether to let the player capture the flag or not should reside on the server.

So what I do is when a player is in proximity of the flag and based on some other logic I send the message to the player that he can now capture the flag. This information is imparted to the player via my custom HUD.

Now the player can initiate the capture by pressing a key. This is actually what I want and the above is the code for this. I want to pass the info from the client to the server that the player has initiated the capture. So what's wrong with that?

Or do you mean to say that I should poll for each player from the server that the player has set it's flag capturing bit or not? In fact sending a message from player (client) to the server about flag capture should be better than a polling on each player.

Can you please explain?

Last edited by jhyap: 11-05-2007 at 04:17 AM.
  Reply With Quote
Old 11-05-2007, 04:39 AM   #4
lodle
 
Join Date: Mar 2006
Reputation: 36
Posts: 1,715
What should happen is that you have the code for this on the server and client. This way the client doesnt have to wait to do any thing (cause it all ready knows the rules) and the server will properly calculate it as well when it gets the users key press in the update.

Much like how weapons work atm.
lodle is offline   Reply With Quote
Old 11-05-2007, 05:07 AM   #5
jhyap
 
 
 
Guest
Posts: n/a
Thanks guys.

Time to look at the weapons code then
  Reply With Quote
Old 11-05-2007, 05:43 AM   #6
Marine
 
Join Date: Sep 2006
Reputation: 9
Posts: 2,691
Use commands to go from client -> server, as far as i am aware events dont work this way.
Marine is offline   Reply With Quote
Reply

Go Back   Steam Users' Forums > Steam Tool Discussions > Source Coding


Thread Tools
Display Modes

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



All times are GMT -7. The time now is 12:48 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Site Content Copyright Valve Corporation 1998-2012, All Rights Reserved.