What's new

Skrypty & Kody Dodanie do przedmiotu czasu na u?ycie.

Status
Not open for further replies.

VencenzoCapone

Active User
Joined
Nov 21, 2010
Messages
57
Reaction score
2
Witam,
Prosz? o pomoc w dodaniu do skryptu czasu na jego u?ycie. Czyli np. chcia? bym aby przedmiotu mo?na by?o u?ywa? co 6 godzin.
Oto skrypt :
function onUse(cid, item, fromPosition, itemEx, toPosition)

if getPlayerStorageValue(cid,1301) == 2 then
doCreatureSay(cid, "You can only use this scroll once!", TALKTYPE_ORANGE_1)

else if getPlayerLevel(cid) >= 8 then
doCreatureSay(cid, "You Gained 80 000 000 Experience Points!", TALKTYPE_ORANGE_1)
doPlayerAddExp(cid, 80000000)
doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
doRemoveItem(item.uid)

return TRUE
else
doCreatureSay(cid, "You must be over level 8 to use this scroll", TALKTYPE_ORANGE_1)
end
end
end
Z g?ry dzi?kuj? i pozdrawiam.
 

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: Dodanie do przedmiotu czasu na u?ycie.

Nie wiem czy zadzia?a, powinno:
[lua]local expAmount = 80000000
local levelRequied = 8
local exhStorage = 1301
local exhausted = 6 * 60 --w minutach

function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerLevel(cid) < levelRequied then
return doCreatureSay(cid, "You must be over level 8 to use this scroll", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(cid, exhStorage) >= os.time() then
return doCreatureSay(cid, "You can only use this scroll only one of " .. exhausted .. " minutes.", TALKTYPE_ORANGE_1)
end
doCreatureSay(cid, "You Gained " .. expAmount .. " Experience Points!", TALKTYPE_ORANGE_1)
doPlayerAddExp(cid, expAmount)
doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
doRemoveItem(item.uid)
return doCreatureSetStorage(cid, exhStorage, os.time() + (exhausted * 60))
end[/lua]
 
Status
Not open for further replies.
Top