Pickup Defines ?
#3

If its some kind of game you should put it in a function like that
pawn Код:
new Pickups[100] = {-1, ...}; // Initialize this array with -1 or any other invalid pickupid
new PickupsPicked[MAX_PLAYER];

CreateColPickups() {
    for(new p; p < sizeof Pickups; ++p) {
        Pickups[p] = CreatePickup(...);
    }
    new
        zero[sizeof PickupsPicked]
    ;
    PickupsPicked = zero;
}
You need to use OnPlayerPickUpPickup, check if the player picked up one of the 100
pawn Код:
//OnPlayerPickUpPickup(playerid, pickupid)
    for(new p; p < sizeof Pickups; ++p) {
        if(pickupid == Pickups[p]) {
            // for easier structure I use a seperate function
            return OnPlayerPickUpColPickup(playerid, pickupid, p);
        }
    }
Do in your function whatever you want
pawn Код:
OnPlayerPickUpColPickup(playerid, pickupid, idx) {
    new
        string[128]
    ;
    GetPlayerName(playeird, string, MAX_PLAYER_NAME);
    format(string, sizeof string, "%s found one pickup!", string);
    SendClientMessageToAll(0xFF0000FF, string);

    PickupsPicked[playerid]++;

    if(PickupsPicked[playerid] == 1) {
        string = "You picked up 1 pickup!";
    } else {
        format(string, sizeof string, "You picked up %d pickups", PickupsPicked[playerid]);
    }
    SendClientMessage(playerid, 0xFF0000FF, string);

    Pickups[idx] = -1; // mark this index as invalid pickupid
    return DestroyPickup(pickupid);
}
Something like that I guess
Reply


Messages In This Thread
Pickup Defines ? - by rockhopper - 12.07.2015, 04:55
Re: Pickup Defines ? - by rockhopper - 12.07.2015, 07:44
AW: Pickup Defines ? - by Nero_3D - 12.07.2015, 10:56
Re: Pickup Defines ? - by rockhopper - 12.07.2015, 14:39

Forum Jump:


Users browsing this thread: 3 Guest(s)