Inne [8.+ -9.++] - Skrypty lua na zam?wienie!

Status
Zamknięty.

Maniucza

Advanced User
Zarejestrowany
Dołączył
Styczeń 18, 2009
Posty
374
Liczba reakcji
57
Witam, po do?? d?ugiej przerwie nie skryptowania w j?zyku LUA otwieram nowy temat, aby udoskonali? swoje umiej?tno?ci - Skrypt na zam?wienie, ka?dy mo?e tu zamie?ci? pro?b? o skrypt. Je?li ja nie zdo?am odpowiedzie? w tym temacie na pro?b? jakiego? uzytkownika, to ka?dy inny u?ytkownik mo?e to zrobi? za mnie.

Zasady dodania pro?by o skrypt:


1. Musisz spe?nia? warunki 'Wz?r dodania pro?by o skrypt'.

2. Przyjmuj? tylko 3 zam?wienia. Wszystkie inne b?d? przeze mnie ignorowane, je?li wykonam wszystkie 3 zam?wienia, wtedy mo?esz doda? swoj? pro?b?.

3. Je?li masz zamiar doda? swoj? pro?b? o skrypt to zobacz pierwsze ile pr??b zosta?o spe?nionych. Je?li ?adna to nie dodawaj swojej, poniewa? zostanie ona zignorowana. Poczekaj a? spe?ni? cho? 2 pro?by bo inaczej zostaniesz nagrodzony upomnieniem

4. Przed pro?b? o napisanie skryptu przejrzyj dok?adnie internet, sprawdzaj?c czy dany skrypt nie jest ju? czasem, gdzie? dost?pny.



Wz?r dodania pro?by.


Rodzaj: np. Talkactions, Actions, Globalevents
Wersja tibii: np. 8.5
Opis skryptu. np : Je?li nacisn? na d?wignie zostane przeteleportowany.
Szczeg??y, ew. screen je?eli to ma by? skrypt z globalnej tibii.

JE?LI NIE SPE?NIASZ W/W WARUNK?W TO MO?ESZ ZAPOMNIE?, ?E CI POMOG?! LUB TWOJA PRO?BA ZOSTANIE ZIGNOROWANA!

Pozdrawiam.
 
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Potrzebuje skryptu na tibie 8.6
Je?eli uzyje itemu o ID XXXX zostane przeleportowany na wsp????dne jakie sobie ustale.
 
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Pro?ba
Potrzebuje skryptu na tibie 8.6
Je?eli uzyje itemu o ID XXXX zostane przeleportowany na wsp????dne jakie sobie ustale.

Nie spe?niasz wymogu wzoru dodawania pro?by, i? jeste? pierwszy wykona?em dla Ciebie owy skrypt.

Skrypt

Data/Actions/Scripts/NAZWA.LUA - Dodaj :

PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local p = { x = 1000, x = 1000, z = 7}
    if(isPlayerPzLocked(cid) == true) then
        doPlayerSendCancel(cid, "You are currently in a fight.")
    elseif getCreatureCondition(cid, CONDITION_INFIGHT) then 
        doPlayerSendCancel(cid, "You are currently in a fight.")
	else
		doTeleportThing(cid, p)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have successfully teleported.")
	end
end

Data/Actions/Actions.xml - Dodaj

PHP:
<action itemid="XXXX" event="script" value="NAZWA.lua"/>

Skrypt ma wbudowane, gdy gracz ma pz nie mo?e sie teleportowa?, i jesli nie stoi w PZ te? nie mo?e si? teleportowa?.

Regards,
Maniucza.
 
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Rodzaj: np. Talkactions, Actions
Wersja tibii: 8.54
O czym ma by? skrypt. np : Exp Scroll.Dostane 50 lvl-i,oboj?tnie na jakim lvlu zawsze dostaje 50 lvli.
Szczeg??y, ew. screen je?eli to ma by? skrypt z rl- nie ma
 
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Pierwszy!

.lua
PHP:
local config = {
    remove = true,
    countLevel = 50,
    effect = 0,
    text = false,
    messageType = 19
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(config.countLevel > 0) then doPlayerAddLevel(cid, config.countLevel) else return false end
    if(config.text and messageType > 0) then doPlayerSendTextMessage(cid, config.messageType, config.text) end
    if(config.effect > 0) then doSendMagicEffect(getCreaturePosition(cid), config.effect) end
    if(config.remove) then doRemoveItem(item.uid) end
    return true
end
actions.xml
PHP:
<action itemid="XXXX" event="script" value="NAZWA.lua"/>
Nie testowa?em, ale powinno dzia?a?. Mo?liwe liter?wki, dawno nie pisa?em skrypt?w, ale z nud?w jako? mnie natchn??o.


#edit
Maniucza, troche dziwnie to napisa?e?, tak lepiej by by?o:
PHP:
local config = {
    lockIfPz = true, -- 
    position = { x = 1000, x = 1000, z = 7}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(config['lockIfPz'] and (isPlayerPzLocked(cid) or getCreatureCondition(cid, CONDITION_INFIGHT))) then
        return doPlayerSendCancel(cid, "You are currently in a fight.")
    else
        return doTeleportThing(cid, config['position']) and doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have successfully teleported.") or true
    end
    return true
end
 
Ostatnia edycja:
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Rodzaj: np. Talkactions, Actions
Wersja tibii: np. 9.81
O czym ma by? skrypt. np : Je?li kto? mnie zabije w dedzie zostaje serce Morgaroth's Heart ale z moim imieniem i kto mnie zabi?.
Szczeg??y, ew. widzia?em to na jednym z ots zaraz dam ss
http://www.fotosik.pl/pokaz_obrazek/fff922d2304e0870.html
Prosze o skrypt i gdzie go da?
 
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Mona prosi o poprawienie scroll jest ale jestem nawet w depo i pisze You cannot use a teleport scroll when you are in a fight w domku w depo gdzie kolwiek
co poprawi?

PHP:
local Time1 = 0 
local Use1 = 0 
local timecount = 0
 
local function exhaust(cid, storevalue, exhausttime)
 -- Exhaustion function by Alreth, v1.1 2006-06-24 01:31
 -- Returns 1 if not exhausted and 0 if exhausted

 newExhaust = os.time()
 oldExhaust = getPlayerStorageValue(cid, storevalue)
 if (oldExhaust == nil or oldExhaust < 0) then
 oldExhaust = 0
 end
 if (exhausttime == nil or exhausttime < 0) then
 exhausttime = 1
 end
 diffTime = os.difftime(newExhaust, oldExhaust)
 if (diffTime >= exhausttime or diffTime < 0) then
 setPlayerStorageValue(cid, storevalue, newExhaust) 
return 1
 else
 return 0
 end
 end
 
local function onTime1(z) 
if isPlayer(z.cid) == 1 then 
ppos = getPlayerPosition(z.cid) 
if getCreatureCondition(z.cid, CONDITION_INFIGHT) == 1 then 
stopEvent(time1) 
stopEvent(Use1) 
doPlayerSendTextMessage(z.cid, 21, "Teleport Canceled Because of IN-FIGHT!") 
else
 if timecount > 0 then
 Time1 = addEvent(onTime1, 1000, z)
 end
 timecount = timecount-1
doPlayerSendTextMessage(z.cid, 21, "Teleporting in " .. timecount .. " second.")
 doSendMagicEffect(ppos, 53)
 end
 else 
stopEvent(time1) 
stopEvent(Use1) 
end 
end 
local function onUse1(z) 
if isPlayer(z.cid) == 1 then 
if getCreatureCondition(z.cid, CONDITION_INFIGHT) == 0 then 
ppos = getPlayerPosition(z.cid) 
stopEvent(time1) 
if z.item.itemid == 7727 then 
npos = {x=32345, y=32224, z=7} 
doTeleportThing(z.cid, npos) 
doPlayerSendTextMessage(z.cid, 21, "Teleported to the xxx.") 
doSendMagicEffect(npos,40) 
doSendMagicEffect(npos,10) 
doSendMagicEffect(ppos,10) 
stopEvent(time1) 
end 
else 
stopEvent(time1) 
doPlayerSendTextMessage(z.cid, 21, "Teleport Canceled.") 
end 
end 
end 

function onUse(cid, item, ppos, frompos, item2, topos) 
local z = {cid = cid, item = item, ppos = ppos, item2 = item2, topos = topos} 
if isPremium(cid) then 
if getCreatureCondition(z.cid, CONDITION_INFIGHT) == 0 then 
if (exhaust(cid, 9143, 11) > 0) then
 Time1 = addEvent(onTime1, 1000, z) 
Use1 = addEvent(onUse1, 11000, z) 
timecount = 10
 else 
doPlayerSendCancel(cid, "You cannot use a teleport scroll again until you have been teleported.") 
doSendMagicEffect(frompos, 2) 
end
 else 
doPlayerSendCancel(cid, "You cannot use a teleport scroll when you are in a fight.") 
doSendMagicEffect(frompos, 2) 
end 
else 
doPlayerSendCancel(cid, "Only players with a Premium account can use teleport scroll.") 
doSendMagicEffect(frompos, 2) 
end 
return 1 
end
 
Ostatnio edytowane przez moderatora:
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

@up,
Wrzu? to w znacznik
Kod:
.

Pozdrawiam.
 
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

to znaczy mozesz mnie pokierowac?
Czy ktos wie jak zrobi? te serce

---Aktualizacja---

Kod:
local Time1 = 0 
local Use1 = 0 
local timecount = 0

 local function exhaust(cid, storevalue, exhausttime)
-- Exhaustion function by Alreth, v1.1 2006-06-24 01:31
-- Returns 1 if not exhausted and 0 if exhausted
 
newExhaust = os.time()
 oldExhaust = getPlayerStorageValue(cid, storevalue)
 if (oldExhaust == nil or oldExhaust < 0) then
 oldExhaust = 0
 end
 if (exhausttime == nil or exhausttime < 0) then
 exhausttime = 1
 end
 diffTime = os.difftime(newExhaust, oldExhaust)
 if (diffTime >= exhausttime or diffTime < 0) then
 setPlayerStorageValue(cid, storevalue, newExhaust) 
return 1
 else
 return 0
 end
 end

 local function onTime1(z) 
if isPlayer(z.cid) == 1 then 
ppos = getPlayerPosition(z.cid) 
if getCreatureCondition(z.cid, CONDITION_INFIGHT) == 1 then 
stopEvent(time1) 
stopEvent(Use1) 
doPlayerSendTextMessage(z.cid, 21, "Teleport Canceled Because of IN-FIGHT!") 
else
 if timecount > 0 then
 Time1 = addEvent(onTime1, 1000, z)
 end
 timecount = timecount-1
 doPlayerSendTextMessage(z.cid, 21, "Teleporting in " .. timecount .. " second.")
 doSendMagicEffect(ppos, 53)
 end
 else 
stopEvent(time1) 
stopEvent(Use1) 
end 
end 
local function onUse1(z) 
if isPlayer(z.cid) == 1 then 
if getCreatureCondition(z.cid, CONDITION_INFIGHT) == 0 then 
ppos = getPlayerPosition(z.cid) 
stopEvent(time1) 
if z.item.itemid == 7727 then 
npos = {x=32345, y=32224, z=7} 
doTeleportThing(z.cid, npos) 
doPlayerSendTextMessage(z.cid, 21, "Teleported to the xxx.") 
doSendMagicEffect(npos,40) 
doSendMagicEffect(npos,10) 
doSendMagicEffect(ppos,10) 
stopEvent(time1) 
end 
else 
stopEvent(time1) 
doPlayerSendTextMessage(z.cid, 21, "Teleport Canceled.") 
end 
end 
end 

function onUse(cid, item, ppos, frompos, item2, topos) 
local z = {cid = cid, item = item, ppos = ppos, item2 = item2, topos = topos} 
if isPremium(cid) then 
if getCreatureCondition(z.cid, CONDITION_INFIGHT) == 0 then 
if (exhaust(cid, 9143, 11) > 0) then
 Time1 = addEvent(onTime1, 1000, z) 
Use1 = addEvent(onUse1, 11000, z) 
timecount = 10
 else 
doPlayerSendCancel(cid, "You cannot use a teleport scroll again until you have been teleported.") 
doSendMagicEffect(frompos, 2) 
end
 else 
doPlayerSendCancel(cid, "You cannot use a teleport scroll when you are in a fight.") 
doSendMagicEffect(frompos, 2) 
end 
else 
doPlayerSendCancel(cid, "Only players with a Premium account can use teleport scroll.") 
doSendMagicEffect(frompos, 2) 
end 
return 1 
end
 
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

mo?e kto? wie jak zrobic skrypta na !explorer i za 300 gp w bp dosatreje sie maczete line lopate i kilof ???

---Aktualizacja---

witam ponownie mo?e mi kto? przerobi? ten skrypt aby mo?na by?o kilka razy u?y? go ??
Kod:
function onUse(cid, item, frompos, item2, topos)
 if item.actionid == 0 then
npos = {x=32345, y=32223, z=7}
 doTeleportThing(cid,npos)
 doSendAnimatedText(getPlayerPosition(cid), "Go DEPO!", TEXTCOLOR_BLUE)
 doSetItemActionId(item.uid, 100)
 local pos = getPlayerPosition(cid)
 doSendMagicEffect(pos, 40)
 return 0
 end
 end
 
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Kod:
function onUse(cid, item, frompos, item2, topos)
npos = {x=32345, y=32223, z=7}
 doTeleportThing(cid,npos)
 doSendAnimatedText(getPlayerPosition(cid), "Go DEPO!", TEXTCOLOR_BLUE)
 local pos = getPlayerPosition(cid)
 doSendMagicEffect(pos, 40)
 return 0
 end

Sprawd? czy dzia?a.

---Aktualizacja---

mo?e kto? wie jak zrobic skrypta na !explorer i za 300 gp w bp dosatreje sie maczete line lopate i kilof ???

Kod:
function onSay(cid, words, param, channel)

local items = {2120, 2554, 2420, 2553}   --- ID itemow jakie mamy dostac
local bp = 1988 --- id backpacka / baga
local cost = 300 ---- ile ma kosztowac w gp


if doPlayerRemoveMoney(cid, cost) == TRUE then
	backpack = doPlayerAddItem(cid, bp, 1)
	for _, pid in ipairs(items) do
		doAddContainerItem(backpack, pid, 1)
	end
	doSendMagicEffect(getPlayerPosition(cid), 51)
	return true
else
	doPlayerSendCancel(cid, "Sorry, you don't have enough money.")
	doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
	return true
end

end

Sprawd?, ale mi to dzia?a?o.
 
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Witam, nie ogarniam kto tu ju? zosta? obs?u?ony wiec napisze
Kod:
Rodzaj: Actions
Wersja tibii: 8.54
O czym ma by? skrypt. po kliknieciu na item wydostaje si? z niego summon (monster)
Szczeg??y,: chyba wiesz o co chodzi ;D
Pozdrawiam i czekam na odpowied?, oczywi?cie Rep.
 
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Kod:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local config = {
                	monster = "Dragon",
                	max_summons = 2,
			remove = true, --- czy ma usuwac item po kliknieciu (true / false)

		   }
pos = getPlayerPosition(cid)
if (getTilePzInfo(pos) == true) then
	doPlayerSendCancel(cid, "This action is not permitted in a protection zone.")
else
if (#getCreatureSummons(cid) < config.max_summons) then
	doSummonMonster(cid, config.monster)
	if (config.remove == true) then
		doPlayerRemoveItem(cid, item.itemid, 1)
	end
else
	doPlayerSendCancel(cid, "You cann't summon more monsters!")
end
end
	return true
end


Config chyba b?dziesz potrafi? sobie ustawi?. :)
 
Ostatnia edycja:
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

super kamild113 a mo?esz poda? jeszcze gdzie to doda? trzeba wiem ze lua a dalej :d
 
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Stw?rz plik explorer.lua w data/talkactions/scripts/ i wklej do niego to:

Kod:
function onSay(cid, words, param, channel)

local items = {2120, 2554, 2420, 2553}   --- ID itemow jakie mamy dostac
local bp = 1988 --- id backpacka / baga
local cost = 300 ---- ile ma kosztowac w gp


if doPlayerRemoveMoney(cid, cost) == TRUE then
	backpack = doPlayerAddItem(cid, bp, 1)
	for _, pid in ipairs(items) do
		doAddContainerItem(backpack, pid, 1)
	end
	doSendMagicEffect(getPlayerPosition(cid), 51)
	return true
else
	doPlayerSendCancel(cid, "Sorry, you don't have enough money.")
	doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
	return true
end

end



Do /data/talkactions/talkactions.xml doklej to:

Kod:
<talkaction log="yes" words="!explorer" event="script" value="explorer.lua"/>
 
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

a kto? z obecnych wie jak zrobi? server moroga jak ktos cie zabije
cos takiego http://www.fotosik.pl/pokaz_obrazek/...2304e0870.html

---Aktualizacja---

Stw?rz plik explorer.lua w data/talkactions/scripts/ i wklej do niego to:

Kod:
function onSay(cid, words, param, channel)

local items = {2120, 2554, 2420, 2553}   --- ID itemow jakie mamy dostac
local bp = 1988 --- id backpacka / baga
local cost = 300 ---- ile ma kosztowac w gp


if doPlayerRemoveMoney(cid, cost) == TRUE then
	backpack = doPlayerAddItem(cid, bp, 1)
	for _, pid in ipairs(items) do
		doAddContainerItem(backpack, pid, 1)
	end
	doSendMagicEffect(getPlayerPosition(cid), 51)
	return true
else
	doPlayerSendCancel(cid, "Sorry, you don't have enough money.")
	doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
	return true
end

end



Do /data/talkactions/talkactions.xml doklej to:

Kod:
<talkaction log="yes" words="!explorer" event="script" value="explorer.lua"/>


mo?esz da? to w code bo mam problem wklepuje all rozwala mi po notatniku ale jak odpalam serwa mam b??d
Kod:
Loading talkactions... [Error - LuaInterface::loadFile] data/talkactions/scripts/explorer.lua:6: 'end' expected (to close 'function' at line 1) near '<eof>'
[1/5/2013 21:8:1] [Error - Event::checkScript] Cannot load script (data/talkactions/scripts/explorer.lua)
[1/5/2013 21:8:1] data/talkactions/scripts/explorer.lua:6: 'end' expected (to close 'function' at line 1) near '<eof>'
[1/5/2013 21:8:1] (done).
 
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

A pr?bowa?e? skasowa? ostatni "end"?

PS.
Screen z fotosika nie dzia?a.
 
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Witaj, ponownie ^^
Kod:
Rodzaj: Spells
Wersja tibii: 8.54
O czym ma by? skrypt: Spell ma by? parali?em na ca?y ekran, nie mo?na si? rusza? przez 3 sec ale mo?na u?ywa? spell?w i heala
Oczywi?cie rep.
 
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

przepraszam ju? daje nowe zdj?cie
o to one
http://www.fotosik.pl/pokaz_obrazek/177fef20d7908ab6.html

---Aktualizacja---

Kod:
on onSay(cid, words, param, channel)

local items = {2120, 2554, 2420, 2553} ---  
local bp = 1988 --- id backpacka / baga 
local cost = 300 ---- ile ma kosztowac w gp if doPlayerRemoveMoney(cid, cost) == TRUE then backpack = doPlayerAddItem(cid, bp, 1) for _, pid in ipairs(items) do doAddContainerItem(backpack, pid, 1) end doSendMagicEffect(getPlayerPosition(cid), 51) return true else doPlayerSendCancel(cid, "Sorry, you don't have enough money.") doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) return true
 end

---Aktualizacja---

tak da?em i nie wiem czy dobrze mo?esz mni epoprawi? czy cos usun?? bo dalej nie dzia?a

---Aktualizacja---

tu macie lepsze zdj?cie
http://imageshack.us/photo/my-images/163/sercef.jpg/
 
Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Odp: [8.5-8.++] - Skrypty na Zam?wienie!

Masz na !explorer:
Kod:
function onSay(cid, words, param, channel)

if doPlayerRemoveMoney(cid, 300) == TRUE then
	doPlayerAddItem(cid, 2120, 1)
	doPlayerAddItem(cid, 2554, 1)
	doPlayerAddItem(cid, 2420, 1)
	doPlayerAddItem(cid, 2553, 1)
	doSendMagicEffect(getPlayerPosition(cid), 1)
	return true
else
	doPlayerSendCancel(cid, "Sorry, you don't have enough money.")
	return true
end
end
Nie wiedzia?em, jak to inaczej zrobi?, dopiero ucz? si? lua, ale na 7.92 mi dzia?a?o lajtowo...

@edit
W talkactions doda?em
Kod:
<talkaction words="!explorer" script="nazwa.lua"/>

@edit2
Mo?e na nowszych zadzia?a tak:
Kod:
function onSay(cid, words, param, channel)

	items = {2120, 2554, 2420, 2553}

if doPlayerRemoveMoney(cid, 300) == TRUE then
	doPlayerAddItem(cid, items, 1)
	doSendMagicEffect(getPlayerPosition(cid), 1)
	return true
else
	doPlayerSendCancel(cid, "Sorry, you don't have enough money.")
	return true
end
end
 
Ostatnia edycja:
Status
Zamknięty.
Back
Do góry