Help with callbacks in Filterscripts
#1

Hey,
I've asked for this earlier but nobody answered...
Why OnPlayerPickUpPickup sometimes doesn't gets called in some FSs when I pick up a pickup?
If I add line:
printf("Pickup %i picked up ((gamemode))",pickupid);
on that callback in my gamemode, I can see this message, and I put the same thing:
printf("Pickup %i picked up ((filterscript))",pickupid);
on one of my filterscript, and this doesn't shows up in console....

And another question:
Which is right:

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
  if(pickupid == blahblah)
  {
        //some code
  }
  return 1; // <----- THIS ONE
}

/*-------------OR---------------*/

public OnPlayerPickUpPickup(playerid, pickupid)
{
  if(pickupid == blahblah)
  {
        //some code
  }
  return 0; //<---- OR THIS ONE?
}
Reply
#2

If you open a blank script, you'd see a return 1;
And your OnPlayerPickUpPickup doesn't work, because you need to use if-else if to check the pickupid
Reply
#3

Quote:
Originally Posted by dice7
If you open a blank script, you'd see a return 1;
And your OnPlayerPickUpPickup doesn't work, because you need to use if-else if to check the pickupid
I don't understood, what you ment, but here is what I have in my FSs
pawn Код:
new bizPickup;
new bizExitPickup;
new bizInfoPickup;
public OnFilterScriptInit()
{
    bizPickup = CreatePickup(...
    bizExitPickup = CreatePickup(...
    bizInfoPickup = CreatePickup(...
    return 0;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    printf("Pickup %i picked up ((filterscript))",pickupid);
    if(pickupid == bizPickup)
    {
       
        //code
        return 1;
    }

    if(pickupid == bizExitPickup)
    {
        //code
        return 1;
    }
    if(pickupid == bizInfoPickup)
    {
        //code
        return 1;
    }
    return 0;
}
Reply
#4

dice7 ?
Reply
#5

You dont need to return 1; after every "if(pickupid...."
Reply
#6

Quote:
Originally Posted by Klutty
You dont need to return 1; after every "if(pickupid...."
I thought this would be faster because it won't look if pickupid matches any other PickupID... :P
Anyway I don't think that the problem is with what you wrote.. :\
Reply
#7

I have the same problem with other callbacks too..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)