float player_getspecies()
{
local float glob, i, j, fh, len, s, sk;
- local string fn, l;
+ local string fn, l, file;
+ local float tokens;
+
+ file = strcat(substring(self.model, 0, -5), ftos(self.skinindex)); // remove the extension at the end
+ PrecachePlayerSounds(file);
+ UpdatePlayerSounds(file);
s = -1;
if(sk == (j ? 0 : self.skinindex)) // 2nd pass skips the skin test
if(fgets(fh) == self.model)
{
+ tokens = tokenizebyseparator(fn, ".");
+
l = fgets(fh);
len = tokenize_console(l);
if (len != 2)
}
.float modelindex_for_playersound;
-void UpdatePlayerSounds()
+void UpdatePlayerSounds(string filename)
{
if(self.modelindex == self.modelindex_for_playersound)
return;
self.modelindex_for_playersound = self.modelindex;
ClearPlayerSounds();
LoadPlayerSounds("sound/player/default.sounds", 1);
- LoadPlayerSounds(strcat(self.model, ".sounds"), 0);
+ if(filename != "")
+ LoadPlayerSounds(strcat(filename, ".sounds"), 0);
+ else
+ LoadPlayerSounds(strcat(self.model, ".sounds"), 0); // backwards compatibility
}
void FakeGlobalSound(string sample, float chan, float voicetype)