Getting gun name of issuerid and playerid OnPlayerTakeDamage -
GwENiko - 10.10.2014
Well, basically, i stumbled on this specific part. What i wanna do is, i want to get the gun name of the issuerid who shot playerid and store the gun name, so i can format it inside a textdraw. This is the code, in which i used to do it.
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
GetWeaponName(weaponid, Weap, 34);
TextDrawSetString(Textdraw5[issuerid], astring);
format(astring, 256, "%s", Weap);
TextDrawShowForPlayer(issuerid, Textdraw5[issuerid]);
/* issuerid gun */
Now, i want to tell the playerid which gun issuerid used to shoot him.
pawn Код:
format(bstring, 256, "%s", Weap);
TextDrawSetString(Textdraw11[issuerid], bstring);
TextDrawShowForPlayer(playerid, Textdraw11[playerid]);
The problem: whenever the issuerid shoots playerid, it tells playerid the gun he is currently using, when i want it to show which gun playerid used to shoot him. help is appreciated
Re: Getting gun name of issuerid and playerid OnPlayerTakeDamage -
GwENiko - 11.10.2014
bump, help pls
Re: Getting gun name of issuerid and playerid OnPlayerTakeDamage -
Pottus - 11.10.2014
Well okay here it goes.
1.) You need to use player textdraws
2.) You need to check if the issuer is a valid player (ie not fall damage which would be INVALID_PLAYER_ID)
3.) Your setting the textdraw for the issuerid not the playerid
Re: Getting gun name of issuerid and playerid OnPlayerTakeDamage -
Threshold - 11.10.2014
'format' was placed AFTER 'TextDrawSetString'.
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
GetWeaponName(weaponid, Weap, 34);
format(astring, 256, "%s", Weap);
TextDrawSetString(Textdraw5[issuerid], astring);
TextDrawShowForPlayer(issuerid, Textdraw5[issuerid]);
/* issuerid gun */
You used 'Textdraw11[issuerid]' in your TextDrawSetString instead of 'Textdraw11[playerid]'.
pawn Код:
format(bstring, 256, "%s", Weap);
TextDrawSetString(Textdraw11[playerid], bstring);
TextDrawShowForPlayer(playerid, Textdraw11[playerid]);
EDIT: And the additional information provided by Pottus.
Re: Getting gun name of issuerid and playerid OnPlayerTakeDamage -
GwENiko - 11.10.2014
Quote:
Originally Posted by Pottus
Well okay here it goes.
1.) You need to use player textdraws
2.) You need to check if the issuer is a valid player (ie not fall damage which would be INVALID_PLAYER_ID)
3.) Your setting the textdraw for the issuerid not the playerid
|
Yea, its all well in that part, i prefered to post only a snippet, but yea i am checking for fall damages and etc, and i've done all you said and it worked %100. Thanks to Threshold and Pottus lol, you guys solved my problem, tyvm