• logo_cipsoft
    Nowe serwery zostały otwarte 27 Sie 2025:
    Escura (Retro Open PvP) Mystera (Retro Open PvP) us_logo Penumbra (Retro Open PvP)

Nagrody za dany level - skrypt

Status
Zamknięty.

Colusek

Active User
Dołączył
Marzec 21, 2010
Posty
98
Liczba reakcji
3
Wiek
30
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:
Kod:
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?.
 
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
 
Status
Zamknięty.
Do góry