Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got game invite function #1

Open
Hansbald opened this issue Jul 2, 2014 · 7 comments
Open

Got game invite function #1

Hansbald opened this issue Jul 2, 2014 · 7 comments

Comments

@Hansbald
Copy link

@Hansbald Hansbald commented Jul 2, 2014

I can't seem to be able to find a function that executes when you recieve a game invite

@VoiDeD
Copy link
Member

@VoiDeD VoiDeD commented Jul 2, 2014

I believe game invites are sent as chat messages, but as EChatEntryType.k_EChatEntryTypeInviteGame.

So you just need to listen for the FriendChatMsg_t callback and check for that chat entry type.

@Hansbald
Copy link
Author

@Hansbald Hansbald commented Jul 2, 2014

Ok but how I only see methods and no events that get trigert am I just stupid?

@VoiDeD
Copy link
Member

@VoiDeD VoiDeD commented Jul 2, 2014

See https://github.com/SteamRE/Steam4NET/blob/master/Steam4Test/Program.cs#L191 for how callbacks are handled. You'd want to be checking for FriendChatMsg_t.k_iCallback.

@Hansbald
Copy link
Author

@Hansbald Hansbald commented Jul 2, 2014

I already looked at that code but I think I miss something obvious:
while (Steamworks.GetCallback(pipe, ref callbackMsg)
This line starts a loop for the time Steamworks calls the API giving the output to the callbackMsg variable

Then I need to check if callbackMsg is EChatEntryType.k_EChatEntryTypeInviteGame

but callbackMsg is int and EChatEntryType.k_EChatEntryTypeInviteGame is somethinh different?!

(Also how do I mark code like you did?)

@VoiDeD
Copy link
Member

@VoiDeD VoiDeD commented Jul 2, 2014

You need to convert callbackMsg.m_pubParam to FriendChatMsg_t, then you can check that object's m_eChatEntryType

@Hansbald
Copy link
Author

@Hansbald Hansbald commented Jul 2, 2014

I did that:
FriendChatMsg_t friendStatMsg = (FriendChatMsg_t)Marshal.PtrToStructure(callbackMsg.m_pubParam, typeof(FriendChatMsg_t));

However

friendStatMsg.m_eChatEntryType.Equals(EChatEntryType.k_EChatEntryTypeInviteGame)
and
friendStatMsg.m_eChatEntryType == EChatEntryType.k_EChatEntryTypeInviteGame

Don't do anything at all

I also tried
friendStatMsg.m_eChatEntryType.GetTypeCode

@Hansbald
Copy link
Author

@Hansbald Hansbald commented Jul 5, 2014

I tried everything I can think of now - nothing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.