setting pickup appearing delay?! - 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: setting pickup appearing delay?! (
/showthread.php?tid=84160)
setting pickup appearing delay?! -
Moustafa - 29.06.2009
Well when i add pickup, it appears after approximately 18 second
and i want it to appear after the player moves away from the pickup so anyone else can pick it up, how can i do this
Re: setting pickup appearing delay?! -
ledzep - 29.06.2009
https://sampwiki.blast.hk/wiki/Pickup_help#Pickup_Type
Hope it helps.
Re: setting pickup appearing delay?! -
Stah - 29.06.2009
Use PlayerToPoint.
Here's PlayerToPoint if you dont have it:
Put this with your other forwards.
pawn Код:
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
Put this anywhere in the script.
pawn Код:
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if (gdebug >= 3){printf("DEBUG ProxDetectorS()");}
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}
Now here's how you do what to wanted:
Put this next to your other forwards.
pawn Код:
forward PickupDelay(playerid);
put this in "OnPlayerPickUpPickup"
pawn Код:
if(pickup=YOUR_PICKUP)
{
SetTimer("PickupDelay", 6000, 0); // change the timer if you wish to.
}
Put this anywhere in the script.
pawn Код:
public PickupDelay(playerid)
{
if(PlayerToPoint(5, playerid, PICKUP_X, PICKUP_Y, PICKUP_Z)) // change the x, y, z.
{
SetTimer("PickupDelay", 6000, 0); // change the timer if you wish to.
//if you want to can send the player a message to move away from the area.
}
else
{
YOUR_PICKUP = CreatePickup ( MODEL, TYPE, PICKUP_X, PICKUP_Y, PICKUP_Z); // change them.
}
}
Re: setting pickup appearing delay?! -
Moustafa - 29.06.2009
No i dont want to use PlayerToPoint
or is it used so when the player gets out of the coord of the pickup it appears again??
Re: setting pickup appearing delay?! -
shady91 - 29.06.2009
lol they auto appear by them selfs mate or change type to 1 from 2 and it wont disapear mate lol