SA-MP Forums Archive
Help with callbacks in Filterscripts - 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: Help with callbacks in Filterscripts (/showthread.php?tid=129772)



Help with callbacks in Filterscripts - SiJ - 23.02.2010

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?
}



Re: Help with Pickups in Filterscripts - dice7 - 23.02.2010

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


Re: Help with Pickups in Filterscripts - SiJ - 23.02.2010

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;
}



Re: Help with Pickups in Filterscripts - SiJ - 24.02.2010

dice7 ?


Re: Help with Pickups in Filterscripts - Klutty - 24.02.2010

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


Re: Help with Pickups in Filterscripts - SiJ - 24.02.2010

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.. :\


Re: Help with callbacks in Filterscripts - SiJ - 25.02.2010

I have the same problem with other callbacks too..