How does a loot system works?
#5

Just save tons of positions in a array..

make a random and find one of this tons of positions

create a pickup or whatever you want to create in this positions..

maybe set a timer for disappear

some variables for check if is here and if is taken

and the callback for player pickup with the reward

pawn Код:
Float:Positions[2][3] = {
    {0.0,0.0,0.1719},
    {0.0,0.0,0.1719}
};
new bool:IsPickupCreated,PickupID;



/commandforcreate {
    if(IsPickupCreated == true) return .. the pickup is already created
    new rando = random(sizeof(Positions));
    PickupID = createsomepickup(someid,Positions[rando][0],Positions[rando][1],Positions[rando][2]);
    IsPickupCreated = true;
    SetTimer("PickupDisappear",10000,0);
}



public PickupDisappear()
{
    DestroyPickup(PickupID);
    IsPickupCreated = false;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == PickupID)
    {
        GivePlayerMoney(playerid, 2342354);
        IsPickupCreated = false;
        //sendclientmessage for announce the winner
    }
    return 1;
}
Reply


Messages In This Thread
How does a loot system works? - by CrazyChoco - 05.06.2013, 08:15
Re: How does a loot system works? - by moadi - 05.06.2013, 10:37
Re: How does a loot system works? - by CrazyChoco - 05.06.2013, 10:40
Re: How does a loot system works? - by Abhishek. - 05.06.2013, 10:42
Re: How does a loot system works? - by iJumbo - 05.06.2013, 10:45
Re: How does a loot system works? - by CrazyChoco - 05.06.2013, 10:57

Forum Jump:


Users browsing this thread: 1 Guest(s)