|
2 registered members (AndrewAMD, TipmyPip),
747
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Even_data question
[Re: Beker]
#316976
03/28/10 11:27
03/28/10 11:27
|
Joined: May 2009
Posts: 445 Peine, Germany
Razoron
Senior Member
|
Senior Member
Joined: May 2009
Posts: 445
Peine, Germany
|
I don't know if this works, but maybe like this:
typedef struct MYDATA1 {
int x;
char c[20];
} MYDATA;
typedef struct MYDATA2 {
int x;
int y;
char c[20];
} MYDATA2;
...
MYDATA1* mydata1 = { x = 1; c = "Test!"; }
MYDAT21* mydata2 = { x = 1; y = 1; c = "Test!"; }
// sending data
send_data_to(NULL,mydata,sizeof(MYDATA1));
//receiving data
function on_client_event(void* buffer)
{
if (event_type == EVENT_DATA)
if(sizeof(buffer)==sizeof(MYDATA1))
....
if(sizeof(buffer)==sizeof(MYDATA2))
....
}
Last edited by Razoron; 03/28/10 11:28.
|
|
|
Re: Even_data question
[Re: Beker]
#320379
04/21/10 12:22
04/21/10 12:22
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
Serious User
|
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
You could use ANet for this. If you send a struct with ANet, it is automatically updated on the receiver. If you want to see if the struct has changed, just send an event after you updated the struct or you could save the content of the struct and check if the content has changed. Visit: http://www.anet-plugin.com for further informations. The Manual should give you an idea of how a struct can be sent (enet_send_data() is the function you are looking for).
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
|
|
|