View Full Version : gameeventmanager failing to create an event

11-05-2007, 03:40 AM
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:


And then creating the event this way:

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

pEvent->SetString("playername", pLocalPlayer->GetPlayerName());
pEvent->SetInt("flagid", m_captureFlagID);

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.

11-05-2007, 04:59 AM
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"...

11-05-2007, 05:13 AM
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?

11-05-2007, 05:39 AM
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.

11-05-2007, 06:07 AM
Thanks guys.

Time to look at the weapons code then :)

11-05-2007, 06:43 AM
Use commands to go from client -> server, as far as i am aware events dont work this way.