Jump to content

Need help to play a sound when they check there mail in RPG game


Mordom

Recommended Posts

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.  :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.