What's new

Lua Functions Achievements system

Sooh

Advanced User
Joined
Jun 26, 2014
Messages
489
Reaction score
26
Age
28
Witajcie, udost?pniam wam m?j system odznak, le?y na dysku i si? kurzy.

Code:
Spos?b u?ycia np. dodaj?c 1 linijk? funkcji do action/talkaction/movement itd...

a) achievement(cid, 11000, "Beginner")
b) achievement(cid, 11000, "Best Killer", 50)

a = Wywo?anie natychmiastowe
b = Wywo?anie x razach.

Przyk?adowy skrypt
[lua]
function onUse(cid, item, fromPosition, itemEx, toPosition)
achievement(cid, 91000, "ViP ")
return true
end
[/lua]

Code:
Robimy plik o nazwie achievements.lua w ../data/libs

[lua]
function achievement(cid, storage, name, count)

if (not(count)) then
if (getPlayerStorageValue(cid, storage) < 1) then
doPlayerSendTextMessage(cid, MSG_ADVANCE, "Congratulations! You earned the achievement \"" .. name .. "\".")
doPlayerSetStorageValue(cid, storage, 1)
end
end

if (count) then
if (getPlayerStorageValue(cid, storage) == count - 1) then
doPlayerSendTextMessage(cid, MSG_ADVANCE, "Congratulations! You earned the achievement \"" .. name .. "\".")
setPlayerStorageValue(cid, storage, getCreatureStorage(cid, storage) + 1)
else
if (getPlayerStorageValue(cid, storage) == -1) then
setPlayerStorageValue(cid, storage, 1)
else
if not(getPlayerStorageValue(cid, storage) == count) then
setPlayerStorageValue(cid, storage, getCreatureStorage(cid, storage) + 1)
end
end
end
end

return true
end
[/lua]
 

kaka492

User
Joined
May 4, 2015
Messages
47
Reaction score
0
Odp: Achievements system

Kurde, ratujesz mi zycie, jak raz mi sie przyda? :)
 
Top