05.09.2010, 14:19
pawn Код:
new moneypickup[MAX_PICKUPS][2] = {-1, -1, ...};
public OnPlayerDeath(playerid, killerid, reason)
{
new Float:pos[3]; GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
new pickup = CreatePickup(1550, 23, pos[0], pos[1], pos[2]); //Might fuck around a bit with the '23'
moneypickup[pickup][0] = GetPlayerMoney(playerid); //The player loses all his money. Change this to whatever value the pickup must contain.
ResetPlayerMoney(playerid); //Resets the player's money, use GivePlayerMoney(playerid, -amount) to remove a specific amount.
moneypickup[p][1] = SetTimerEx("DeletePickupEx", 5*1000, 0, "d", pickup);
return 1;
}
forward DeletePickupEx(pickupid);
public DeletePickupEx(pickupid)
{
DestroyPickup(pickupid);
moneypickup[pickupid][0] = -1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
for(new p; p < MAX_PICKUPS; p++)
{
if(moneypickup[p][0] != -1)
{
KillTimer(moneypickup[p][1]);
GivePlayerMoney(playerid, moneypickup[p][0]);
DestroyPickup(p);
}
}
return 1;
}