Forum
Loading Music - Printable Version

+- Forum (https://dm20.net/forum)
+-- Forum: Scripting (https://dm20.net/forum/forumdisplay.php?fid=5)
+--- Forum: Showcase (https://dm20.net/forum/forumdisplay.php?fid=6)
+--- Thread: Loading Music (/showthread.php?tid=13)



Loading Music - marcudaniel1337 - 07-29-2024

This is a simple plugin that plays music while the screen is loading and then stops when the player joins the server. You can replace the file needed for download.

Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Music"
#define VERSION "1.0"
#define AUTHOR "sToP !"


public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    return PLUGIN_CONTINUE
}

public plugin_precache()
{
    precache_generic("media/Half-Life16.mp3")
    return PLUGIN_CONTINUE
}

public client_connect(id)
{
    client_cmd(id,"mp3 play media/Half-Life16.mp3")
    return PLUGIN_CONTINUE
}

public client_putinserver(id)
{
    set_task(5.0, "stop_song", id)
    return PLUGIN_CONTINUE
}

public stop_song(id)
{
    client_cmd(id,"mp3 stop")
    return PLUGIN_HANDLED
}