Mordom Posted October 28, 2010 Share Posted October 28, 2010 Hi im working on a RPG game. I have this code for the mailbox in the game. // Before allowing anything else, we make sure the person is actually in town. global $townrow; if ($townrow == false) { die(header("Location: index.php")); } function mailbox() { global $userrow; $messages = dorow(doquery("SELECT *, DATE_FORMAT(postdate, '%m.%d.%Y ~ %H:%i') AS fpostdate FROM <<messages>> WHERE recipientid='".$userrow["id"]."' ORDER BY postdate DESC"), "id"); $row["messages"] = "<table width=\"97%\">\n"; if ($messages == false) { $row["messages"] .= "<tr><td>You do not have any messages.</td></tr>"; } else { foreach($messages as $a=>$b) { if ($b["status"] == 0) { $b["new"] = "<span class=\"red\">*</span>"; } else { $b["new"] = ""; } if ($b["gold"] != 0) { $b["money"] = "<span class=\"blue\">\$</span>"; } else { $b["money"] = ""; } $row["messages"] .= parsetemplate(gettemplate("mailbox_listrow"), $b); } } $row["messages"] .= "</table><br />\n"; display("Post Office", parsetemplate(gettemplate("mailbox_list"), $row)); } I made a sound.php file with <?php $link = "http://www.example.com/example.mp3"; $audio = "<embed src='".$link."'>"; echo $audio; ?> I need it to play a mp3 file when they get new mail. I tried if ($b["status"] == 0) { $b["new"] = "<span class=\"red\">*</span>"; } else { $b["new"] = ""; } else {$audio = "src='"$link";} Im really new to this so some help would be very appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/217074-need-help-to-play-a-sound-when-they-check-there-mail-in-rpg-game/ Share on other sites More sharing options...
Mordom Posted October 28, 2010 Author Share Posted October 28, 2010 I was doing some thinking. I guess I would need to make a table to play a sound then call on it that way. Im just not to sure how I would go to do that just yet. I will keep @ it and hope i get it soon. :-\ Quote Link to comment https://forums.phpfreaks.com/topic/217074-need-help-to-play-a-sound-when-they-check-there-mail-in-rpg-game/#findComment-1127593 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.