• logo_cipsoft
    Nowe serwery zostały otwarte 19 Lut 2025:
    Noctalia (Open PvP) Ignitera (Open PvP) us_logo Xybra (Open PvP)

Creaturescripts pp i cc za wbicie lvl

Status
Zamknięty.

reaper16

Active User
Dołączył
Styczeń 15, 2009
Posty
64
Liczba reakcji
5
script na cc
Kod:
function onAdvance(cid, type, oldlevel, newlevel) 
if (oldlevel ~= newlevel and type == SKILL__LEVEL) then 
if (newlevel >= 50 and getPlayerStorageValue(cid, 44562) == -1) then 
doPlayerAddItem(cid, 2160, 5)
doPlayerSendTextMessage(cid,21,'Congratulations! You have reached level 50! As a special bonus Materia administrators, you have received 5 Cristal Coins.') 
setPlayerStorageValue(cid, 44562, 1) 
end 
end 
return true 
end
if (newlevel >= 50 -lvl za kt?ry dostajemy cc
doPlayerAddItem(cid, 2160, 5) -ilo?? cc

script na pp
Kod:
local config = { 
levelReach = 500,
points = 100 
} 
function onAdvance(cid, skill, oldLevel, newLevel) 
if(skill == SKILL__LEVEL and newLevel >= config.levelReach and getPlayerStorageValue(cid, 58558) == -1) then 
setPlayerStorageValue(cid, 58558, 1) 
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points`+"..config.points.." WHERE `id` = "..getPlayerAccountId(cid)..";") 
doPlayerSendTextMessage(cid,21,'Congratulations! You have reached level 500! As a special bonus Materia administrators, you have received 100 premium points.') 
end 
return TRUE 
end

levelReach = 500, -- level, za kt?ry dostajemy pkt
points = 100 -- ilo?? otrzymanych pkt
 
Odp: pp i cc za wbicie lvl

Co tu tlumaczyc?
Kiedy postac wbije dany lvl, dostanie nagrode. Kiedy dostanie nagrode, zostanie zmienione storage i dizeki temu nie bedzie mogl dostac 2 raz nagrody za ten sam lvl.
W pierwszym skrypcie masz:
doPlayerAddItem
Czyli dodawanie itemow o id ktore jest dalej i w ilosci ktora jest podana dalej w tej linijce.
2 skrypt dziala tak samo, tylko, ze zamiast cc jest dodawany premium points.
W 2 skrypcie masz:
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points`+"..config.points.." WHERE `id` = "..getPlayerAccountId(cid)..";")
To dodaje punkty do sms shopu. Liczba jest okreslana w configu wyzej. Lvl tak samo.
 
Odp: pp i cc za wbicie lvl

mam jeszcze cos takiego

doPlayerAddItem(cid,8910,1)
8910 -id itemu
1- ilosc.

data/creaturescripts/scripts/itemadvance.lua
Kod:
local text = "You have been rewared 25cc and item your progress!" --Text when he gets level 50
function onAdvance(cid, skill, oldLevel, newLevel)
queststatus = getPlayerStorageValue(cid,44569)
if getPlayerLevel(cid) > 50 and queststatus == -1 then
        if isDruid(cid) == TRUE then
        doPlayerAddItem(cid,2160,25)
        doPlayerAddItem(cid,8910,1)
        doPlayerSendTextMessage(cid,22,text)
        setPlayerStorageValue(cid, 44569, 1)
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_YELLOW)
        elseif isKnight(cid) == TRUE then
        doPlayerAddItem(cid,2432,1)
        doPlayerAddItem(cid,2436,1)
        doPlayerAddItem(cid,2407,1)
        doPlayerAddItem(cid,2160,25)
        setPlayerStorageValue(cid, 44569, 1)
        doPlayerSendTextMessage(cid,22,text)
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_YELLOW)
        elseif isPaladin(cid) == TRUE then
        doPlayerAddItem(cid,2547,1)
        doPlayerAddItem(cid,2160,25)
        setPlayerStorageValue(cid, 44569, 1)
        doPlayerSendTextMessage(cid,22,text)
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_YELLOW)
        elseif isSorcerer(cid) == TRUE then
        doPlayerAddItem(cid,2160,25)
        doPlayerAddItem(cid,8922,1)
        setPlayerStorageValue(cid, 44569, 1)
        doPlayerSendTextMessage(cid,22,text)
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_YELLOW)
        end
end
return TRUE
end
data/creaturescripts/creaturescripts.xml
Kod:
<event type="advance" name="Advanceitems" event="script" value="itemadvance.lua"/>

data/creaturescripts/scripts/login.lua
znajdujesz:

Kod:
registerCreatureEvent(cid, "GuildMotd")

i wklejasz pod tym:

Kod:
registerCreatureEvent(cid, "Advanceitems")
script ten daje poczatkowe itemy oraz 25 cc za wbicie 50 lvl
 
Odp: pp i cc za wbicie lvl

Mo?na te? tak:
PHP:
local config = {
				storage = 1233,
				[10] = {rewards = {'points',10,'cash',5000}},
				[20] = {rewards = {'points',10,'cash',25000}},
				[50] = {rewards = {'points',20,'cash',25000}},
				}

local function doPlayerAddPremiumPoints(cid, points)
return db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points`+"..points.." WHERE `id` = "..getPlayerAccountId(cid)..";")
end

function onAdvance(cid, type, oldlevel, newlevel)
local l = config[newlevel]
if l and getPlayerStorageValue(cid, config.storage) < newlevel then
	for i = 1, #v.rewards/2 do
		if v.rewards[i*2-1] == 'points' then
			doPlayerAddPremiumPoints(cid, v.rewards[i*2])
		elseif v.rewards[i*2-1] == 'cash' then
			doPlayerAddMoney(cid, v.rewards[i*2])
		end
	end
	return doPlayerSetStorageValue(cid, config.storage, newlevel)
end
return true
end
W indexach s? progi lvlowe, reszta configu chyba jest oczywista.
 
Odp: pp i cc za wbicie lvl

Z?y dzia?, to powinno by? w creaturescripts. Moja przer?bka itemsadvance.lua (?atwiejsze do w?asnego ustawienia), reszta jak w postach wy?ej.
PHP:
local text = "You have been rewared 25cc and item your progress!" --Text when he gets level 50
local storage = 44569
local items = {
	[1] = {[2160] = 25, 8922},
	[2] = {[2160] = 25, 8910},
	[3] = {[2160] = 25, 2547},
	[4] = {[2160] = 25, 2407, 2436, 2432}
	}
function onAdvance(cid, skill, oldLevel, newLevel)
	if(getPlayerStorageValue(cid, storage) == 1 or getPlayerLevel(cid) < 50) then
		return true
	end
	local voc = getPlayerVocation(cid)
	while voc > 4 do
		voc = voc - 4
	end
	if(items[voc] == nil) then
		print("Error: creaturescripst/scripts/itemsadvance.lua - no items for vocation id: " .. voc .. ".")
		return true
	end
	for k, v in pairs(items[voc]) do
		if(k > 1500) then -- jesli okreslasz ilosc dodawanych itemow to wykona sie cos pod tym (nie wiesz o co biega to nie dotykaj)
			doPlayerAddItem(cid, k, v)
		else
			doPlayerAddItem(cid, v, 1)
		end
	end
	setPlayerStorageValue(cid, storage, 1)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_YELLOW)
return true
end


u?ywaj opcji raportuj jak jest z?y dzia? ...
 
Odp: pp i cc za wbicie lvl

Super skrypty,chcia?em je wgra? na mojego ots ale pojawi? si? problem gdzie mam wgra? te 2 skrypty na cc i pkt.mam na my?li posta Reaper16.Prosz? o szybk? pomoc.
 
Status
Zamknięty.
Do góry