What's new

Item teleporter

Joined
Jul 7, 2010
Messages
2,061
Reaction score
193
Age
27
Witam posiadam taki skrypt :
PHP:
function onUse(cid, item)
local ppos = getPlayerPosition(cid)
local pos = {x = 1021, y = 999, z = 6}
if getPlayerLevel(cid) >= 10 then
doTeleportThing(cid, pos)
doSendMagicEffect(ppos, 14)
doSendMagicEffect(pos, 14)
else
doPlayerSendCancel(cid, Sorry,not possible)
end
return TRUE
end
Gdy posta? u?yje item-u ?adnie si? teleportuje,efekty te? si? pokazuj? lecz gdy posta? z level-em mniejszym ni? 10 u?yje item-u,zamiast pokaza? graczowi ?e nie mo?e u?y? tego przedmiotu ,,Sorry, not possible" to w konsoli mi to pokazuje ;o
PHP:
[05/08/2010 21:20:20] Lua Script Error: [Action Interface] 
[05/08/2010 21:20:20] data/actions/scripts/moj.lua:onUse

[05/08/2010 21:20:20] luaDoPlayerSendCancel(). Player not found
Dlaczego nie mo?e znale?? gracza ?
Prosz? o pomoc.
Skrypt nie m?j.
 

Xayan

Senior User
Joined
Jul 4, 2009
Messages
2,608
Reaction score
390
Age
28
Odp: Item teleporter

Code:
doPlayerSendCancel(cid, "Sorry,not possible")

Panie skrypter, o cudzys?owach si? zapomina? :)
 
Joined
Jul 7, 2010
Messages
2,061
Reaction score
193
Age
27
Odp: Item teleporter

Haha to dzia?a.
Zgad?e?,skrypt m?j xd
Reput leci i podzi?kuj te? ;]
Nie zamyka? bo jeszcze nie jeden problem b?dzie ;p
 
Last edited:

Aragornkk

Senior User
Joined
Oct 11, 2008
Messages
705
Reaction score
44
Odp: Item teleporter

Ju? nie pierwszy raz i pewnie nie ostatni (wczoraj zwraca?em ci na to uwag?)
skrypt b?dzie wygl?da? tak
function onUse(cid, item)
local ppos = getPlayerPosition(cid)
local pos = {x = 1021, y = 999, z = 6}
if getPlayerLevel(cid) >= 10 then
doTeleportThing(cid, pos)
doSendMagicEffect(ppos, 14)
doSendMagicEffect(pos, 14)
else
doPlayerSendCancel(cid, "Sorry,not possible")
end
return TRUE
end
 
Joined
Jul 7, 2010
Messages
2,061
Reaction score
193
Age
27
Odp: Item teleporter

Napisa?em 3 skrypty :
moj.lua
PHP:
function onStepIn(cid, item, position)
if item.actionid == 0 then
doPlayerSetTown(cid, 1)
setPlayerStorageValue(cid, 9000, 1)
else
doPlayerSendCancel(cid, "Sorry,not possible")
end
return TRUE
end
moj1.lua
PHP:
function onStepIn(cid, item, position)
local pos = {x= 1008, y= 1000, z= 6}
if getPlayerStorageValue(cid, 9000) == 1 then
doTeleportThing(cid, pos)
else
doPlayerSendCancel(cid, "Sorry,not possible")
end
return TRUE
end
moj2.lua
PHP:
function onStepIn(cid, item, position)
local pos = {x= 1012, y= 1000, z= 6}
if getPlayerStorageValue(cid, 9000) == 1 then
doTeleportThing(cid, pos)
else
doPlayerSendCancel(cid, "Sorry,not possible")
end
return TRUE
end
1 polega na tym ?e gdy staniemy na kratke o jakim? tam uid to si? ustawia storage value 9000,1 i town id 1 dla playera.
A pozosta?e 2 na tym ?e je?eli getplayerstoragevalue(9000) = 1 to teleportuje playera w dane miejsce.
Problem jest taki ?e po nadepni?ciu na kafelek od skryptu 2 i 3 nawet napis Sorry,not possible si? nie pojawia a konsola jest czysta,zna kto? pow?d?
Jak zwykle pewnie b?dzie to jakie? g?wno ale dla mnie jest to niczym zagadka kryminalna ;p
 
Last edited:

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: Item teleporter

PHP:
if item.actionid == 0 then
Item posiada actionid r?wne zero gdy? Zawsze takowe posiada, ka?dy item. Zmie? na uid, nadaj gdzie? ?w uid i wtedy zobacz, gdy? powinien dzia?a?.

I nie lepiej jest napisa? wszystkie trzy skrypty w jednym pliku i zrobi? tabelk??

Poka? jeszcze wpisy do movements.xml.
 
T

Tairens

Guest
Odp: Item teleporter

Oskar od kiedy item ma zawsze actionid? Do tego powiedz mi kochany co to jest tabelka?
Co? takiego jest zrozumia?em samo przez si?, po prostu podane storagevalue jest inne ni? jeden wielkiej filozofii nie ma.
 
Joined
Jul 7, 2010
Messages
2,061
Reaction score
193
Age
27
Odp: Item teleporter

Oskar,ja poprostu inaczej nie umiem wi?c robie tak,masz movements.xml :
PHP:
	<movevent event="StepIn" uniqueid="9004" script="moj.lua"/>
	<movevent event="StepIn" uniqueid="9005" script="moj1.lua"/>
	<movevent event="StepIn" uniqueid="9006" script="moj2.lua"/>
@edit
A actionid == 0 da?em bo to mi pierwsze do g?owy przysz?o.
po prostu podane storagevalue jest inne ni? jeden wielkiej filozofii nie ma.
Ale tu ca?y skrypt nie dzia?a,nawet nie wysy?a cancela,chocia? ma?o si? na tym znam i movements mo?e go nie wysy?aj?? I jak mo?e by? inne ni? 1 te storage value skoro :
PHP:
setPlayerStorageValue(cid, 9000, 1)
xd
 
Last edited:

Aragornkk

Senior User
Joined
Oct 11, 2008
Messages
705
Reaction score
44
Odp: Item teleporter

#Taires
WTF?
Oskarowi chodzi?o o to ?e zawsze gdy damy item.actionid == 0 ka?dy item nie posiadaj?cy acid b?dzie odpowiednio dzia?a?. W zasadzie to ma troch? sensu, jednak nale?y pami?ta? ?e acid nie mo?e by? mniejsze od 100(ciekawe dlaczego?)

#Topic
w pierwszym skrypcie usu? if item.actionid == 0 then oraz przed ostatni end.
Ta linijka jest zb?dna. Korzystasz i tak w mapedytorze z uniqateid.

#Edit
Napewno da?e? uniqate id w mapedytorze (w?a?ciwo?ci-->uniqate id)?
 
Joined
Jul 7, 2010
Messages
2,061
Reaction score
193
Age
27
Odp: Item teleporter

Taki t?py nie jestem ?eby nie da? :p
Skrypt 1 :

Skrypt 2 :

Skrypt 3 :


Zaraz zobacze czy dzia?a bez if-a ;p
@edit
Tak jak ostatnio,mog? chodzi? po tym kafelku a i tak mnie nie teleportuje ;o
 
Last edited:

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: Item teleporter

PHP:
function onStepIn(cid, item, position)
local tabelka = {
				[5000] = {id_miasta = 1},
				[5001] = {pos_gdzie_tp = {x= 1008, y= 1000, z= 6}},
				[5002] = {pos_gdzie_tp = {x= 1012, y= 1000, z= 6}}
				}
local storage = 9000
local kafelka = tabelka[item.actionid]
if item.actionid == 5000 then
	doPlayerSetTown(cid, kafelka.id_miasta)
	setPlayerStorageValue(cid, storage, 1)
elseif isInArray({5001,5002}, item.actionid) then
	if getPlayerStorageValue(cid, storage) == 1 then
		doTeleportThing(cid, kafelka.pos_gdzie_tp)
		doSendMagicEffect(kafelka.pos_gdzie_tp, CONST_ME_TELEPORT)
	else
		doPlayerSendCancel(cid, "Sorry,not possible")
	end
end
return true
end
To jest tabelka.
 
Joined
Jul 7, 2010
Messages
2,061
Reaction score
193
Age
27
Odp: Item teleporter

Widz? ?e si? postara?e?,nawet bardzo lecz...
Efekt jest ten sam,mog? chodzi? po tym zasranym kafelku i nic si? nie dzieje why???
?le ,,zainstalowa?em tw?j skrypt?
movements.xml
PHP:
		<movevent event="StepIn" actionid="5000" script="moj.lua"/>
	<movevent event="StepIn" actionid="5001" script="moj.lua"/>
	<movevent event="StepIn" actionid="5002" script="moj.lua"/>
moj.lua (teraz nie m?j ;p)
PHP:
function onStepIn(cid, item, position)
local tabelka = {
                [5000] = {id_miasta = 1},
                [5001] = {pos_gdzie_tp = {x= 1008, y= 1000, z= 6}},
                [5002] = {pos_gdzie_tp = {x= 1012, y= 1000, z= 6}}
                }
local storage = 9000
local kafelka = tabelka[item.actionid]
if item.actionid == 5000 then
    doPlayerSetTown(cid, kafelka.id_miasta)
    setPlayerStorageValue(cid, storage, 1)
elseif isInArray({5001,5002}, item.actionid) then
    if getPlayerStorageValue(cid, storage) == 1 then
        doTeleportThing(cid, kafelka.pos_gdzie_tp)
        doSendMagicEffect(kafelka.pos_gdzie_tp, CONST_ME_TELEPORT)
    else
        doPlayerSendCancel(cid, "Sorry,not possible")
    end
end
return true
end
Kafelkom nada?em action id 5000,5001,5002 i ?aden nic nie robi,czemu?
 

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: Item teleporter

Spr?buj:
PHP:
<movevent type="StepIn" fromaid="5000" toaid="5002" event="script" value="moj.lua"/>
 
Joined
Jul 7, 2010
Messages
2,061
Reaction score
193
Age
27
Odp: Item teleporter

OSKAR TY BOSKI CZ?OWIEKU !!!
DZIA?A BHUUHAUHUAHUAHUUAHAUA !!!
JESTE? MODEM WI?C POWINIENE? JAK CHRIS MAPERSTWA OTWORZY? SZKOL? SKRYPTERSK?
BUHAUHAUAUHAUAUHAUHAUAH
PODZI?KUJ I REPUT LECI BUHAUAUHAUH
xd

Nie zamyka?,jak b?d? mia? problem z innym nieogarni?tym skryptem to tu napisze ;]
 
Joined
Jul 7, 2010
Messages
2,061
Reaction score
193
Age
27
Odp: Item teleporter

Zgodnie z zapowiedzi?....
Mam problem z kolejnym skryptem :
PHP:
function onSay(cid, words, param)
if getPlayerLevel(cid) >= 100 and getPlayerMana(cid) >= 300 then
doPlayerAddMana(cid,-300)
doSetCreatureOutfit(cid, 155, 300)
else
doplayersendcancel(cid, "Sorry,not possible")
end
end
PHP:
<talkaction words="!corsair" script="moje/moj1.lua"/>
B??d w konsoli :
PHP:
[08/08/2010 18:28:59] Lua Script Error: [TalkAction Interface] 
[08/08/2010 18:28:59] data/talkactions/scripts/moje/moj1.lua:onSay

[08/08/2010 18:28:59] data/talkactions/scripts/moje/moj1.lua:4: attempt to call global 'doPlayerChangeOutfit' (a nil value)
[08/08/2010 18:28:59] stack traceback:
[08/08/2010 18:28:59] 	data/talkactions/scripts/moje/moj1.lua:4: in function <data/talkactions/scripts/moje/moj1.lua:1>
Help,s?dze ?e w TFS-ie nie ma zmiennej
PHP:
setcreatureoutfit
lecz jej potrzebuje,s? jakie? zamienniki ?
 

Vvex

Banned
Joined
Jun 28, 2009
Messages
460
Reaction score
91
Odp: Item teleporter

Code:
local newOutfit = {lookType = 155, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
function onSay(cid, words, param)
if getPlayerLevel(cid) >= 100 and getPlayerMana(cid) >= 300 then
doPlayerAddMana(cid,-300)
doCreatureChangeOutfit(cid, newOutfit)
else
doplayersendcancel(cid, "Sorry,not possible")
end
end
Powinno by? okey.
 
Joined
Jul 7, 2010
Messages
2,061
Reaction score
193
Age
27
Odp: Item teleporter

O to kolejne cude?ko :
PHP:
local newOutfit = {lookType = 151, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, 

lookTypeEx = 0, lookAddons = 3}
local newOutfitt = {lookType = 155, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, 

lookTypeEx = 0, lookAddons = 3}
function onSay(cid, words, param)
local pos = getPlayerPosition(cid)
if getPlayerLevel(cid) >= 100 and getPlayerMana(cid) >= 300 and getPlayerSex(cid) == 0 then
doPlayerAddMana(cid,-300)
doCreatureChangeOutfit(cid, newOutfitt)
doSendMagicEffect(pos, 14)
elseif getPlayerLevel(cid) >= 100 and getPlayerMana(cid) >= 300 and getPlayerSex(cid) == 1 then
doPlayerAddMana(cid,-300)
doCreatureChangeOutfit(cid, newOutfit)
doSendMagicEffect(pos, 14)
else
doplayersendcancel(cid, "Sorry,not possible")
end
end
Nie wiem jak zrobi? ?e po x sekundach powraca stary outfit.
Prubowa?em tak :
PHP:
doCreatureChangeOutfit(cid, newOutfit, 5)
Lecz tylko jaki? b??d w consoli wyskakuje,zaraz dam edita z tym b??dem
 
Last edited:

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: Item teleporter

PHP:
local newOutfit = {lookType = 151, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 3}
local newOutfitt = {lookType = 155, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 3}
function onSay(cid, words, param)
local czas = 180 --w sekundach
local pos = getPlayerPosition(cid)
if getPlayerLevel(cid) >= 100 and getPlayerMana(cid) >= 300 then
	if getPlayerSex(cid) == 0 then
		doSetCreatureOutfit(cid, newOutfitt, czas*1000)
	elseif getPlayerSex(cid) == 1 then
		doSetCreatureOutfit(cid, newOutfit, czas*1000)
	end
	doPlayerAddMana(cid,-300)
	doSendMagicEffect(pos, 14)
else
	doplayersendcancel(cid, "Sorry,not possible")
end
return true
end
Wed?ug mnie powinno dzia?a?, je?li nie to pisz.

#down
Poprzez addEvent, albo mo?esz zrobi? by po relogu gracza profka wraca?a do podanej przez Ciebie, wad? jest, ?e zawsze b?dzie wraca? do jednej i tej samej, niezale?nie jak? profesj? si? j? otrzyma?o.
 
Last edited:
Joined
Jul 7, 2010
Messages
2,061
Reaction score
193
Age
27
Odp: Item teleporter

PHP:
local newOutfit = {lookType = 151, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, 

lookAddons = 3}
local newOutfitt = {lookType = 155, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, 

lookAddons = 3}
function onSay(cid, words, param)
local czas = 5
local pos = getPlayerPosition(cid)
if getPlayerLevel(cid) >= 100 and getPlayerMana(cid) >= 300 then
    if getPlayerSex(cid) == 0 then
        doSetCreatureOutfit(cid, newOutfitt, czas*1000)
    doPlayerSetVocation(cid, 1, czas*1000)
elseif getPlayerSex(cid) == 1 then
        doSetCreatureOutfit(cid, newOutfit, czas*1000)
    doPlayerSetVocation(cid, 1, czas*1000)
end
    doPlayerAddMana(cid,-300)
    doSendMagicEffect(pos, 14)
else
    doplayersendcancel(cid, "Sorry,not possible")
end
return true
end
Postanowi?em doda? okr?glejszych kszta?t?w temu skryptowi lecz ...
PHP:
[08/08/2010 21:14:20] Lua Script Error: [TalkAction Interface] 
[08/08/2010 21:14:20] data/talkactions/scripts/moje/moj1.lua:onSay

[08/08/2010 21:14:20] luaDoPlayerSetVocation(). Player not found
Nie wiem jak to zrobi? by po x sekundach profesja powraca?a do ,,naturalnej" ;o
 
Top