disappearing spawn items - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: disappearing spawn items (
/showthread.php?tid=169818)
disappearing spawn items -
sheepondrugs - 21.08.2010
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:
Код:
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.
Re: disappearing spawn items -
Retardedwolf - 21.08.2010
You mean you want the health pickup to be gone after a player has taken it?
Re: disappearing spawn items -
-Sneaky- - 21.08.2010
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.
Re: disappearing spawn items -
sheepondrugs - 21.08.2010
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.