What's new

Nagrody za dany level - skrypt

Status
Not open for further replies.

Colusek

Active User
Joined
Mar 21, 2010
Messages
98
Reaction score
3
Age
29
Witam,

Ot?? mam taki skrypcik - oczywi?cie nie mojego autorstwa - kt?ry powinien dawa? nagrody za dany level. Nagrody s? w punktach i CC. No oczywi?cie skrypt mi w og?le nie dzia?a mimo tego, ?e nie wywala ?adnego b??du w silniku.

Oto skrypt:
Code:
function onAdvance(cid, type, oldlevel, newlevel) 
    local config = {
        storage = 98960,
        levels = {
        [25] = {itemId = 2160, itemCount = 1, storageValue = 6, pp = 1},
        [50] = {itemId = 2160, itemCount = 3, storageValue = 5, pp = 1},
        [100] = {itemId = 2160, itemCount = 5, storageValue = 4, pp = 25},
        [150] = {itemId = 2160, itemCount = 5, storageValue = 3, pp = 50},
        [200] = {itemId = 2160, itemCount = 10, storageValue = 2, pp = 50},
        [250] = {itemId = 2160, itemCount = 10, storageValue = 1, pp = 60}}}
    local param = string.lower(param)
    if isPlayer(cid)
then
        if (oldlevel ~= newlevel and type == SKILL__LEVEL) then
            if (newlevel == config.levels[param] and getPlayerStorageValue(cid, config.storage) < config.level[param].storageValue) then
                doPlayerAddItem(cid, config.levels[param].itemId, config.levels[param].itemCount)
                db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points`+"..config.levels[param].pp.." WHERE `id` = "..getPlayerAccountId(cid)..";") 
                doPlayerSendTextMessage(cid, 21 ,'Congratulations! You have reached level ' ..newLevel.. '! You have received 5 Cristal Coins.') 
                setPlayerStorageValue(cid, config.storage, config.levels[param].storageValue) 
            end 
        end
    end
    return true 
end

Oczywi?cie je?eli kto? ma inny skrypt i chcia?by si? nim podzieli? to bardzo prosz? :p

Z g?ry dzi?kuj?.
 
Joined
Aug 27, 2011
Messages
30
Reaction score
2
Odp: Nagrody za dany level - skrypt

dzieki przyda? mi sie naprawde przydatny skrypt .
 

lexu

Advanced User
Joined
Apr 12, 2010
Messages
151
Reaction score
1
Odp: Nagrody za dany level - skrypt

Przyda si? na m?j ots :)
 

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: Nagrody za dany level - skrypt

PHP:
local config = {
				storage = 98960,
				[25] = {type = 'item', id = 2160, count = 1},
				[50] = {type = 'cash', count = 50000},
				[100] = {type = 'points', count = 120},
				[150] = {type = 'item', id = 2160, count = 5},
				[200] = {type = 'item', id = 2160, count = 10},
				[250] = {type = 'item', id = 2160, count = 10}
				}

function onAdvance(cid, skill, oldlevel, newlevel)
local v = config[newlevel]
if v and skill == SKILL__LEVEL then
	if getPlayerStorageValue(cid, config.storage) < newlevel then
		msg = (v.type == 'item' and v.count .. getItemNameById(v.id) .. '.' or v.type == 'cash' and v.count .. ' gold coins.' or v.type == 'points' and v.count .. ' premium points.' or 'nothing.')
		if v.type == 'item' then
			doPlayerAddItem(cid, v.id, v.count)
		elseif v.type == 'cash' then
			doPlayerAddMoney(cid, v.count)
		elseif v.type == 'points' then
			db.executeQuery('UPDATE `accounts` SET `premium_points` = `premium_points`+'..v.count..' WHERE `id` = '..getPlayerAccountId(cid)..';')
		end
		doPlayerSetStorageValue(cid, config.storage, newlevel)
		return doPlayerSendTextMessage(cid, 21 , 'Congratulations! You have reached level ' ..newLevel.. '! You have received '..msg) 
    end
end
return true 
end
 

Uwaga Meteor

Active User
Joined
Aug 23, 2011
Messages
62
Reaction score
3
Odp: Nagrody za dany level - skrypt

dzieki za skrypt masz + przydal sie ;]
 
Status
Not open for further replies.
Top