From 7bd8183936b5f01ef789822d1f114e85ac391d47 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 26 Sep 2020 10:39:17 -0300 Subject: changeplayermusic() script function required for clientdata!174 Tested in Moubootaur Legends --- src/emap/script_buildins.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/emap/script_buildins.c') diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c index 85e81b2..263e3a6 100644 --- a/src/emap/script_buildins.c +++ b/src/emap/script_buildins.c @@ -921,6 +921,30 @@ BUILDIN(changeMusic) return true; } +// changePlayerMusic(music) +BUILDIN(changePlayerMusic) +{ + const char *const music = script_getstr(st, 2); + if (!music) + { + ShowWarning("invalid music file\n"); + script->reportsrc(st); + return false; + } + + struct map_session_data *sd = NULL; + sd = script->rid2sd(st); + if (sd == NULL) + { + ShowWarning("player not attached\n"); + script->reportsrc(st); + return false; + } + + send_changemusic(sd->fd, music); + return true; +} + BUILDIN(setNpcDialogTitle) { const char *const name = script_getstr(st, 2); -- cgit v1.2.3-70-g09d2