SA-MP Forums Archive
Money Drop all the player money? - 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: Money Drop all the player money? (/showthread.php?tid=81959)



Money Drop all the player money? - steven_italy - 15.06.2009

i searche script for money drop but i find only things that give u a certain sum of money when a pleyer death.
i want a script that if a player die, and he have 3456$, the pickups spawn with a total amount of 3456$. I want that pickups have the same amount of the player sum (because when a player die he lose all money in my server)


Re: Money Drop all the player money? - robanswe - 15.06.2009

Try this:
forward DestroyPickup();//at the top of your script
new pick3;//at the top of your script
new pickuptimer;//at the top of your script
new DropMoney;//at the top of your script



DropMoney = GetPlayerMoney(playerid);//in "public OnPlayerDeath(playerid, killerid, reason)"
pickuptimer = SetTimerEx("DestroyPickup",1000, 0, "i");//in "public OnPlayerDeath(playerid, killerid, reason)"
pick3 = CreatePickup(1550,3,x,y-0.5,z);//in "public OnPlayerDeath(playerid, killerid, reason)"


pawn Код:
public DestroyPickup()
{
    DestroyPickup(pick3);
}
 
public OnPlayerPickUpPickup( playerid, pickupid )
{
    if(pickupid == pick3)
    {
    new string[128];
    format(string, sizeof(string), "You found %d$ in the money bag!", DropMoney);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    GivePlayerCash(playerid,DropMoney);
    DestroyPickup(pickupid);
    }
    return 1;
}
This code is not tested! And i dosent know if the timer is working...