What's new

-Skrypt Procent na wyci?gniecie items.

Status
Not open for further replies.

Oskar1415

Advanced User
Joined
Feb 25, 2009
Messages
381
Reaction score
22
Witam. Tak jak w temacie. Klikam na item XXXX i mam 10-25% na wyci?gniecie itemka ale mog? klikn?? raz na jaki? czas. Jak sie da to raz na 24 godziny.
Pozdrawiam.
 

Don Muha

Advanced User
Joined
Aug 27, 2008
Messages
403
Reaction score
34
Odp: Procent na wyci?gniecie items.

Trzymaj (oto m?j skrypt na yalahar quarters)
PHP:
local config = {
	items = {
		{2148, 50}, -- {id, ilosc},
		{2148, 80},
		{9808, 1},
		{7618, 1},
		{9811, 1},
		{2213, 1},
		{2671, 5},
		{2789, 5},
		{2145, 2},
		{5710, 1}
	},
	storage = 19378, -- storage
	onePer = 86400 -- raz na ile (w sekundach)
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getPlayerStorageValue(cid, config.storage) > os.time()) then
		doCreatureSay(cid, "It's empty.", TALKTYPE_ORANGE_1)
		return true
	end
	
	local chanceOfItem = math.random(1, #config.items + 3)
	local itemId, itemCount = config.items[chanceOfItem][1], config.items[chanceOfItem][2]
	
	local oneItem, moreItems = "You found a ".. getItemNameById(config.items[chanceOfItem][1]) ..".", "You found a ".. itemCount .." ".. getItemNameById(config.items[chanceOfItem][1]) .."."
	if(chanceOfItem > #config.items) then
		doCreatureSay(cid, "You found nothing useful.", TALKTYPE_ORANGE_1)
	else
		doCreatureSay(cid, itemCount == 1 and oneItem or moreItems, TALKTYPE_ORANGE_1)
		doPlayerAddItem(cid, config.items[chanceOfItem][1], config.items[chanceOfItem][2])
	end
	setPlayerStorageValue(cid, config.storage, os.time()+config.onePer)
	return true
end
PHP:
<action uniqueid="18300" event="script" value="quests/yalaharquarters.lua" />
I teraz w dany item, dajesz uid 18300 lub taki jak zmienisz w actions.xml

Notka moderatorska:
OT Expert +1
 
Last edited by a moderator:
Status
Not open for further replies.
Top