Pickup Help
#1

Alright so i was wondering, when using

pawn Код:
CreatePickup
Does it have to be assigned as a Variable to make it work or can i just use it as pickup id 1 EX

pawn Код:
new ex1;
new ex2;

ex1 = CreatePickup(blah,blah)
ex2 = CreatePickup(blah,blah)
Or can i just do this

pawn Код:
CreatePickup(blah,blah)// Id=1
CreatePickup(blah,blah)// Id=2
And so it would look like this for OnPlayerPickupPickup

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
  if(pickupid == 1)
  {
    // Code here
  }
  if(pickupid == 2)
  {
    // Code here
  }
  return 1;
}
I am just wondering, because i am making a lot of pickups in my script and i don't want to use a shitload of variables.
Reply
#2

1st - Pickup IDs start from 0 NOT 1, this may cause a problem if you DON'T use variables
2nd - Usage of variables are not needed but if you forget the ID of a pickup or what it does, you are fucked

Soo... To the point variables are good even you got shitloads of those, use them or not - it, is, your, choice...

I personally use variables as they are for easier access,

Thanks.
Reply
#3

Oh ok thanks man i was going to answer this myself, but had to go to school and thanks
Reply
#4

Go into this topic and read the "Assumptions" section.

The problem is not about simply forgetting the ID of the pickup. You're setting yourself up for a world of hurt if you ever decide to start deleting pickups or you have other scripts which create pickups.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)