Pickup issues
#2

1. If I were you I would use a streamer, because you can create dynamic pickups in interiors.
2. Then you can use OnPlayerPickupDynamicPickup
3. Try pickup type 19 instead.
4. You can use an array to store the pickupid, and the weapon type, and also a number that represents how long the pickup has existed.
5. You can use a 5 or 10 second timer to check the gunpickup array, decrememnt the 'timer' element, and delete the pickup if the 'time variable' is zero.

here is a good streamer.
http://forum.sa-mp.com/showthread.ph...gnito+streamer

pawn Код:
#define MAX_GUN_PICKUPS 200

forward FiveSecond(); // on gamemode init you need to SetTimer("FiveSecond",5000,true);

enum gpdat { gp_time, gp_type };
new gunpickups[MAX_GUN_PICKUPS][gpdat];

...

public OnPlayerDeath(playerid, reason)
{
  ...
new player_interior = GetPlayerInterior(playerid);
new player_world = GetPlayerVirtualWorld(playerid);
new Float:px,Float:py,Float:pz;
GetPlayerPos(playerid,px,py,pz);

... //you will need to script the weapon detection and icon selection

new pickup = CreateDynamicPickup(358,19,px,py,pz,player_world,player_interior, -1, 50.0); //see streamer for details
gunpickups[pickup][gp_type] = // weaponid
gunpickups[pickup][gp_time] = 5; // variable for checking when to destroy the pickup

...

public OnPlayerPickupDynamicPickup(playerid, pickupid )
{
     if(pickupid < MAX_GUN_PICKUPS)
     {
          if(gunpickups[pickupid][gp_type] > 0)
          {
             //code to add weapon
             DestroyDynamicPickup(pickupid); //destroy the pickup manually when someone collects it
             gunpickups[pickupid][gp_type] = 0; //reset array variables
             gunpickups[pickupid][gp_time] = 0;
           }
...


public FiveSecond()
{
     for(new i = 0; i < MAX_GUN_PICKUPS;i++)
     {
           if(gunpickups[i][gp_time] > 0)
           {
                   gunpickups[i][gp_time]--;
                   if(gunpickups[i][gp_time] <= 0)
                   {
                         DestroyDynamicPickup(i);
                         gunpickups[i][gp_type] = 0;
                         gunpickups[i][gp_time] = 0;
                   }
            }
      }
      return 1;
}
This is rough code that I put here to give you the idea ( so don't just copy paste it ) if you don't want to use a streamer you will have to change the callbacks and pickup commands to suit. You don't have to do it this way, but at least it is a start for you.

good luck.
Reply


Messages In This Thread
Pickup issues - by JulietaZ - 02.10.2010, 02:37
Re: Pickup issues - by Rachael - 02.10.2010, 03:08
Re: Pickup issues - by JulietaZ - 02.10.2010, 03:23
Re: Pickup issues - by Rachael - 02.10.2010, 03:27
Re: Pickup issues - by JulietaZ - 02.10.2010, 03:31

Forum Jump:


Users browsing this thread: 1 Guest(s)