|
|
#1 |
|
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");
Code:
IGameEvent* pEvent = gameeventmanager->CreateEvent("flag_capture");
if(pEvent)
{
pEvent->SetString("playername", pLocalPlayer->GetPlayerName());
pEvent->SetInt("flagid", m_captureFlagID);
gameeventmanager->FireEvent(pEvent);
}
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. |
|
|
|
#2 |
![]() 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"... |
|
|
|
|
|
#3 |
|
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. |
|
|
|
#4 |
![]() 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. |
|
|
|
|
|
#5 |
|
Guest
Posts: n/a
|
Thanks guys.
Time to look at the weapons code then
|
|
|
|
#6 |
![]() 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.
|
|
|
|
![]() |
|
||||||
| Thread Tools | |
| Display Modes | |
|
|