command that only works if you picked up something?
#2

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.
Reply


Messages In This Thread
command that only works if you picked up something? - by WillyP - 04.09.2010, 18:29
Re: command that only works if you picked up something? - by Calgon - 04.09.2010, 18:46
Re: command that only works if you picked up something? - by pmk1 - 04.09.2010, 19:44
Re: command that only works if you picked up something? - by WillyP - 04.09.2010, 19:48

Forum Jump:


Users browsing this thread: 1 Guest(s)