PDA

View Full Version : pickup help


GrInDzO
04/02/2013, 06:45 PM
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? :s

[DS]SplasH
04/02/2013, 06:49 PM
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 ^

GrInDzO
04/02/2013, 06:52 PM
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"

lordturhan
04/02/2013, 07:57 PM
At top of your script

new picked[MAX_PLAYERS];

And then when the player picks up the pickup set the picked to 1.


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

GrInDzO
05/04/2013, 10:46 PM
And how to add more picked pickups? Like Pickup[0], Pickup[1] .. Pickup[10]?

stabker
05/04/2013, 11:42 PM
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];


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