Quote:
Originally Posted by cstrike37
i got this
Code:
public DeathMsg()
{
new kid = read_data(1)
new vid = read_data(2)
if( kid == vid )
return PLUGIN_CONTINUE;
if( !g_bIsVip[ vid ] )
return PLUGIN_CONTINUE;
new pnum, players[32]
get_players( players, pnum )
for( new i, tid; i < pnum; i++ )
{
tid = players[i]
client_cmd(tid, "spk %s", die_spk[ random( 2 ) ]);
}
return PLUGIN_CONTINUE;
}
But the sound wont play when the player kills himself. It only plays when you got killed by a gun or from a fall
|
did you try to understand that code at all?
if(kid == vid) return PLUGIN_CONTINUE returns out of the function if the player killed himself. -if killer equals victim
Or search past that one bit of code?
1. These variable names are worse than MINE! -And that's saying something. (vid, kid, tid) how about victimID, killerID, tempID?
2. It includes things you don't need (or mentioned nothing of)
g_bIsVip[vid]
3. If you're only indexing the players array once (to get the tempID) You don't need to store it in a variable. Just directly call
players[i] but this is only true if you call it once. otherwise cache it as you have here.
__________________