Group server code
I am working with the source and I am having an issue with finding out if two players are grouped. If anyone could point me in the right direction, I would be thankful.
What I am trying to do is find out if client 1's group is the same as clients 2's group, or if client 1 (or 2) is not in a group. Here is what I have atm, that does not work. int c1_group = c1->GetGroup()->GetID(); // Client 1's group int c2_group = c2->GetGroup()->GetID(); // Client 2's group ((c1_group != c2_group) || (c1_group == 0) || (c2_group == 0)) // clients grouped? Can anyone point out to me what is wrong? Thanks! |
If either client is not in a group, that code will cause a crash because GetGroup() will return a NULL pointer.
This should work: Code:
Group *g1 = c1->GetGroup(); |
Thank you! That worked.
I had actually been struggling with that for some time now, haha. |
All times are GMT -4. The time now is 03:40 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.