PlayerPlaySound -
HUYA - 17.01.2013
hEY, i want do when i shot player and is hit him is do that sound
Код:
PlayerPlaySound(playerid, 1142, X, Y, Z);
Re: PlayerPlaySound -
dr.lozer - 17.01.2013
Use this
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
PlayerPlaySound(playerid, 1142, 0.0,0.0,0.0);
return 1;
}
if it dont works or if sound plays for other player then use this
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
PlayerPlaySound(issuerid, 1142, 0.0,0.0,0.0);
return 1;
}
Re: PlayerPlaySound -
HUYA - 18.01.2013
error
Код:
C:\Documents and Settings\CT\Desktop\HUYA TDM\pawno\new.pwn(83) : warning 235: public function lacks forward declaration (symbol "OnPlayerTakeDamage")
Re: PlayerPlaySound -
Glad2BeHere - 18.01.2013
what version of same are u using
https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage
https://sampwiki.blast.hk/wiki/PlayerPlaySound
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
new Float: X, Float:Y, Float:z;
GetPlayerPos(playerid, X,Y,Z);
PlayerPlaySound(playerid, 1142, X,Y,Z);
return 1;
}
Re: PlayerPlaySound -
Threshold - 18.01.2013
I really don't wanna do this but...
PlayerPlaySound uses X, Y and Z parameters, but when set to 0, they will just play for the player, rather than at his location as suggested in
https://sampwiki.blast.hk/wiki/PlayerPlaySound
* Threshold regrets everything.
xD
EDIT: @Below Post - Yes he means SA-MP. OnPlayerTakeDamage was added in 0.3d
Alternative is OnPlayerShootPlayer,
https://sampwiki.blast.hk/wiki/OnPlayerShootPlayer as suggested in this post somewhat down, maybe 2-3 posts. If you don't want to change functions, check if the issuerid is not invalid, then continue.
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID && issuerid != playerid) //playerid for bug fixes
{
PlayPlayerSound...
//code continues.
Re: PlayerPlaySound -
HUYA - 18.01.2013
"same" you mean samp?
Re: PlayerPlaySound -
martin3644 - 18.01.2013
Quote:
Originally Posted by HUYA
error
Код:
C:\Documents and Settings\CT\Desktop\HUYA TDM\pawno\new.pwn(83) : warning 235: public function lacks forward declaration (symbol "OnPlayerTakeDamage")
|
You need to forward onplayertakedemage.
On top, where you have all forwards put this:
pawn Код:
forward OnPlayerTakeDemage();
or this:
pawn Код:
forward OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid);
This should work.
When you get more errors then put these errors here. And the code, where is the error!
Re: PlayerPlaySound -
Norrin - 18.01.2013
1.) Update your server to 0.3e and use the OnPlayerTakeDamage callback.
OR
2.) Download the OPSP include and try this code:
pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
new Float: X, Float:Y, Float:Z;
GetPlayerPos(playerid, X,Y,Z);
PlayerPlaySound(playerid, 1142, X,Y,Z);
return 1;
}
Re: PlayerPlaySound -
Threshold - 18.01.2013
Which is already done in the latest a_samp include which comes with the latest server package:
http://www.sa-mp.com/download
So we'd recommend updating to the latest SA-MP Version if possible rather than tampering with the include or creating your own OnPlayerTakeDamage function.
Re: PlayerPlaySound -
RajatPawar - 18.01.2013
Quote:
Originally Posted by martin3644
You need to forward onplayertakedemage.
On top, where you have all forwards put this:
pawn Код:
forward OnPlayerTakeDemage();
or this:
pawn Код:
forward OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid);
This should work.
When you get more errors then put these errors here. And the code, where is the error!
|
No. OnPlayerTakeDamage is a function included in the SA-MP thingy, you do not need to forward it. Means either you are using an older version, most probably.