What's new

-Skrypt [Lua] Exhausted i Dzielenie liczb(czasu)

Status
Not open for further replies.

Oskar1415

Advanced User
Joined
Feb 25, 2009
Messages
381
Reaction score
22
Witam. Dodalem itemek na otsie kt?ry mo?na u?y? tylko co 12godzin.



14_11_2014__00_15_33



Czy da?o by si? zrobi? ?eby pisa?o np. "Nastepne uzycie za 9 godzin i 24minuty!" ?
 

Fardos

Senior User
Joined
Mar 21, 2009
Messages
868
Reaction score
34
Odp: [Lua] Exhausted i Dzielenie liczb(czasu)

spr?buj wrzuci? sobie to, ostrzegam nie testowane:


[LUA]function onUse(cid, item, fromPosition, itemEx, toPosition)


local storage = 34239
local exhausted_seconds = 43200 --- ustawiasz co ile mozna
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds *60)

doPlayerSendCancel(cid, "Mozesz uzyc Exp Scrolla tylko co 12H")

doPlayerSendTextMessage(cid,MESSAGE_STATUS_SMALL,"Mozesz uzyc tylko co 12H. Nastepne uzycie za ".. cid,MESSAGE_STATUS_SMALL,"Mozesz uzyc tylko co 12H. Nastepne uzycie za ".. setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds *60)..."

return 0
end
exhaustion.set(cid, storage, exhaustionInSeconds)

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[/LUA]

Je?li skrypt zadzia?a a * nie b?dzie chcia?o chodzi? spr?buj z / : P a je?li nie to nie wiem ^ ^"
 

Oskar1415

Advanced User
Joined
Feb 25, 2009
Messages
381
Reaction score
22
Odp: [Lua] Exhausted i Dzielenie liczb(czasu)

S? b??dy w konsoli przy ?adowaniu skryptu
[21:16:25.496] [Error - LuaInterface::loadFile] data/actions/scripts/expscroll.l
ua:10: ')' expected near '...'
[21:16:25.496] [Warning - Event::loadScript] Cannot load script (data/actions/sc
ripts/expscroll.lua)
[21:16:25.496] data/actions/scripts/expscroll.lua:10: ')' expected near '...'
 

Oskar1415

Advanced User
Joined
Feb 25, 2009
Messages
381
Reaction score
22
Odp: [Lua] Exhausted i Dzielenie liczb(czasu)

Od?wie?am
 

Oskar1415

Advanced User
Joined
Feb 25, 2009
Messages
381
Reaction score
22
Odp: [Lua] Exhausted i Dzielenie liczb(czasu)

Od?wie?am
 

zwyklyPionek

Active User
Joined
Oct 25, 2014
Messages
148
Reaction score
6
Odp: [Lua] Exhausted i Dzielenie liczb(czasu)

Skoro nie potrafisz upora? si? z takim b??dem wyjd? nierobie czekaj?cy na gotowce.
 

Oskar1415

Advanced User
Joined
Feb 25, 2009
Messages
381
Reaction score
22
Odp: [Lua] Exhausted i Dzielenie liczb(czasu)

@up
Je?li chodzi o ten b??d to go naprawi?em a? taki g?upi nie jestem za jakiego mnie uwa?asz ;] z?e skopiowa?em b??dy z konsoli

doPlayerSendTextMessage(cid,MESSAGE_STATUS_SMALL," Mozesz uzyc tylko co 12H. Nastepne uzycie za ".. setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds *60) ..".")

I pomys? zanim nazwiesz kogo? nierobem. Pozdrawiam

Ale dalej nie dzia?a


[18:45:33.339] [Error - Action Interface]
[18:45:33.339] data/actions/scripts/expscroll.lua:eek:nUse
[18:45:33.339] Description:
[18:45:33.339] data/actions/scripts/expscroll.lua:11: attempt to concatenate a b
oolean value
[18:45:33.339] stack traceback:
[18:45:33.339] data/actions/scripts/expscroll.lua:11: in function <data/actions
/scripts/expscroll.lua:1>

Nie wiem o co tu chodzi :/ B??d wywala wtedy jak u?y?em ju? raz Exp Scrolla i chce u?y? go drugi raz to wtedy powinien pojawi? si? ten napis co up ale wywala b??d
 
Last edited:

De$t

Active User
Joined
Nov 20, 2008
Messages
148
Reaction score
27
Odp: [Lua] Exhausted i Dzielenie liczb(czasu)

Zobacz czy to zadzia?a, bo nie testowa?em:

[LUA]function onUse(cid, item, fromPosition, itemEx, toPosition)

local exhaustionInSeconds = 43200
local storage = 34239
if(exhaustion.check(cid, storage) == true) then
local sec = getPlayerStorageValue(cid,"34239")-os.time()
local hours = sec/3600
local minuts = (sec - (hours*3600))/60
doPlayerSendCancel(cid, "Mozesz uzyc Exp Scrolla tylko co 12H")
doPlayerSendTextMessage(cid,MESSAGE_STATUS_SMALL,"Mozesz uzyc tylko co 12H. Nastepne uzycie za ".. hours .."h ".. minuts .."min.")
return 0
end
exhaustion.set(cid, storage, exhaustionInSeconds)

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[/LUA]
 

Oskar1415

Advanced User
Joined
Feb 25, 2009
Messages
381
Reaction score
22
Odp: [Lua] Exhausted i Dzielenie liczb(czasu)

Dzia?a ale nie do ko?ca tzn. wy?wietla taki napis
ygzwwhkauyyxtucaifpkplzbtrnraaylwlwqeijfydolljlryvzydelmhydfttauznahxlvzwjllxopkfwtebahsajjgfdmfdulyidtnzzcusaptisawzvszfihobptt


Niestety nie wiem jak zrobi? ?eby nie by?o tej liczby po przecinku 11.9994...h
 

De$t

Active User
Joined
Nov 20, 2008
Messages
148
Reaction score
27
Odp: [Lua] Exhausted i Dzielenie liczb(czasu)

Mo?e tak:

[LUA]function onUse(cid, item, fromPosition, itemEx, toPosition)

local exhaustionInSeconds = 43200
local storage = 34239
if(exhaustion.check(cid, storage) == true) then
local sec = getPlayerStorageValue(cid,"34239")-os.time()
local hours = math.floor(sec/3600)
local minuts = math.floor((sec - (hours*3600))/60)
doPlayerSendCancel(cid, "Mozesz uzyc Exp Scrolla tylko co 12H")
doPlayerSendTextMessage(cid,MESSAGE_STATUS_SMALL," Mozesz uzyc tylko co 12H. Nastepne uzycie za ".. hours .."h ".. minuts .."min.")
return 0
end
exhaustion.set(cid, storage, exhaustionInSeconds)

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[/LUA]
 

Oskar1415

Advanced User
Joined
Feb 25, 2009
Messages
381
Reaction score
22
Odp: [Lua] Exhausted i Dzielenie liczb(czasu)

Wszystko dzia?a :)

lxkucblgximgthujqxxeeyjyxiumpocqwkkqoewykmfqylkpwuqsqirmolxtgzrjfwjiwdumaytrsszmyepuxkzotxccgcrlvvkcbbttadrrozuwllvckwmvwvpzasfy


Dzi?kuje i pozdrawiam
 
Status
Not open for further replies.
Top