SA-MP Forums Archive
OnPlayerOnShoot. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerOnShoot. (/showthread.php?tid=276070)



OnPlayerOnShoot. - Darnell - 12.08.2011

I have this code :
pawn Код:
format(string,sizeof(string),"~n~~n~~w~You hit ~r~%s ~w~Damage:~r~ %i ~w~Weapon:~r~%s",TargetName,floatround(HealthLost+ArmourLost),wepname);
    GameTextForPlayer(Shooter,string,3000,5);
But it won't show how much damage I've done from far, anyway to do it ?


Re: OnPlayerOnShoot. - Darnell - 12.08.2011

Someone ?


Re: OnPlayerOnShoot. - Darnell - 12.08.2011

Bumping...
OFFTOPIC : How to stop PlayerPlaySound ? :\.


Re: OnPlayerOnShoot. - emokidx - 12.08.2011

Quote:

b) Do not bump
Some people apparently think they are important enough to bump their own topic after 10 minutes.
You can bump topics when the last reply is at least 48 hours old, and it needs to have useful information about your problem.

i dont know the first
to remove the sounds just delete the line which contains "PlayerPlaySound"


Re: OnPlayerOnShoot. - Snipa - 12.08.2011

pawn Код:
stock GetDistanceBetween(x1, y1, z1, x2, y2, z2)
{
    new float:dist;
    dist = floatsqroot(floatpower(floatsub(x2, x1), 2) + floatpower(floatsub( y2, y1), 2) + floatpower(floatsub( z2, z1), 2));
    return dist;
}



Re: OnPlayerOnShoot. - Darnell - 12.08.2011

Snipa, tell me how to use it... ?


Re: OnPlayerOnShoot. - Snipa - 12.08.2011

Place the stock outside any callback, preferably at the bottom.

Get each player's x, y, and z, then use the stock. It returns the distance.


Re: OnPlayerOnShoot. - Darnell - 12.08.2011

Uhm.
Will it tell me that If hit the player with a distance of a sniper rifle ?
EDIT:
I think you got me wrong.
pawn Код:
new TargetName[MAX_PLAYER_NAME];
    new ShooterName[MAX_PLAYER_NAME];
    GetPlayerName(Target,TargetName,MAX_PLAYER_NAME);
    GetPlayerName(Shooter,ShooterName,MAX_PLAYER_NAME);
    new gun=GetPlayerWeapon(Shooter);
    new string[128];
    new wepname[30];
    GetWeaponName(gun,wepname,sizeof(wepname));
    format(string,sizeof(string),"~n~~n~~w~You hit ~r~%s ~w~Damage:~r~ %i ~w~Weapon:~r~%s",TargetName,floatround(HealthLost+ArmourLost),wepname);
    GameTextForPlayer(Shooter,string,3000,5);
    format(string,sizeof(string),"~n~~n~~w~You got hit by ~r~%s ~w~Damage:~r~ %i ~w~Weapon:~r~%s",ShooterName,floatround(HealthLost+ArmourLost),wepname);
    GameTextForPlayer(Target,string,3000,5);
This is the code, It tells me that I hit the player, but when I use a sniper rifle, it doesn't show me the damage, because it's too far, I guess.


Re: OnPlayerOnShoot. - Snipa - 12.08.2011

Oh, I thought you wanted to find the distance between the shooters, my bad.

So it doesn't show the damage when you shoot with a sniper?


Re: OnPlayerOnShoot. - Darnell - 12.08.2011

I shot my friend from far, it didn't tell me how much damage I did, mind testing it with me on my homehost server ?