EOSERV Forum > EOSERV > Checking for online player?
Page: << 1 >>
Checking for online player?
Author Message
Post #198597 Checking for online player?

Hi guys/girls,

Just wondering how id go about pulling the partner name from the DB then checking if that character is online.

Cant seem to get it right lol.

8 years, 27 weeks ago
Post #198601 Re: Checking for online player?

I mean, if the player whose partner you're checking is online, you can just do a uh..

Character *partner = GetCharacter(character->partner) 

followed by a.. 

if (partner)

right?

---
Want to learn to pixel?
Pixelsource.org
8 years, 27 weeks ago
Post #198660 Re: Checking for online player?

didn't work :/.

Guess ill continue looking for a solution.

8 years, 27 weeks ago
Post #198662 Re: Checking for online player?

Not sure why cirras's answer didn't work ;o The only other thing I can think of doing is pretty much the same as what he said but like this:

UTIL_FOREACH(world->characters, w_character)

{

if(w_character->name == character->partner)

{

//chars online ;o?

}

}

just typed this on here so it may need some tweaking.. But again this is just a different method of what cirras posted ;o

8 years, 27 weeks ago
Post #198669 Re: Checking for online player?
perfect posted: (24th Oct 2015, 01:41 am)

didn't work :/.

Guess ill continue looking for a solution.


Can you provide us with a snippet of your code so we can see what you're trying to do?
---
Want to learn to pixel?
Pixelsource.org
8 years, 27 weeks ago
Post #198671 Re: Checking for online player?
http://pastebin.com/PYMa44Zr

Where it's commented //here

i would like to pull the partner name and check if that player is online or not.  checking if the player is online is pretty much the only thing i can't figure out. LOL

note: this is from priest.cpp inside PRIEST_OPEN().
8 years, 27 weeks ago
Post #198678 Re: Checking for online player?
perfect posted: (24th Oct 2015, 06:32 am)

http://pastebin.com/PYMa44Zr

Where it's commented //here

i would like to pull the partner name and check if that player is online or not.  checking if the player is online is pretty much the only thing i can't figure out. LOL

note: this is from priest.cpp inside PRIEST_OPEN().

http://pastebin.com/HW181HD2


3 things. 

1.) You were only calling this check if the character's PARTNER wasn't empty - But if they're trying to get married, of course it's empty. I don't know if you were also wanting to do a check for if they had a partner already, but you want to separate rather than combine those checks, because that qualifier was breaking any check you tried to do - I assume you were trying to check for the fiance and not for the partner? The only thing one can really do after you're married is get divorced, and that's Law rather than Priest.

2.) The if (!character->fiance.empty()) check is redundant in the first place because GetCharacter() should accept the empty string anyway and tell you it's not a character, same as if you'd given it the name of an offline character. Just put the if (character->fiance.empty()) check before that one and you won't need that line.

3.) My example *should* work, I believe, but it might need a smidge of tinkering because modern EOSERV syntax is a little different from what I usually work with.

---
Want to learn to pixel?
Pixelsource.org
8 years, 26 weeks ago
Post #198688 Re: Checking for online player?

Marriage works fine.  Basically what i wanted to do is add a second function to the priest.

So if when the player clicks on the priest and the check confirms that person already has a partner, it'll do the second function as opposed to another marriage.

If that person doesnt have a partner, then continue with the normal marriage functions.

Anyways you're code worked!  thanks a lot !!:)


-Fixed-

8 years, 26 weeks ago
Post #198689 Re: Checking for online player?
perfect posted: (25th Oct 2015, 02:53 am)

Marriage works fine.  Basically what i wanted to do is add a second function to the priest.

So if when the player clicks on the priest and the check confirms that person already has a partner, it'll do the second function as opposed to another marriage.

If that person doesnt have a partner, then continue with the normal marriage functions.

Anyways you're code worked!  thanks a lot !!:)


-Fixed-


Ah, good to hear. It's no trouble, it's nice to get the chance to help out a bit.
---
Want to learn to pixel?
Pixelsource.org
8 years, 26 weeks ago
Page: << 1 >>

EOSERV Forum > EOSERV > Checking for online player?