Armour and hearts above heads
#1

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 ?
Reply
#2

Could you show the code??
Reply
#3

My code is no where near as its in the video so dont think its going to help.
Reply
#4

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
Reply
#5

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.
Reply
#6

its just an attachment.... Just attach object to the player.... end of story.
Reply
#7

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.
Reply
#8

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.
Reply
#9

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)