SA-MP Forums Archive
Hitsound activate with command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Hitsound activate with command (/showthread.php?tid=498029)



Hitsound activate with command - Blackazur - 01.03.2014

Hello, how can i make that the hitsound comes when i shoot someone or hurt someone, because that dont work?

Код:
CMD:hitsound(playerid)
{
   PlayerPlaySound(playerid,17802,0.0,0.0,0.0);
   SendClientMessage(playerid,-1,""chat""COL_GREEN" Hit Sound Activated!");
}

CMD:stophitsound(playerid)
{
   PlayerPlaySound(playerid,1184,0.0,0.0,0.0);
   SendClientMessage(playerid,-1,""chat""COL_GREEN" Hit Sound Deactivated!");
}



Re: Hitsound activate with command - M3HR4N - 01.03.2014

first add this :
pawn Код:
new HitSound[MAX_PLAYERS];
second use this under OnPlayerConnect if you want when player connects it don't work :
pawn Код:
HitSound[playerid] = 0;
third use this code under OnPlayerTakeDamage :
pawn Код:
if(HitSound[issuerid] == 1)
    {
    PlayerPlaySound(issuerid,17802,0.0,0.0,0.0);
    }
then add the commands :
pawn Код:
CMD:hitsound(playerid)
{
   HitSound[playerid] = 1;
   SendClientMessage(playerid,-1,""chat""COL_GREEN" Hit Sound Activated!");
}

CMD:stophitsound(playerid)
{
   HitSound[playerid] = 0;
   SendClientMessage(playerid,-1,""chat""COL_GREEN" Hit Sound Deactivated!");
}



Re: Hitsound activate with command - ReD_HunTeR - 01.03.2014

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
    PlayerPlaySound(playerid, 1184, 0.0, 0.0, 0.0);
    return 1;
}