SA-MP Forums Archive
Pickup problem - 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: Pickup problem (/showthread.php?tid=189528)



Pickup problem - Libra_PL - 12.11.2010

Ok... First, I show the script:

Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == hiddenpackage) created[playerid] = 0;
    if(pickupid == hiddenpackage) SendClientMessage(playerid, yellow, "Congratulations! You have found a Hidden Package!");
    if(pickupid == hiddenpackage) GameTextForAll("~r~Hidden Package ~b~has been found!", 5000, 4);
    if(pickupid == hiddenpackage) DestroyPickup(hiddenpackage);
    if(pickupid == infopickup1) SendClientMessage(playerid,yellow,"Text 1");
    if(pickupid == infopickup2) SendClientMessage(playerid,yellow,"Text 2");
    if(pickupid == infopickup3) SendClientMessage(playerid,yellow,"Text 3");   
    if(pickupid == flowers) SendClientMessage(playerid,yellow,"You have found some flowers!");
}
When I pick up "infopickup1", there appears Text 1 text, and that what is in "hidden package". When I pick up "hidden package", there appears that what is in "hiddenpackage" and "infopickup1". With other is ok. Can anyone fix this?


Re: Pickup problem - HrvojeCro - 12.11.2010

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == hiddenpackage) created[playerid] = 0 && SendClientMessage(playerid, yellow, "Congratulations! You have found a Hidden Package!") && GameTextForAll("~r~Hidden Package ~b~has been found!", 5000, 4) && DestroyPickup(hiddenpackage);
    if(pickupid == infopickup1) SendClientMessage(playerid,yellow,"Text 1");
    if(pickupid == infopickup2) SendClientMessage(playerid,yellow,"Text 2");
    if(pickupid == infopickup3) SendClientMessage(playerid,yellow,"Text 3");  
    if(pickupid == flowers) SendClientMessage(playerid,yellow,"You have found some flowers!");
}
or that 2 pickups are too close to each other?


Re: Pickup problem - TheXIII - 12.11.2010

I don't understand what the problem is. Could you try to explain it more clearly?

EDIT:
Try this:
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == hiddenpackage)
    {
        created[playerid] = 0;
        SendClientMessage(playerid, yellow, "Congratulations! You have found a Hidden Package!");
        GameTextForAll("~r~Hidden Package ~b~has been found!", 5000, 4);
        DestroyPickup(hiddenpackage);
    }
    else if(pickupid == infopickup1) SendClientMessage(playerid,yellow,"Text 1");
    else if(pickupid == infopickup2) SendClientMessage(playerid,yellow,"Text 2");
    else if(pickupid == infopickup3) SendClientMessage(playerid,yellow,"Text 3");
    else if(pickupid == flowers) SendClientMessage(playerid,yellow,"You have found some flowers!");

    return 1;
}



Re: Pickup problem - Libra_PL - 12.11.2010

Quote:
Originally Posted by HrvojeCro
Посмотреть сообщение
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == hiddenpackage) created[playerid] = 0 && SendClientMessage(playerid, yellow, "Congratulations! You have found a Hidden Package!") && GameTextForAll("~r~Hidden Package ~b~has been found!", 5000, 4) && DestroyPickup(hiddenpackage);
    if(pickupid == infopickup1) SendClientMessage(playerid,yellow,"Text 1");
    if(pickupid == infopickup2) SendClientMessage(playerid,yellow,"Text 2");
    if(pickupid == infopickup3) SendClientMessage(playerid,yellow,"Text 3");  
    if(pickupid == flowers) SendClientMessage(playerid,yellow,"You have found some flowers!");
}
or that 2 pickups are too close to each other?
Thanks, works better, but if I pick up the "hiddenpackage", no effect...


Re: Pickup problem - TheXIII - 12.11.2010

Quote:
Originally Posted by Libra_PL
Посмотреть сообщение
Thanks, works better, but if I pick up the "hiddenpackage", no effect...
Try the code I posted instead. AND operator doesn't work like that.


Re: Pickup problem - HrvojeCro - 12.11.2010

Quote:
Originally Posted by TheXIII
Посмотреть сообщение
Try the code I posted instead. AND operator doesn't work like that.
yea I fu***d that code lol
didnt check just wrote what was on my mind at first
EDIT:
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == hiddenpackage)
    {
        created[playerid] = 0;
        SendClientMessage(playerid, yellow, "Congratulations! You have found a Hidden Package!");
        GameTextForAll("~r~Hidden Package ~b~has been found!", 5000, 4);
        DestroyPickup(hiddenpackage);
    }
    else if(pickupid == infopickup1)
       {
               SendClientMessage(playerid,yellow,"Text 1");
       }
    else if(pickupid == infopickup2)
       {
               SendClientMessage(playerid,yellow,"Text 2");
       }
    else if(pickupid == infopickup3)
       {
              SendClientMessage(playerid,yellow,"Text 3");
       }
    else if(pickupid == flowers)
      {
             SendClientMessage(playerid,yellow,"You have found some flowers!");
      }
      return 1;
}
there use this


Re: Pickup problem - Libra_PL - 12.11.2010

Thanks guys. It works!