pickup help
#1

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?
Reply
#2

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 ^
Reply
#3

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"
Reply
#4

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;
}
Reply
#5

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)