disappearing spawn items
#1

Hey people,

I have added a simple spawn health item to my server, but sometimes (rarely) it dissapears.

I don't know what the conditions are to make it dissapear from spawning, otherwise I'd of fixed it.

......any ideas??


The code simply spawns a constant health pack instantly for all players.


...anyways here's the code:
Код:
new Health1;
Код:
public OnGameModeInit()
{
	Health1 = CreatePickup(1240,1,2001.8210,1538.2219,13.58591);
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == Health1)
    {
         Health1 = CreatePickup(1240,1,2001.8210,1538.2219,13.58591);
         SetPlayerHealth(playerid,100.0);
	   	 return 1;
    }

EDIT:
sometimes when a player picks up the health, the health is restored to the player, but the item does not get replaced.
Reply
#2

You mean you want the health pickup to be gone after a player has taken it?
Reply
#3

https://sampwiki.blast.hk/wiki/PickupTypes

https://sampwiki.blast.hk/wiki/CreatePickup

Quote:

Note: While you will get a OnPlayerPickUpPickup triggered when a player picks up a pickup, keep in mind that several players can pick up same pickup, or that a player can pick up a pickup without the pickup being removed on all clients, if you want to reliably detect weapon pickups, you should use weapon type 1, and manually give weapons and destroy them when they are picked up. Don't forget to handle cases where several players pick up same pickup id aswell.

If you want the pickup to disappear when a player picks it up (if that's what you mean, I don't fully understand what your trying to say), destroy it on OnPlayerPickUpPickup then recreate it after a while.
Reply
#4

sorry that did sound confusing!


The health pack respawns instantly every time a user picks it up. (which is what I want)


however, sometimes the health pack does not respawn back.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)