SA-MP Forums Archive
How does a loot system works? - 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)
+--- Thread: How does a loot system works? (/showthread.php?tid=441984)



How does a loot system works? - CrazyChoco - 05.06.2013

Hi guys,
Could someone explain how a simple loot system works. I actually doesn't know so much about it, so i thought i would ask here.
Could someone also put a little snippet of a very basic loot system, or atleast give some help, on how to do it?

Thanks
-CaptainShy


Re: How does a loot system works? - moadi - 05.06.2013

What do you mean a loot system? explain us


Re: How does a loot system works? - CrazyChoco - 05.06.2013

Loot is mostly like treasure or wealth that is found or stolen, but in my case i want them to be placed in some special cordinates and when player run into them a dialog will be posted, but i actually don't know how to :/


Re: How does a loot system works? - Abhishek. - 05.06.2013

you mean something like moneybag? Huh?
and just wondering were you a player of lvrcr ,godcat's brother?


Re: How does a loot system works? - iJumbo - 05.06.2013

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;
}



Re: How does a loot system works? - CrazyChoco - 05.06.2013

Quote:
Originally Posted by Abhishek.
Посмотреть сообщение
you mean something like moneybag? Huh?
and just wondering were you a player of lvrcr ,godcat's brother?
Yeah, i were a lvrcr player , but not godcat's brother :P, I also remember you

Quote:
Originally Posted by iJumbo
Посмотреть сообщение
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;
}
Thanks for the basic snippet, I am already trying to modify your code