setting pickup appearing delay?!
#3

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


Messages In This Thread
setting pickup appearing delay?! - by Moustafa - 29.06.2009, 08:31
Re: setting pickup appearing delay?! - by ledzep - 29.06.2009, 09:00
Re: setting pickup appearing delay?! - by Stah - 29.06.2009, 09:15
Re: setting pickup appearing delay?! - by Moustafa - 29.06.2009, 09:22
Re: setting pickup appearing delay?! - by shady91 - 29.06.2009, 09:27

Forum Jump:


Users browsing this thread: 1 Guest(s)