Sooh
Advanced User
- Joined
- Jun 26, 2014
- Messages
- 489
- Reaction score
- 26
- Age
- 30
Witajcie, udost?pniam wam m?j system odznak, le?y na dysku i si? kurzy.
Przyk?adowy skrypt
[lua]
function onUse(cid, item, fromPosition, itemEx, toPosition)
achievement(cid, 91000, "ViP ")
return true
end
[/lua]
[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]
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]