Jump to content

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


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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.