0 Üye ve 1 Ziyaretçi konuyu incelemekte.
addEvent("onMoneyCollected", true)addEventHandler("onMoneyCollected", root, function() local sound = playSound("money.wav") setSoundVolume(sound, 0.5) end)
function createMoney(player) local x, y, z = getElementPosition(player); local x1, y1, x2, y2; x1 = (x-2)+(math.random()*4); y1 = (y-2)+(math.random()*4); x2 = (x-2)+(math.random()*4); y2 = (y-2)+(math.random()*4); local valuemoney = 750 -- value take money local moneyAmmount = valuemoney local time = 25000 -- time in mile seconds moneyAmmount = math.floor(moneyAmmount/1) takePlayerMoney(player, moneyAmmount) moneyAmmount = math.floor(moneyAmmount/3) -- Create the pickups setElementData(createPickup(x1, y1, z, 3, 1212), "ammount", moneyAmmount); setElementData(createPickup(x2, y2, z, 3, 1212), "ammount", moneyAmmount); setElementData(createPickup(x2, y2, z, 3, 1212), "ammount", moneyAmmount);end function moneyPickupHit(player) local money = getElementData(source, "ammount"); if money then givePlayerMoney(player, money); destroyElement(source); endend function playerJustGotDied(ammo, attacker, weapon, bodypart) createMoney(source);end addEventHandler("onPickupUse", getRootElement(), moneyPickupHit);addEventHandler("onPlayerWasted", getRootElement(), playerJustGotDied);