Armour and hearts above heads -
Edix - 27.02.2013
I've seen a video where whena palyers takes damage it shows an armour or heart icon above their heads
and I tried to make that on my script and it buggy as hell sometimes doesnt show the armour/heart and soemtimes just stays there.
[ame]http://www.youtube.com/watch?v=jY7PFwSWGyo[/ame]
could anyone explain to me how its working ?
Re: Armour and hearts above heads -
Gamer_007 - 27.02.2013
Could you show the code??
Re: Armour and hearts above heads -
Edix - 27.02.2013
My code is no where near as its in the video so dont think its going to help.
Re: Armour and hearts above heads -
Edix - 27.02.2013
Quote:
Originally Posted by ******
That will be using one of the object attachment functions.
|
If you mean like the SetPlayerAttachedObject functinos then I've used it before on other stuff and when the player moves with the object it like ... follows him in a silly way that doesnt look like in the video.
Or do you mean a different funciton
Re: Armour and hearts above heads -
Vince - 27.02.2013
Are you sure you're not confusing SetPlayerAttachedObject with AttachObjectToPlayer? The latter works in the way you describe, but the former should be pretty smooth.
Re: Armour and hearts above heads -
Glad2BeHere - 27.02.2013
its just an attachment.... Just attach object to the player.... end of story.
Re: Armour and hearts above heads -
Edix - 28.02.2013
Quote:
Originally Posted by Vince
Are you sure you're not confusing SetPlayerAttachedObject with AttachObjectToPlayer? The latter works in the way you describe, but the former should be pretty smooth.
|
Thanks i'll try that out
Quote:
Originally Posted by Glad2BeHere
its just an attachment.... Just attach object to the player.... end of story.
|
Well with which functions there are 2 different attachments functions from what im seeing
or maybe im just wrong.
Re: Armour and hearts above heads -
MP2 - 28.02.2013
Create object. Store ID. Attach. SetTimerEx passing the playerid parameter with the interval to hide the object (3 sec?). Store that timer ID. Kill it if they take damage again (re-start it again). Destroy object on timer. Fin.
Re: Armour and hearts above heads -
Edix - 28.02.2013
I think I got it so if anyone comes across this thread and wonders how I made it heres the code:
works on 0.3x and 1 issue is it doesnt spin around
Код:
//Made by FKu
#include <a_samp>
forward dmgtdhide(playerid);
new Text:FKu_DMGtd[MAX_PLAYERS char],ObjectID[MAX_PLAYERS char];
public OnPlayerConnect(playerid)
{
FKu_DMGtd{playerid} = TextDrawCreate(150.000000, 375.000000, "HIT");
TextDrawLetterSize(FKu_DMGtd{playerid}, 0.480000, 2.000000);
TextDrawColor(FKu_DMGtd{playerid}, 0xFF0000FF);
return 1;
}
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
new FKu_string[10],Float:check[MAX_PLAYERS];
format(FKu_string,sizeof(FKu_string),"HIT: %f",amount);
TextDrawSetString(FKu_DMGtd{playerid},FKu_string);
TextDrawShowForPlayer(playerid,FKu_DMGtd{playerid});
GetPlayerArmour(damagedid,check[damagedid]);
if(check[damagedid] == 0) ObjectID{playerid} = CreateObject(1240, 0.0, 0.0, -100.0, 0.0, 0.0, 0.0, 0.0);
else ObjectID{playerid} = CreateObject(1242, 0.0, 0.0, -100.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToPlayer(ObjectID{playerid}, damagedid, 0.0, 0.0, 1.5, 0.0, 0.0, 0.0);
SetTimerEx("dmgtdhide",750,false,"d",playerid);
return 1;
}
public dmgtdhide(playerid)
{
TextDrawHideForPlayer(playerid,FKu_DMGtd{playerid});
DestroyObject(ObjectID{playerid});
return 1;
}