SA-MP Forums Archive
How to keep count? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to keep count? (/showthread.php?tid=251441)



How to keep count? - TheYoungCapone - 27.04.2011

Well i need help with this what im trying to do is lets say i create 5 pickups how would i make it so it keeps count if a player has already found that pickup it will send him a message saying that they have found that pickup and when he finds all 5 pickups it sends another message.


Re: How to keep count? - Raimis_R - 27.04.2011

I made example:

pawn Код:
new PickupFound[MAX_PLAYERS];

// example:

if(pickupid == 1Pickup)
{
    if(PickupFound[playerid]==0)
    {
        // SendMessage you found 1pickup left 4pickups etc.
        PickupFound[playerid]=1;
    }
    else
    {
        // You Alredy have this pickup...
    }
}

if(pickupid == 2Pickup)
{
    if(PickupFound[playerid]==1)
    {
        // SendMessage you found 2pickup left 3pickups etc.
        PickupFound[playerid]=2;
    }
    else
    {
        // You have alredy have this pickup or don't have 1pickup
    }
}