PDA

View Full Version : Detect Damage


Blackazur
16/07/2013, 09:33 PM
Hello, how to make that you see the Damage when you shoot an player as a gametext for example: "DAMAGE GIVEN: DAMAGE"?

Twizted
16/07/2013, 09:40 PM
http://wiki.sa-mp.com/wiki/OnPlayerTakeDamage

Blackazur
17/07/2013, 12:07 AM
Yeah but how to put it then in the gametext like "DAMAGE GIVEN: DAMAGE"

jamesbond007
17/07/2013, 12:09 AM
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
new str[128];
format(str,sizeof(str),"%.2f", amount);
GameTextForPlayer(playerid,str, 5, 1000);
}

Blackazur
17/07/2013, 09:56 AM
This dont work, know everyone an other solution or should i use for that OnPlayerGiveDamage?

Bakr
17/07/2013, 09:59 AM
What about it doesn't work? The code jamesbond007 posted looks perfectly fine to me.

Blackazur
17/07/2013, 10:00 AM
But will it send that to the ID who got damage, or to the ID which give damage?

Bakr
17/07/2013, 10:03 AM
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).

Blackazur
17/07/2013, 10:56 AM
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.

JimmyCh
17/07/2013, 11:11 AM
new str[120];
format(str, sizeof(str),"You just did %.0f damage!", amount);
SendClientMessage(issuerid, -1, str);


This should work.

Bakr
17/07/2013, 11:18 AM
Yes Blackazur, that will work. Sorry for seeming rather rude.

Blackazur
17/07/2013, 02:38 PM
I dont know why, but this wont work, i tried everything, but it wont work, can someone help me?

JimmyCh
18/07/2013, 07:30 AM
Show us your OnPlayerTakeDamage please.