SA-MP Forums Archive
Why other players cant see the health pickup on dead bodie? - 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: Why other players cant see the health pickup on dead bodie? (/showthread.php?tid=648853)



Why other players cant see the health pickup on dead bodie? - wallen - 29.01.2018

Top of script

Код:
new Health;
I did that on OnPlayerDeath

Код:
	// Getting the player's Health pickup
	new Float:x,Float:y,Float:z;
	GetPlayerPos(playerid,x,y,z);
	Health = CreatePickup(1240,4,x+2,y,z,0);
	SetTimer("Health_Timer", 15000, false);
Код:
forward Health_Timer();
public Health_Timer()
{
    DestroyPickup(Health);
    return 1;
}



Re: Why other players cant see the health pickup on dead bodie? - Mugala - 29.01.2018

try this OnPlayerDeath

Код:
	// Getting the player's Health pickup
	new Float:x,Float:y,Float:z;
	GetPlayerPos(playerid,x,y,z);
	Health = CreatePickup(1240,4,x+2,y,z,GetPlayerVirtualWorld(playerid));
	SetTimer("Health_Timer", 15000, false);



Re: Why other players cant see the health pickup on dead bodie? - Mugala - 29.01.2018

and this code also bugs your system when 2 player dies in a same time.
I'll rewrite your code in seconds.


Re: Why other players cant see the health pickup on dead bodie? - Mugala - 29.01.2018

Код:
new Health[MAX_PLAYERS];
OnPlayerDeath

Код:
	// Getting the player's Health pickup
	new Float:x,Float:y,Float:z;
	GetPlayerPos(playerid,x,y,z);
	Health[playerid] = CreatePickup(1240,4,x,y,z+0.2,GetPlayerVirtualWorld(playerid));
	SetTimerEx("Health_Timer", 15000, false, "i", playerid);
Код:
forward Health_Timer(playerid);
public Health_Timer(playerid)
{
    DestroyPickup(Health[playerid]);
    return 1;
}



Re: Why other players cant see the health pickup on dead bodie? - Sew_Sumi - 29.01.2018

^^ This guy has a clue (He just needs to learn about the edit button next lol)


Re: Why other players cant see the health pickup on dead bodie? - Gammix - 30.01.2018

You don't even need an array for this, simply pass the pickupid in timer like this:
PHP код:
SetTimerEx("Health_Timer"15000false"i"CreatePickup(1240,4,x,y,z+0.2,GetPlayerVirtualWorld(playerid))); 
And then delete pickup in timer:
PHP код:
forward Health_Timer(pickupid);
public 
Health_Timer(pickupid)
{
    
DestroyPickup(pickupid);
    return 
1;




Re: Why other players cant see the health pickup on dead bodie? - Sew_Sumi - 30.01.2018

Trust you to come out with knowledge.