0 Üye ve 1 Ziyaretçi konuyu incelemekte.
-- Vereceği Para --MAXPARA = 16function komut(thePlayer) if exports.global:hasItem(thePlayer, 315) then local maxx = math.floor(math.random(1,tonumber(MAXPARA))) exports.global:takeItem(thePlayer, 315, 1) outputChatBox("[!] #FFFFFFAltın Kutu'dan ".. maxx .." Numaralı eşya çıktı! Eşyanın İsmini /kutulistesi yazarak bakabilirsin :) Bol Şanslar... ", thePlayer, 0, 255, 0, true) else outputChatBox("[!]#0000FF #ffdf03Malesef Altın kutunuz yok :(", thePlayer, 0, 255, 0, true) endendaddCommandHandler("kutuacaltin", komut)
local hediyeler = { --{"Silah isim",yuzdeorani}, {"Colt 45",50}, {"Tec-9",30}, {"AK-47",10},}addCommandHandler("kutuacaltin", function(oyuncu) if exports.global:hasItem(oyuncu, 315) then local silahisim = unpack(hediyeler[randomHediye()]) local silahid = getWeaponIDFromName(silahisim) local cid = tonumber(getElementData(oyuncu,"account:character:id")) local serial = exports.global:createWeaponSerial(1,cid) exports["item-system"]:giveItem(oyuncu, 115, silahid..":"..serial..":"..silahisim.."::") exports.global:takeItem(oyuncu, 315, 1) outputChatBox("[!] #FFFFFFAltın Kutu'dan ".. silahisim .." isimli eşya çıktı! Bol Şanslar... ", oyuncu, 0, 255, 0, true) exports.global:sendMessageToAdmins("[ALTIN-KUTU]: "..getPlayerName(oyuncu).." İsimli oyuncu altın kutudan "..silahisim.." çıkardı!") else outputChatBox("[!]#0000FF #ffdf03Malesef Altın kutunuz yok :(", oyuncu, 0, 255, 0, true) endend)function randomHediye() for i=1,#hediyeler do -- hediyeler tablosu kadar for döndür local yuzde = hediyeler[i][2] -- yuzde oranını çek if randomChange(yuzde) then -- eğer yuzde tutarsa return i -- hediye sırasını gönder end end return randomHediye() -- eğer tutmazsa tekrar deneendfunction randomChange(percent) -- returns true a given percentage of calls assert(percent >= 0 and percent <= 100) -- sanity check return percent >= math.random(1, 100) -- 1 succeeds 1%, 50 succeeds 50%, -- 100 always succeeds, 0 always failsend