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

Prezenty od lvlu (ciekawy skrypt)

Status
Zamknięty.

drozd001

Advanced User
Dołączył
Grudzień 28, 2008
Posty
209
Liczba reakcji
17
OPIS:
Jest to moj 2 skrypt xD, i robilem go jeszcze bez petli, poniewaz niedlugo zaczne sie ich dopiero uczyc :D ok Napisze na czym polega skrypt. Wbijamy 10lvl, naciskamy na choinke i dostajemy np knight armor, pojawia nam sie wiadomosc, ze nast?pny prezent na 100lvl. Wbijamy wiec 100lvl, naciskamy na choinke i dostajemy 100cc, pojawia nam sie wiadomosc, ze nastepny prezent na 200lvl. I tak dalej, ja w tym skrypcie zrobilem, ?e mozna wziasc 4 razy prezent na roznych lvl. LVLe do prezent?w i itemki na tych lvlach sa do ustalenia w skrypcie wszystko wytlumacze potem. Skrypt nie tylko mozna wykozysta? nie tylko jako choinke ale rowniez inny item jako np quest, ktory mozna wykonac 4 krotnie na roznych lvlach. Ok zaczynamy
SKRYPT:
Wchodzimy w folder actions i tworzymy plik prezenty.lua
I wklejamy ten kod:
Kod:
-- Skrypt by Drozd --
function onUse(cid, item, fromPosition, itemEx, toPosition)
local config = {poziom3 = 800000 , poziom2 = 500000 , poziom1 = 100000 , poziom = [COLOR="Red"]10[/COLOR] , item3 = 2144 , item2 = 2143 , item1 = 2142 , item = [COLOR="Blue"]2141[/COLOR] , ilosc3 = 1 , ilosc2 = 1 , ilosc1 = 1 , ilosc = [COLOR="Magenta"]1[/COLOR] , storage = 2892}
if getPlayerStorageValue(cid, config.storage) == 4 then
doPlayerSendTextMessage(cid,22,"Wzieles juz wszystkie prezenty")
else
if getPlayerLevel(cid) >= config.poziom3 and getPlayerStorageValue(cid, config.storage) == 3 then
doPlayerAddItem(cid, config.item3, config.ilosc3)
doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom3 .. " lvlu")
setPlayerStorageValue(cid,config.storage, 4)
else
if getPlayerLevel(cid) >= config.poziom2 and getPlayerStorageValue(cid, config.storage) == 2 then
doPlayerAddItem(cid, config.item2, config.ilosc2)
doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom2 .. " lvlu nastepny prezent na " .. config.poziom3 .. " lvlu ")
setPlayerStorageValue(cid,config.storage, 3)
else
if getPlayerLevel(cid) >= config.poziom1 and getPlayerStorageValue(cid, config.storage) == 1 then
doPlayerAddItem(cid, config.item1, config.ilosc1)
doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom1 .. " lvlu nastepny prezent na " .. config.poziom2 .. " lvlu")
setPlayerStorageValue(cid,config.storage, 2)
else
if getPlayerLevel(cid) >= config.poziom and getPlayerStorageValue(cid, config.storage) == -1 then
doPlayerAddItem(cid, config.item, config.ilosc)
doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom .. " lvlu nastepny prezent na " .. config.poziom1 .." lvlu")
setPlayerStorageValue(cid,config.storage, 1)
else
doPlayerSendTextMessage(cid,22,"Wbij wiekszy lvl i wes prezent")
end
end
end
end
end
return 1
end
Teraz wklejamy ta linijke do actions.xml
Kod:
<action itemid="[COLOR="SeaGreen"]2105[/COLOR]" script="prezenty.lua" />
KONFIGURACJA:
Tam gdzie kolor czerwony wpisujemy jaki lvl bedzie potrzebny jako 1 do wziecia prezentu.
Tam gdzie kolor niebieski wpisujemy jakie id itemu bedzie naszym 1 prezentem
Tam gdzie kolor r??owy wpisujemy ile itemow mamy otrzymac jako 1 prezent czyli np jak prezent bedzie cc to tutaj wpisujemy ile ich ma byc.
Tam gdzie kolor zielony wpisujemy id na jakim itemie ma dzialac ten skrypt (podstawowo wpisane jest id choinki)
Z poziom1, poziom2, poziom3 robimy tak samo jak wyzej czyli jak np poziom1 to ustawiamy kolejny poziom jaki ma byc potrzebny do wziecia preznetu
Z item1, item2, item3 robimy tak samo jak wyzej czyli jak np item1 to ustawiamy kolejny item jaki dostaniemy jako prezent po wbiciu nastepnego lvlu czyli poziom1
Z ilosc1, ilosc2, ilosc3 robimy tak samo jak wyzej na rozowo jest podkreslone
I to koniec. Skrypt wykonany w 100% by Drozd i sprawdzony. Prosze komentowac jesli ktos czegos nie rozumie to pisac na gg: 2377081 chetnie pomoge skonfigurowac.
SKRYPT BY? TESTOWANY I DZIA?A POPRAWNIE
 
Odp: Prezenty od lvlu (ciekawy skrypt)

Pomys? - Dobry
Stylistyka skryptu - Do Bani
Stosuj wci?cia to pomaga ! U?ywaj Notepad++ !
U?ywaj 'end' po ka?dym if'ie i stosuj 'return 0' gdy dana czynno?? zosta?a wykonana i nic wi?cej si? w skrypcie nie wykona..I nie pisz skryptu do g?ry nogami :P (te 'else' s? nie potrzebne) .. czyli to powinno wygl?da? tak:
PHP:
-- Skrypt by Drozd --
  -- Fixed by Leon Zawodowiec --
function onUse(cid, item, fromPosition, itemEx, toPosition)
local config = {
		poziom3 = 800, 
		poziom2 = 500, 
		poziom1 = 100, 
		poziom = 10, 
		item3 = 2144, 
		item2 = 2143, 
		item1 = 2142, 
		item = 2141, 
		ilosc3 = 1, 
		ilosc2 = 1, 
		ilosc1 = 1, 
		ilosc = 1, 
		storage = 2892
						}
	if getPlayerStorageValue(cid, config.storage) == 4 then
		doPlayerSendTextMessage(cid,22,"Wzieles juz wszystkie prezenty")
		return 0
	end
	if getPlayerLevel(cid) >= config.poziom3 and getPlayerStorageValue(cid, config.storage) == 3 then
		doPlayerAddItem(cid, config.item3, config.ilosc3)
		doPlayerSendTextMessage(cid,22,"Otrzymujesz ostatni prezent na " .. config.poziom3 .. " lvlu")
		setPlayerStorageValue(cid,config.storage, 4)
		return 0
	end
	if getPlayerLevel(cid) >= config.poziom2 and getPlayerStorageValue(cid, config.storage) == 2 then
		doPlayerAddItem(cid, config.item2, config.ilosc2)
		doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom2 .. " lvlu nastepny prezent na " .. config.poziom3 .. " lvlu ")
		setPlayerStorageValue(cid,config.storage, 3)
		return 0
	end
	if getPlayerLevel(cid) >= config.poziom1 and getPlayerStorageValue(cid, config.storage) == 1 then
		doPlayerAddItem(cid, config.item1, config.ilosc1)
		doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom1 .. " lvlu nastepny prezent na " .. config.poziom2 .. " lvlu")
		setPlayerStorageValue(cid,config.storage, 2)
		return 0
	end
	if getPlayerLevel(cid) >= config.poziom and getPlayerStorageValue(cid, config.storage) == -1 then
		doPlayerAddItem(cid, config.item, config.ilosc)
		doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom .. " lvlu nastepny prezent na " .. config.poziom1 .." lvlu")
		setPlayerStorageValue(cid,config.storage, 1)
		return 0
	end
end
 
Odp: Prezenty od lvlu (ciekawy skrypt)

:) Widze ze si? uczysz, chocia? wed?ug mnie kilka funkcji nie potrzebnie, nie lepiej by
Kod:
-- Skrypt by Drozd // Edited by Arkam Shadow --
function onUse(cid, item, fromPosition, itemEx, toPosition)
local config = {item3 = 2144 , 
				item2 = 2143 , 
				item1 = 2142 , 
				item = 2141 , 
				ilosc = 1 ,
				storage = 2892
				}
local poziomy = {
				poziom = 100 ,
				poziom1 = 200 ,
				poziom2 = 300 ,
				poziom3 = 400 
				}
				---Zrodla--
if getPlayerLevel(cid) >= 1 then
doPlayerSendTextMessage(cid,22,"Prezenty otrzymujesz na lvlach 100, 200, 300, 400")
	elseif getPlayerStorageValue(cid, config.storage) == 4 then
	doPlayerSendTextMessage(cid,22,"Wzieles juz wszystkie prezenty")
		elseif getPlayerLevel(cid) >= poziomy.poziom3 and getPlayerStorageValue(cid, config.storage) == 3 then
		doPlayerAddItem(cid, config.item3, config.ilosc)
		setPlayerStorageValue(cid,config.storage, 4)
			elseif getPlayerLevel(cid) >= poziomy.poziom2 and getPlayerStorageValue(cid, config.storage) == 2 then
			doPlayerAddItem(cid, config.item2, config.ilosc)
			setPlayerStorageValue(cid,config.storage, 3)
		elseif getPlayerLevel(cid) >= poziomy.poziom1 and getPlayerStorageValue(cid, config.storage) == 1 then
		doPlayerAddItem(cid, config.item1, config.ilosc)
		setPlayerStorageValue(cid,config.storage, 2)
	elseif getPlayerLevel(cid) >= poziomy.poziom and getPlayerStorageValue(cid, config.storage) == -1 then
	doPlayerAddItem(cid, config.item, config.ilosc)
	setPlayerStorageValue(cid,config.storage, 1)
				else
				doPlayerSendTextMessage(cid,22,"Wbij wiekszy lvl i wes prezent")
			end
	return true
end
??;p no ucz si? ucz, a nie d?ugo b?dziesz Mistrzem xd.
 
Odp: Prezenty od lvlu (ciekawy skrypt)

Ey Mag Egzorcysta a mam pytanie czy tak by by?o dobrze ?
Kod:
-- Skrypt by Drozd -- 
  -- Fixed by Leon Zawodowiec -- 
function onUse(cid, item, fromPosition, itemEx, toPosition) 
local config = { 
        poziom3 = 800,  
        poziom2 = 500,  
        poziom1 = 100,  
        poziom = 10,  
        item3 = 2144,  
        item2 = 2143,  
        item1 = 2142,  
        item = 2141,  
        ilosc3 = 1,  
        ilosc2 = 1,  
        ilosc1 = 1,  
        ilosc = 1,  
        storage = 2892 
                        } 
    if getPlayerStorageValue(cid, config.storage) == 4 then 
        doPlayerSendTextMessage(cid,22,"Wzieles juz wszystkie prezenty") 
    end 
    if getPlayerLevel(cid) >= config.poziom3 and getPlayerStorageValue(cid, config.storage) == 3 then 
        doPlayerAddItem(cid, config.item3, config.ilosc3) 
        doPlayerSendTextMessage(cid,22,"Otrzymujesz ostatni prezent na " .. config.poziom3 .. " lvlu") 
        setPlayerStorageValue(cid,config.storage, 4) 
    end 
    if getPlayerLevel(cid) >= config.poziom2 and getPlayerStorageValue(cid, config.storage) == 2 then 
        doPlayerAddItem(cid, config.item2, config.ilosc2) 
        doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom2 .. " lvlu nastepny prezent na " .. config.poziom3 .. " lvlu ") 
        setPlayerStorageValue(cid,config.storage, 3) 
    end 
    if getPlayerLevel(cid) >= config.poziom1 and getPlayerStorageValue(cid, config.storage) == 1 then 
        doPlayerAddItem(cid, config.item1, config.ilosc1) 
        doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom1 .. " lvlu nastepny prezent na " .. config.poziom2 .. " lvlu") 
        setPlayerStorageValue(cid,config.storage, 2) 
    end 
    if getPlayerLevel(cid) >= config.poziom and getPlayerStorageValue(cid, config.storage) == -1 then 
        doPlayerAddItem(cid, config.item, config.ilosc) 
        doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom .. " lvlu nastepny prezent na " .. config.poziom1 .." lvlu") 
        setPlayerStorageValue(cid,config.storage, 1) 
    else
doSendPlayerTextMessage(cid,22,"Wbij wiekszy lvl i wes prezent")
    end
      return 1
end

I w tedy skrypt by szuka? jaki warunek pasuje a jak by nie znalaz? to tylko trafia? by na else i pisa? by wiadomo?? "Wbij wiekszy lvl i wes prezent"

A return 0 nie moze byc bo skrypt nie bedzie sie powtarzal nacisnie sie raz na choinke i potem sie juz nie bedzie dalo, tak mi tlumaczyla pewna osoba...
 
Odp: Prezenty od lvlu (ciekawy skrypt)

A macie mo?e co? takiego tylko ?e na 8.54?
 
Odp: Prezenty od lvlu (ciekawy skrypt)

Mag Egzorcysta widz? pro skrypter si? odezwa? ;| Cz?owieku nie ucz innych jak sam pope?niasz podstawowe b??dy. Podstawowym b??dem tutaj jest powtarzanie si? instrukcji, a wystarczy stosowa? tablic? i wszystko b?dzie gra?o.Tablice powinny wygl?da? mniej wi?cej tak:
PHP:
local config = 
{
storage = 1234,
rewards =
{
[0] = {nagroda, ilosc, poziom},
[1] = {nagroda, ilosc, poziom},
[2] = {nagroda, ilosc, poziom},
[3] = {nagroda, ilosc, poziom}
},
}
 
Odp: Prezenty od lvlu (ciekawy skrypt)

Tairens a m?g?by? pokaza? kawa?ek skryptu z zastosowaniem tej tablicy ??
 
Odp: Prezenty od lvlu (ciekawy skrypt)

Tairens, nie m?wi?, ?e jestem Pr0. Nie lubi? tablic i ich lekko nie ogarniam.. Dlatego ich nie u?ywam.
 
Odp: Prezenty od lvlu (ciekawy skrypt)

Kod:
setPlayerStorageValue(cid,config.storage, 1)
				else
				doPlayerSendTextMessage(cid,22,"Wbij wiekszy lvl i [COLOR="Red"]wes[/COLOR] prezent")
			end
B??d !!! ;p
(pisze si? we?)
Mo?ecie mi zrobi? skrypt na podstawie tego co napisa? [USER]Tairens[/USER] ?
Bardzo bym o to prosi? :)
 
Odp: Prezenty od lvlu (ciekawy skrypt)

Czemu nie:
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition) 
local config = {
				[10] = {za_ile_lvli = 90, jakie_itemy_losowo = {2479,2490,2491}, ilosc = {1,1,1}, storage_value = 0},
				[100] = {za_ile_lvli = 400, jakie_itemy_losowo = {2497,2475,3972}, ilosc = {1,1,1}, storage_value = 1},
				[500] = {za_ile_lvli = 300, jakie_itemy_losowo = {2498,5741,9778}, ilosc = {1,1,1}, storage_value = 2},
				[800] = {jakie_itemy_losowo = {2493,2474,2471}, ilosc = {1,1,1}, storage_value = 3}
				}
local prezent = config[getPlayerLevel(cid)]
local storage = 5354
if not prezent then
return true
end
if item.itemid == 2105 then
	if getPlayerStorageValue(cid, storage) == prezent.storage_value-1 then
		local rand = math.random(1,3)
		doPlayerAddItem(cid, prezent.jakie_itemy_losowo[rand], prezent.ilosc[rand])
		if getPlayerStorageValue(cid, storage) == 3 then
			doPlayerSendTextMessage(cid, 22, "Otrzymujesz ostatni prezent jakim jest "..prezent.ilosc[rand].." "..getItemNameById(prezent.jakie_itemy_losowo[rand]).." na "..getPlayerLevel(cid).." lvlu.") 
		else
			doPlayerSendTextMessage(cid, 22, "Otrzymujesz prezent jakim jest "..prezent.ilosc[rand].." "..getItemNameById(prezent.jakie_itemy_losowo[rand]).." na "..getPlayerLevel(cid).." lvlu nastepny prezent na "..getPlayerLevel(cid) + prezent.za_ile_lvli.." lvlu.")
		end
		setPlayerStorageValue(cid, storage, prezent.storage_value)
	end
end
return true
end
Zadeklaruj w actions.xml itemid choinki.
 
Odp: Prezenty od lvlu (ciekawy skrypt)

Skrypt bardzo ciekawy, dobre wychowanie oraz konfiguracja.
Z pewno?ci? wielu Hoster?w z niego skorzysta.
10/10
Pozdrawiam
 
Odp: Prezenty od lvlu (ciekawy skrypt)

Wszystkim z OTS podoba sie skrypt DZIEKI !!!!
 
Odp: Prezenty od lvlu (ciekawy skrypt)

Ludziom z OTS bardzo si? podoba bardzo fajny skrypt tylko jak daje ?eby dawa?o wi?cej items to nie dzia?a w og?le choinka. Wiec mo?e kto? da? code jaki ma by? ?eby sz?o zdobyc wi?cej items a nie tylko 4
 
Odp: Prezenty od lvlu (ciekawy skrypt)

A na ile prezent?w chcesz ? mog? ci zrobi?...


Sprawdzone na silniku Aries'a 8.1


Tu jest ten sam skrypt 8.1 na 5 prezent?w :
Kod:
-- Skrypt by Drozd --
-- Fixed by Leon Zawodowiec --
--/Betrox edit\--
function onUse(cid, item, fromPosition, itemEx, toPosition)
local config = {
        poziom4 = 400, 
        poziom3 = 300, 
        poziom2 = 200, 
        poziom1 = 100, 
        poziom = 50, 
        item4 = 2160, 
        item3 = 2144, 
        item2 = 2143, 
        item1 = 2142, 
        item = 2141, 
        ilosc4 = 100, 
        ilosc3 = 1, 
        ilosc2 = 1, 
        ilosc1 = 1, 
        ilosc = 1, 
        storage = 2892
                        }
    if getPlayerStorageValue(cid, config.storage) == 5 then
        doPlayerSendTextMessage(cid,22,"Wzieles juz wszystkie prezenty")
        return 0
    end
    if getPlayerLevel(cid) >= config.poziom3 and getPlayerStorageValue(cid, config.storage) == 4 then
        doPlayerAddItem(cid, config.item4, config.ilosc4)
        doPlayerSendTextMessage(cid,22,"Otrzymujesz ostatni prezent na " .. config.poziom4 .. " lvlu.")
        setPlayerStorageValue(cid,config.storage, 5)
        return 0
    end
    if getPlayerLevel(cid) >= config.poziom3 and getPlayerStorageValue(cid, config.storage) == 3 then
        doPlayerAddItem(cid, config.item3, config.ilosc3)
        doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom3 .. " lvlu nastepny prezent na " .. config.poziom4 .. " lvlu ")
        setPlayerStorageValue(cid,config.storage, 4)
        return 0
    end
    if getPlayerLevel(cid) >= config.poziom2 and getPlayerStorageValue(cid, config.storage) == 2 then
        doPlayerAddItem(cid, config.item2, config.ilosc2)
        doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom2 .. " lvlu nastepny prezent na " .. config.poziom3 .. " lvlu ")
        setPlayerStorageValue(cid,config.storage, 3)
        return 0
    end
    if getPlayerLevel(cid) >= config.poziom1 and getPlayerStorageValue(cid, config.storage) == 1 then
        doPlayerAddItem(cid, config.item1, config.ilosc1)
        doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom1 .. " lvlu nastepny prezent na " .. config.poziom2 .. " lvlu")
        setPlayerStorageValue(cid,config.storage, 2)
        return 0
    end
    if getPlayerLevel(cid) >= config.poziom and getPlayerStorageValue(cid, config.storage) == -1 then
        doPlayerAddItem(cid, config.item, config.ilosc)
        doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom .. " lvlu nastepny prezent na " .. config.poziom1 .." lvlu")
        setPlayerStorageValue(cid,config.storage, 1)
        return 0
    end
end

A tu na 10 item?w :

Kod:
-- Drozd -- Leon Zawodowiec -- BetroX -10 items --
function onUse(cid, item, fromPosition, itemEx, toPosition)
local config = {
        poziom9 = 900, 
        poziom8 = 800,
        poziom7 = 700, 
        poziom6 = 600, 
        poziom5 = 500, 
        poziom4 = 400, 
        poziom3 = 300, 
        poziom2 = 200, 
        poziom1 = 100, 
        poziom = 50, 
        item9 = 2160, 
        item8 = 2144, 
        item7 = 2143, 
        item6 = 2142, 
        item5 = 2141, 
        item4 = 2160, 
        item3 = 2144, 
        item2 = 2143, 
        item1 = 2142, 
        item = 2141, 
        ilosc9 = 100, 
        ilosc8 = 1, 
        ilosc7 = 1, 
        ilosc6 = 1, 
        ilosc5 = 1,
        ilosc4 = 100, 
        ilosc3 = 1, 
        ilosc2 = 1, 
        ilosc1 = 1, 
        ilosc = 1, 
        storage = 2892
                        }
    if getPlayerStorageValue(cid, config.storage) == 10 then
        doPlayerSendTextMessage(cid,22,"Wzieles juz wszystkie prezenty")
        return 0
    end
	    if getPlayerLevel(cid) >= config.poziom and getPlayerStorageValue(cid, config.storage) == 9 then
        doPlayerAddItem(cid, config.item, config.ilosc)
        doPlayerSendTextMessage(cid,22,"Otrzymujesz ostatni prezent na " .. config.poziom9 .. " lvlu.")
        setPlayerStorageValue(cid,config.storage, 10)
        return 0
    end    if getPlayerLevel(cid) >= config.poziom and getPlayerStorageValue(cid, config.storage) == 8 then
        doPlayerAddItem(cid, config.item, config.ilosc)
        doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom8 .. " lvlu nastepny prezent na " .. config.poziom9 .." lvlu")
        setPlayerStorageValue(cid,config.storage, 9)
        return 0
    end    if getPlayerLevel(cid) >= config.poziom and getPlayerStorageValue(cid, config.storage) == 7 then
        doPlayerAddItem(cid, config.item, config.ilosc)
        doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom7 .. " lvlu nastepny prezent na " .. config.poziom8 .." lvlu")
        setPlayerStorageValue(cid,config.storage, 8)
        return 0
    end    if getPlayerLevel(cid) >= config.poziom and getPlayerStorageValue(cid, config.storage) == 6 then
        doPlayerAddItem(cid, config.item, config.ilosc)
        doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom6 .. " lvlu nastepny prezent na " .. config.poziom7 .." lvlu")
        setPlayerStorageValue(cid,config.storage, 7)
        return 0
    end    if getPlayerLevel(cid) >= config.poziom and getPlayerStorageValue(cid, config.storage) == 5 then
        doPlayerAddItem(cid, config.item, config.ilosc)
        doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom5 .. " lvlu nastepny prezent na " .. config.poziom6 .." lvlu")
        setPlayerStorageValue(cid,config.storage, 6)
        return 0
    end
    if getPlayerLevel(cid) >= config.poziom3 and getPlayerStorageValue(cid, config.storage) == 4 then
        doPlayerAddItem(cid, config.item4, config.ilosc4)
        doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom4 .. " lvlu nastepny prezent na " .. config.poziom5 .. " lvlu ")
        setPlayerStorageValue(cid,config.storage, 5)
        return 0
    end
    if getPlayerLevel(cid) >= config.poziom3 and getPlayerStorageValue(cid, config.storage) == 3 then
        doPlayerAddItem(cid, config.item3, config.ilosc3)
        doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom3 .. " lvlu nastepny prezent na " .. config.poziom4 .. " lvlu ")
        setPlayerStorageValue(cid,config.storage, 4)
        return 0
    end
    if getPlayerLevel(cid) >= config.poziom2 and getPlayerStorageValue(cid, config.storage) == 2 then
        doPlayerAddItem(cid, config.item2, config.ilosc2)
        doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom2 .. " lvlu nastepny prezent na " .. config.poziom3 .. " lvlu ")
        setPlayerStorageValue(cid,config.storage, 3)
        return 0
    end
    if getPlayerLevel(cid) >= config.poziom1 and getPlayerStorageValue(cid, config.storage) == 1 then
        doPlayerAddItem(cid, config.item1, config.ilosc1)
        doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom1 .. " lvlu nastepny prezent na " .. config.poziom2 .. " lvlu")
        setPlayerStorageValue(cid,config.storage, 2)
        return 0
    end
    if getPlayerLevel(cid) >= config.poziom and getPlayerStorageValue(cid, config.storage) == -1 then
        doPlayerAddItem(cid, config.item, config.ilosc)
        doPlayerSendTextMessage(cid,22,"Otrzymujesz prezent na " .. config.poziom .. " lvlu nastepny prezent na " .. config.poziom1 .." lvlu")
        setPlayerStorageValue(cid,config.storage, 1)
        return 0
    end
end
 
Ostatnia edycja:
Odp: Prezenty od lvlu (ciekawy skrypt)

?eby skrypt by? bardziej oszcz?dny mo?na by?oby obra? s?owo item, level i ilo?? jako sta?e, a zmiennymi tylko parametry 1, 2, 3, 4. Tzn:
PHP:
item = {
1 = 2160
2 = 2161
}
I zrobi? takie tablice trzy, oczywi?cie zamiast cyferek 1, 2 itd, ?atwiej dla samego siebie by?oby obra? po prostu poziom.
 
Odp: Prezenty od lvlu (ciekawy skrypt)

Zgodnie z obietnic? dostaniesz tego reputa :D
 
Odp: Prezenty od lvlu (ciekawy skrypt)

Kod:
doPlayerSendTextMessage(cid,22,"[COLOR="Red"]Wzieles[/COLOR] juz wszystkie prezenty")
doPlayerSendTextMessage(cid,22,"Wbij wiekszy lvl i [COLOR="Red"]wes[/COLOR] prezent")

Po?wicz ortografi? i gramatyke :P Pisze si? wzi??e? i we?, a nie wzie?e? :D
Skrypt og?lnie ciekawy, tylko ?e na OTS'ie z tym b?dzie ?atwiej :P
 
Odp: Prezenty od lvlu (ciekawy skrypt)

Wida? te wasze skrypty postanowi?em napisa? dla was bardziej 'konfiguracyjny' ?e tak powiem skrypt. Jednak nie testowany i nie jestem na 100% pewny ?e dzia?a :) Wszelkie b??dy prosz? zg?asza? na pw. Poprawie je je?li b?d? mia? czas.

Skrypt:
-- Adamsiq works
-- Skrypt nie testowany.
-- Adamsiq TFS mod v5.5
-- [level] = {items = {{item,ilosc},{item,ilosc}...}, value = 1}
-- ^ Co linijk? zmieniasz value o +1. ^ np [value = 2 ...]
function onUse(cid, item, fromPosition, itemEx, toPosition)
local cfg = {
storage = 133701, -- Numer zapisu w skrypcie.
}
local adds = {
[1] = {items = {{2160,math.random(10,20)}}, value = 1},
[100] = {items = {{2160,math.random(10,20)}}, value = 2},
-- Dodaje losowo od 10 do 20 cc :) Mo?na doda? wi?cej nagr?d :)
}
-- Start skryptu [Dalej nie radz? edytowa?] --
for i = 1,#adds do
local load = adds
local item = load.items
local checkLevel = adds[getPlayerLevel(cid)]
if checkLevel == true and not checkLevel == "" then
if getPlayerStorageValue(cid,cfg.storage) == load.value then
return true
else
setPlayerStorageValue(cid,cfg.storage,getPlayerStorageValue(cid,cfg.storage)+1)
doPlayerSendTextMessage(cid,19,"Otrzymujesz od nas upominek w postaci:")
for itemki = 1,#item do
doPlayerAddItem(cid,itemki[1],itemki[2] or 1)
if itemki[2] > 1 then
doPlayerSendTextMessage(cid,19,">> "..getItemNameById(itemki[1]).."")
else
doPlayerSendTextMessage(cid,19,">> "..getItemNameById(itemki[1]).." (x"..itemki[2]..")")
end
end
end
else
odPlayerSendTextMessage(cid,19,"Widocznie nie mozesz jeszcze wziac upominku na twoj level.")
end
end
return true
end


Konfiguracja banalna i prosta w zastosowaniu. Ale wiecie to jednak owoc pracy 5 minut wi?c mog? si? pojawi? b??dy.

Pozdrawiam Adamsiq

Jedyne co mo?na poprawi? to config da? przed funkcje. //Sassin
 
Ostatnia edycja:
Odp: Prezenty od lvlu (ciekawy skrypt)

Patrze, ?e ?adnie bawicie sie moim skrypcikiem. No ale ka?dy co? od siebie doda i skrypt staje sie ciekawszy :] jesli ktos ma jeszcze jakies pomysly co dodac to prosze pisac.

Od?wie?am i prosze o dalsze komentowanie skrypciku.
 
Status
Zamknięty.
Do góry