SA-MP Forums Archive
pickup help - 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)
+--- Thread: pickup help (/showthread.php?tid=413275)



pickup help - GrInDzO - 04.02.2013

Hello!

All i want to make, is that you once pickup that pickup, you can't pickup it again.

Code under public OnPlayerPickUpPickup(playerid, pickupid):
Код:
if(pickupid == Pickup[0]) return SendClientMessage(playerid, COLOR_GREY, "ERROR: You already pickup this pickup!");
What is wrong?


Re: pickup help - [DS]SplasH - 04.02.2013

The pickup does not display.
1
Not pickupable, exists all the time. (Suitable for completely scripted pickups using OnPlayerPickUpPickup)
2
Pickupable, respawns after some time.
3
Pickupable, respawns after death
4
Disappears shortly after created (perhaps for weapon drops?)
5
Disappears shortly after created (perhaps for weapon drops?)
8
Pickupable, but has no effect. Disappears automatically.
11
Blows up a few seconds after being created (bombs?)
12
Blows up a few seconds after being created.
13
Slowly decends to the ground.
14
Pickupable, but only when in a vehicle. Falls through objects made with CreateObject, etc.
15
Pickupable, respawns after death
19
Pickupable, but has no effect (information icons?)
22
Pickupable, respawns after death.
23
This are the Pickup codes ^


Re: pickup help - GrInDzO - 04.02.2013

no, no, no. I mean like this:

When player pickup the pickup, him show "You pick up the pickup!", but when he want to pick up this pickup again, him show "ERROR: You already pick up this pickup"


Re: pickup help - lordturhan - 04.02.2013

At top of your script

pawn Код:
new picked[MAX_PLAYERS];
And then when the player picks up the pickup set the picked to 1.

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
        if(pickupid == Pickup[0])
       {
       if(picked[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "ERROR: You already pickup this         pickup!");
        picked[playerid] = 1;
        }
    return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
        picked[playerid] = 0;
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
        picked[playerid] = 0;
        return 1;
}



Re: pickup help - GrInDzO - 05.04.2013

And how to add more picked pickups? Like Pickup[0], Pickup[1] .. Pickup[10]?


Re: pickup help - stabker - 05.04.2013

Quote:
Originally Posted by GrInDzO
Посмотреть сообщение
And how to add more picked pickups? Like Pickup[0], Pickup[1] .. Pickup[10]?
I dont think, that is good idea, but you can do something like this:

new Picked[MAX_PLAYERS][MAX_PICKUPS char];

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == ...)
    {
        if(Picked[playerid]{pickupid}) return SendClientMessage(playerid, -1, "ERROR: You already pickup this pickup!");
        Picked[playerid]{pickupid} = 1;
        //action
    }
    return 1;
}