Detect Damage - 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: Detect Damage (
/showthread.php?tid=451371)
Detect Damage -
Blackazur - 16.07.2013
Hello, how to make that you see the Damage when you shoot an player as a gametext for example: "DAMAGE GIVEN: DAMAGE"?
Re: Detect Damage -
Twizted - 16.07.2013
https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage
AW: Detect Damage -
Blackazur - 17.07.2013
Yeah but how to put it then in the gametext like "DAMAGE GIVEN: DAMAGE"
Re: Detect Damage -
jamesbond007 - 17.07.2013
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
new str[128];
format(str,sizeof(str),"%.2f", amount);
GameTextForPlayer(playerid,str, 5, 1000);
}
AW: Detect Damage -
Blackazur - 17.07.2013
This dont work, know everyone an other solution or should i use for that OnPlayerGiveDamage?
Re: Detect Damage -
Bakr - 17.07.2013
What about it doesn't work? The code jamesbond007 posted looks perfectly fine to me.
AW: Detect Damage -
Blackazur - 17.07.2013
But will it send that to the ID who got damage, or to the ID which give damage?
Re: Detect Damage -
Bakr - 17.07.2013
Not to come off absurdly rude, but if you cannot figure that out by looking at the callback parameters and the parameters you pass to the function, I don't think you should be running a server.
Look on the Wiki for their documentation if you need further assistance (one link was already posted).
AW: Detect Damage -
Blackazur - 17.07.2013
I know how to run a server, i just ask for help, so that i will be better in scripting, btw will this code work?
Код:
if(team[issuerid] == TEAM_HUMAN)
{
new Float:hpp;
GetPlayerHealth(playerid,hpp);
new str[228];
format(str,sizeof(str),"~n~~n~~n~~n~~n~~w~ DAMAGE GIVEN: ~g~%.2f ~n~ ~w~PLAYER HP: ~g~%.2f", amount,hpp);
GameTextForPlayer(issuerid,str, 5, 2000);
}
I will that it only send it when it is the Player Player who shot and when he is in Human Team.
Re: Detect Damage -
JimmyCh - 17.07.2013
pawn Код:
new str[120];
format(str, sizeof(str),"You just did %.0f damage!", amount);
SendClientMessage(issuerid, -1, str);
This should work.