R
Rahim
Guest
Odp: [Skrypty][7.6-8.4] Skrypty na zam?wienie by Magic
@Wojtek
Od razu m?wi? - nie testowa?em! Nie mia?em na czym. A ?e mam urwanie g?owy mo?liwe, ?e s? b??dy.
1 skrypt:
actions/scripts
i do niego:
2. Skrypt
actions/scripts
I do niego:
do actions.xml dodaj:
3. Npc zaraz dorobie.
Je?li co? b?dzie ?le - skopiuj b??dy z konsoli.
@Kopi
Dla ciebie zrobi? potem - nie bardzo zczai?em ocb z tym czarem... Chodzi o to, ?e do najbli?szego potworu si? teleportuje i atakuje?
@Wojtek
Od razu m?wi? - nie testowa?em! Nie mia?em na czym. A ?e mam urwanie g?owy mo?liwe, ?e s? b??dy.
1 skrypt:
actions/scripts
Kod:
kasyno.lua
i do niego:
Kod:
function onUse(cid, item, fromPosition, itemEx, toPosition)
--by Kanciak
local talonPos = {x=toPosition.x-1, y=toPosition.y, z=toPosition.z, stackpos=255}
local talonPos = {x=toPosition.x+1, y=toPosition.y, z=toPosition.z, stackpos=255}
talons = getThingfromPos(talonPos)
liczba = math.random(0,100)
count = talons.type
dzwignia = getThingfromPos(toPosition)
tekst_gdy_przegra = "Niestety, lecz szczescie Tobie nie sprzyjalo. Straciles wszystkie talony."
tekst_gdy_remis = "Remis - nie tracisz nic."
tekst_gdy_wygra2 = "Gratulacje, wygrales! Dostajesz 2 razy wiecej talonow!"
tekst_gdy_wygra4 = "Gratulacje, wygrales! Dostajesz 4 razy wiecej talonow!"
if talons.itemid == getItemIdByName(talon) then
if liczba >= 0 and liczba <= 55 then
doRemoveItem(talons.uid,count)
doSendMagicEffect(talonPos,2)
doPlayerSendTextMessage(cid,22,tekst_gdy_przegra)
elseif liczba > 56 and liczba <= 75 then
doPlayerSendTextMessage(cid,22,tekst_gdy_remis)
doRelocate(talonPos, depoPos)
doSendMagicEffect(depoPos,14)
elseif liczba > 76 and liczba <= 90 then
doPlayerSendTextMessage(cid,22,tekst_gdy_wygra2)
doCreateItem(getItemIdByName(talon),count,depoPos)
doSendMagicEffect(talonPos,14)
elseif liczba > 91 and liczba <= 100 then
doPlayerSendTextMessage(cid,22,tekst_gdy_wygra4)
doCreateItem(getItemIdByName(talon),count*3,depoPos)
doSendMagicEffect(talonPos,14)
else
debugPrint("Kasyno: Blad losowania liczby!")
end
doSendAnimatedText(toPosition,""..liczba.."",192)
doSendMagicEffect(toPosition,27)
if dzwignia.itemid == 1945 then
doTransformItem(dzwignia.uid,1946)
else
doTransformItem(dzwignia.uid,1945)
end
end
end
2. Skrypt
actions/scripts
Kod:
drzwiKasyno.lua
Kod:
function onUse(cid, item, fromPosition, itemEx, toPosition)
--by Kanciak! (Winged'Nightmare)
--budzik.wxv.pl Zapraszam!
-- Edit
local aid_poziomo = 23410 -- Action id drzwi stojacych poziomo
local aid2 = 23411
local time = 5 --Po jakim czasie gracz zostanie teleportowany poza pokoj (W MINUTACH!)
local text_przy_wejsciu = "Masz tylko " .. time .. " minut na wykonanie misji. Spiesz sie!" -- Napis wyswietlany po wejsciu gracza do pokoju
local text_ostrzegawczy = "Uwaga, zbli?a si? koniec czasu. Zabierz swoje rzeczy!" --Napis wyswietlany na 1min przed koncem czasu.
local text_time_out = "Czas sie skonczyl! Zostales teleportowany przed pokoj!" --Napis wyswietlany po teleportowaniu gracza
--/edit
-- NIZEJ JUZ NIC NIE ZMIENIAJ, CHYBA ZE WIESZ CO ROBISZ.
local time_alarm = time - 1
local parameters = {}
parameters.cid = cid
parameters.pos = pos
parameters.text_time_out = text_time_out
parameters.text_ostrzegawczy = text_ostrzegawczy
parameters.itemuid = item.uid
parameters.aid_poziomo = aid_poziomo
parameters.aid2 = aid2
local czas = time * 1000 * 60
local time_ostrzegania = time_alarm * 1000 * 60
local storage1 = 24370
local storage2 = 24371
local storage3 = 24372
pos = getPlayerPosition(cid)
pozycja = {x=getPlayerStorageValue(cid,storage1), y=getPlayerStorageValue(cid,storage2), z=getPlayerStorageValue(cid,storage3)}
if(item.actionid == aid_poziomo) then
doSendMagicEffect(pos,14)
setPlayerStorageValue(cid,storage1,pos.x)
setPlayerStorageValue(cid,storage2,pos.y)
setPlayerStorageValue(cid,storage3,pos.z)
doTeleportThing(cid,{x=toPosition.x, y=toPosition.y-1, z=toPosition.z})
doSendMagicEffect({x=toPosition.x, y=toPosition.y-1, z=toPosition.z},14)
addEvent(teleport, czas, parameters)
addEvent(ostrzezenie, time_ostrzegania, parameters)
doPlayerSendTextMessage(cid,22,text_przy_wejsciu)
mayNotLogout(cid, 1)
doSetItemActionId(item.uid,aid2)
elseif(item.actionid == aid2) then
if(fromPosition.y < toPosition.y) then
doTeleportThing(cid,{x=toPosition.x, y=toPosition.y+1, z=toPosition.z})
doSendMagicEffect({x=toPosition.x, y=toPosition.y+1, z=toPosition.z},14)
stopEvent(teleport)
mayNotLogout(cid, 0)
doSetItemActionId(item.uid,aid_poziomo)
elseif(fromPosition.y > toPosition.y) then
doPlayerSendCancel(cid,'You can not use this object.')
end
else
doPlayerSendCancel(cid,'You can not use this object.')
end
return 0
end
function teleport(parameters)
local storage1 = 24370
local storage2 = 24371
local storage3 = 24372
local pozycja = {x=getPlayerStorageValue(parameters.cid,storage1), y=getPlayerStorageValue(parameters.cid,storage2), z=getPlayerStorageValue(parameters.cid,storage3)}
doTeleportThing(parameters.cid, pozycja)
doPlayerSendTextMessage(parameters.cid,22,parameters.text_time_out)
doSendMagicEffect(pozycja, 37)
mayNotLogout(parameters.cid, 0)
doSetItemActionId(parameters.itemuid,aid2)
end
function ostrzezenie(parameters)
doPlayerSendTextMessage(parameters.cid,parameters.text_ostrzegawczy)
end
do actions.xml dodaj:
Kod:
<action actionid="action_id_dzwigni" script="kasyno.lua"/>
<action fromaid="23410" toaid="23411" script="drzwiKasyno.lua"/>
3. Npc zaraz dorobie.
Je?li co? b?dzie ?le - skopiuj b??dy z konsoli.
@Kopi
Dla ciebie zrobi? potem - nie bardzo zczai?em ocb z tym czarem... Chodzi o to, ?e do najbli?szego potworu si? teleportuje i atakuje?
Ostatnia edycja: