Posts: 6,129
Threads: 36
Joined: Jan 2009
You would need to create a PVar or an array/enum.
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid) {
if(pickupid == 204) { // Use a variable to hold the pickup ID. But for this example, I've set a random number.
SetPVarInt(playerid, "pickedUpPickup", 1); // As a PVar.
playerPickedUpPickup[playerid] = 1; // As an array, this is faster than using a PVar. To declare it, use 'new playerPickedUpPickup[MAX_PLAYERS];'
}
return 1;
}
And in your command code to check whether your pickup was picked up:
pawn Код:
if(GetPVarInt(playerid, "pickedUpPickup") == 1) { // As a PVar
print("Hello World");
SetPVarInt(playerid, "pickedUpPickup", 0); // They need to pickup the pickup... again!
}
if(playerPickedUpPickup[playerid] == 1) { // As an array
print("Hello World");
playerPickedUpPickup[playerid] = 0; // They need to pickup the pickup... again!
}
"Hello World" would print if the pickup had been picked up.