What's new

Creaturescripts [KONKURS] Punkty za Level.

Status
Not open for further replies.

Maniucza

Advanced User
Joined
Jan 18, 2009
Messages
374
Reaction score
57
Gdy owy gracz zdob?dzie dany level (ustawiony w configu skryptu) dostanie darmowe premium points do sms-shopu.

DATA/creaturescripts/NAZWA.lua

Code:
local config = {
---	[level]= ilosc pkt, wolne storage --
	[100] = {pkt = 50, storage = 9254},
	[200] = {pkt = 50, storage = 9250},
	[300] = {pkt = 150, storage = 9251},
	[400] = {pkt = 200, storage = 9252},
	[500] = {pkt = 300, storage = 9253},
	[600] = {pkt = 450, storage = 9266}
}

function onAdvance(cid, skill, oldLevel, newLevel) 
	if skill == SKILL__LEVEL then
		for k, v in pairs(config) do
			if k == newLevel and getCreatureStorage(cid, v.storage) <= 0 then
				doCreatureSetStorage(cid, v.storage, 1)
			
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Congratulations! You have reached level ' .. newLevel .. ', you have received ' .. v.pkt .. ' premium points.')
				db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. v.pkt .. " WHERE `id` = " .. getPlayerAccountId(cid))
				break
			end
		end
	end	
	return true
end

Data/creaturescripts.xml

PHP:
	<event type="advance" name="points" event="script" value="NAZWA.lua"/>

Do login.php

PHP:
	registerCreatureEvent(cid, "NAZWA")

Zabraniam kopiowania zawarto?ci na inne fora/serwisy - za? je?li ju? si? owy skrypt znalaz? oznacza to, i? zosta? niegdy? dodany przeze mnie, b?dz te? za moj? zgod?.

Notka moderatorska:
+ 10pkt w konkursie
 

Tayan

Advanced User
Joined
Oct 20, 2012
Messages
243
Reaction score
13
Odp: [KONKURS] Punkty za Level.

?atwy, dobry, prosty skrypt. Wydaje mi si?, ?e gdzie? go ju? widzia?em, ale mniejsza. Reputacja si? nale?y.
 
Status
Not open for further replies.
Top