Reproduce sound every third murder.
Here there is a plugin (I wrote myself) it reproduces sounds: multikill, megakill and other.
For example: I killed 3 players and play sound multikill. I killed 3 more players and play sound megakill. I killed 3 more players and play sound ultrakill. I killed 3 more players and play sound godlike. But the problem is that if I killed 3 players, and then a further 3 plays sound godlike. ie passes 2 audio, megakill and ultrakill. What's the problem? Code:
#include <amxmodx> |
Re: Reproduce sound every third murder.
There's a few things i have to say.
1. new g_streakKills[33][1] :arrow: new g_streakKills[33] Its a simple array, you don't need to say it only has one row; that is implied when created. And confused me a bit when i first read it. 2. all your sounds need to be precached and have a filetype extension (.wav .mp3 etc) 3. sounds need to be in the sounds folder. not misc (i'm pretty sure) -correct me if i'm wrong 4. There's a better way to do the check. Here it is... Code:
new headshot = (hitplace == HIT_HEAD) ? 1 : 0;PHP Code:
6. You should also declare g_sounds as const new const g_sounds[][] = { Its just good habbit, because that never changes. But I'd suggest putting the entire file path into those strings just to make things a bit easier. (i.e. "sounds/multikill.wav", ) That way you can loop through g_sounds in plugin_precache and not need to add anything. Nor will you need to add anything later. All speeding up your code. |
Re: Reproduce sound every third murder.
The best code will be like this?
Code:
#include <cstrike>For example: I killed 2 players - no sound. I Killed 3 - there was a sound (multikill). Following the sound, kill 3 more - 2 sound (megakill). |
Re: Reproduce sound every third murder.
I'd say so. but you still need to prechace all the sound files and give them a file extension. see #2. 3. 6
EDIT: and i'm not sure the efficiency of client_death versus event_death But that isn't much of a problem to be honest....unless you really want to make the best code possible. |
Re: Reproduce sound every third murder.
Quote:
The "misc/" folder in front will transform to "sound/misc/" for both precache and the "spk" command, so you don't need to put it there. Quote:
This is the valid way: PHP Code:
Quote:
PHP Code:
Quote:
|
Re: Reproduce sound every third murder.
Code:
//AMXXPC compile.exe |
Re: Reproduce sound every third murder.
Quote:
As for the implication of sound.....lol, forgot that too. I've been told that before. I just never remember. -_- Quote:
PHP Code:
Code:
|
Re: Reproduce sound every third murder.
The problem is, that does not play the first sound (multikill)
3 / 3 = 1 May need to take away from g_streakKills[killer] - 3? For example: Quote:
Quote:
Just killed += 1 But the problem is that if a player kills 2 times in the head, no sound. For example: Quote:
|
Re: Reproduce sound every third murder.
Try this:
PHP Code:
|
Re: Reproduce sound every third murder.
Quote:
I apologize, Sutar, you were -mostly- right all along. Just needed a few tweaks. Aren't we lucky to have such a smart guy like Exolent around to correct me when i'm being a dumbass? rukia |
| All times are GMT -4. The time now is 05:52. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.