Unass
Active User
- Joined
- Jul 21, 2010
- Messages
- 123
- Reaction score
- 22
Skrypt polega na automatycznym przyznawianiu Premium Punktow do sms shopu za osiagniecia na serwerze. Przykladowo pierwsza osoba, kt?ra osi?gnie 80 sword fighting otrzyma 100 Premium Points. Podobnie jest z shieldingiem, levelem, axe, club i distance fightingiem.
Przejdzmy do rzeczy..
Najpierw musimy zaj?c sie funkcj?, kt?ra bedzie dodawala punkty do konta.
W tym celu wchodzimy w data/lib i otwieramy plik functions.lua , po czym na koncu dodajemy:
Nastepnie wchodzimy w data/creaturescripts/scripts i tworzymy plik o nazwie events.lua
Musimy zarejestrowac to w creaturescripts.xml
oraz w login.lua
Skrypt napisany w 100% przeze mnie. W razie wszelakich pyta? piszcie na dole.
PHP:
20:16 Congratulations! You are first player with 80 sword fighting and you have gained 100 Premium Points!
Przejdzmy do rzeczy..
Najpierw musimy zaj?c sie funkcj?, kt?ra bedzie dodawala punkty do konta.
W tym celu wchodzimy w data/lib i otwieramy plik functions.lua , po czym na koncu dodajemy:
PHP:
function doAddPoints(cid, points)
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
Nastepnie wchodzimy w data/creaturescripts/scripts i tworzymy plik o nazwie events.lua
PHP:
--Script By Unass--
local skills =
{
[1] = {points = 100, storage = 30701, value = 2, text = "club fighting", level = 80},
[2] = {points = 100, storage = 30702, value = 2, text = "sword fighting", level = 80},
[3] = {points = 100, storage = 30703, value = 2, text = "axe fighting", level = 80},
[4] = {points = 100, storage = 30704, value = 2, text = "distance fighting", level = 80},
[5] = {points = 100, storage = 30705, value = 2, text = "shielding", level = 80},
[8] = {points = 100, storage = 30706, value = 2, text = "level", level = 100}
}
function onAdvance(cid, skill, oldLevel, newLevel)
local x = skills[skill]
if getGlobalStorageValue(x.storage) < x.value and getPlayerStorageValue(cid, x.storage) ~= x.value and getPlayerSkillLevel(cid, skill) >= x.level and skills[skill] then
doAddPoints(cid, x.points)
setGlobalStorageValue(x.storage, x.value)
setPlayerStorageValue(cid, x.storage, x.value)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You are first player with ".. x.level .." ".. x.text .." and you have gained ".. x.points .." Premium Points!")
end
return true
end
Musimy zarejestrowac to w creaturescripts.xml
PHP:
<event type="advance" name="Events" event="script" value="events.lua"/>
oraz w login.lua
registerCreatureEvent(cid, "Events")
Skrypt napisany w 100% przeze mnie. W razie wszelakich pyta? piszcie na dole.