Development > Coding and development discussion

help with org name from player id

(1/1)

clashbot:
working on coding a module to relay alliance members online to a webserver, and have a slight issue with dealing with members that are in the pg. sample of the code is as follows:

--- Code: ---if ($this -> bot -> core("notify") -> check($name))
{
$botname = $this -> bot -> botname;
$online = $this -> bot -> db -> select("SELECT t1.nickname, t2.level, org_rank, org_name, profession FROM "
. "#___online AS t1 LEFT JOIN #___whois AS t2 ON t1.nickname = t2.nickname WHERE status_gc=1 "
. "AND botname='".$botname."' ORDER BY profession ASC, t1.nickname ASC");

foreach ($online as $player)
{
$alname .= "|" . $player[0];
$allevel .= "|" . $player[1];
$alprof .= "|" . $player[4];
$alorg .= "|" . $this -> bot -> guildname;
$alrank .= "|" . $player[2];
}

--- End code ---

my problem is if the player is in the pg, it is reading their rank and applying it to the guildname of the bot. Of course this doesn't work if the bot in question is a raid bot, as there is no guildid. Is there a way of getting the guild information out of the player itself and what would that be?

Alreadythere:
Isn't there the guildname/org_name in the whois table too?

clashbot:
yes there is alreadythere, unfortunately, I can only mess up code. I am not sure how I would go about implimenting it into my example above. I thought there might be something attached to the $player[#] tage and that maybe [3] would be what I need. After looking through the files to figure out where that was from,  and coming up empty, I'm no better off than when I started, which is why I am here. I am still learning php and sql hooks and can say most of my courseload has been doing the bots.

Alreadythere:
It should be [3] according to your query, yes. If it's empty then it's most likely empty on the table too.

clashbot:
still have one org that isn't showing up and not sure why on that...will work it out later, for the most part it should be working now

Navigation

[0] Message Index

Go to full version