Author | Message | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Checking for online player?
| Hi guys/girls,
|
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
|
Re: Checking for online player?
| didn't work :/.
|
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
|
Re: Checking for online player?
| perfect posted: (24th Oct 2015, 01:41 am) 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
|
Re: Checking for online player?
|
http://pastebin.com/PYMa44Zr
8 years, 27 weeks ago
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().
|
Re: Checking for online player?
| perfect posted: (24th Oct 2015, 06:32 am) 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
|
Re: Checking for online player?
| Marriage works fine. Basically what i wanted to do is add a second function to the priest.
|
Re: Checking for online player?
| perfect posted: (25th Oct 2015, 02:53 am) 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 |