TalkAction + Movement - Create Portal with players go limit!

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Best answers
0
Reaction score
51
Location
Włocławek
in talkactions/scripts/portal.lua
PHP:
function onSay(cid, words, param)
    local param = param.explode(param, ',')
    if param then
    teleport = doCreateTeleport(1387, {x=param[1], y=param[2], z=param[3]}, getPlayerPosition(cid))
	doSetItemSpecialDescription(teleport, 'The portal may enter '..param[4]..' people left.')
    doSetItemActionId(teleport, 100+param[4])
    else
    doPlayerSendCancel(cid, "You must set param.")
    end
    return TRUE
end
talkactions.xml
PHP:
<talkaction access="5" log="yes" words="!portal" script="portal.lua"/>
now in movements/scripts/portal.lua
PHP:
function onStepIn(cid, item, position, fromPosition)
    if item.actionid > 100 then
	doSetItemSpecialDescription(item.uid, 'The portal may enter '..(item.actionid-101)..' people left.')
    doSetItemActionId(item.uid, item.actionid-1)
    end
    return TRUE
end


function onStepOut(cid, item, position, fromPosition)
    if item.actionid == 100 then
	doSendMagicEffect(position, 2)
    doRemoveItem(item.uid, 1)
    end
    return TRUE
end
and movements.xml
PHP:
<movevent type="StepIn" itemid="1387" event="script" value="portal.lua"/>
<movevent type="StepOut" itemid="1387" event="script" value="portal.lua"/>
how do use?
login gm and say !portal x,y,z,players_ammount like:
!portal 127,54,7,20

and 20 players who goto portal are teleported to position 127,54,7 and portal auto remove. : ))
I'm used it's to events ( 5 first players win! :p )

Yours,
azi.
 
Last edited:

Gsp

RP
Joined
Jan 3, 2008
Messages
237
Best answers
0
Reaction score
3
very nice bro
id give u rep but shit doesnt work for me
 

Gsp

RP
Joined
Jan 3, 2008
Messages
237
Best answers
0
Reaction score
3
i mean the rep thing it wont let me give
and about the script

it says theres already an event with 1387 *teleport id*

<!-- Citizen teleport -->
<movevent event="StepIn" itemid="1387" script="temples.lua" />

what to do
 
OP
Azi

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Best answers
0
Reaction score
51
Location
Włocławek
only add next lines, and should work. :)
 

Your Master

♫ ₥ẳ₱₱ễᏑ ♫
Joined
Dec 11, 2008
Messages
244
Best answers
0
Reaction score
0
[05/02/2009 21:03:19] Lua Script Error: [TalkAction Interface]
[05/02/2009 21:03:19] data/talkactions/scripts/portal.lua: onSay

[05/02/2009 21:03:19] data/talkactions/scripts/portal.lua:6: attempt to compare nil with number
[05/02/2009 21:03:19] stack traceback:
[05/02/2009 21:03:19] data/talkactions/scripts/portal.lua:6: in function <data/talkactions/scripts/portal.lua:4>
Used on Tfs 0.3 beta 3
 
OP
Azi

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Best answers
0
Reaction score
51
Location
Włocławek
#up
try now - group id requipment removed from script - added in talkactions.xml : )


#dół
no ok. :p
a masz access na 5 ustawiony? xd
 
Last edited:

Your Master

♫ ₥ẳ₱₱ễᏑ ♫
Joined
Dec 11, 2008
Messages
244
Best answers
0
Reaction score
0
Kurde nie chce mi sie po angielsku pisac.. :p

Nic sie tera nie dzieje jak pisze !portal xxx yyy z ..
W silniku nic nie ma :huh:

@up

<!-- Gods -->

<talkaction access="5" log="yes" words="!portal" script="portal.lua"/>

Jesli to o to chodzi :p
A jesli o God'a to tak

@down
I'm too sorry for talking in Polish
Tak mam :D
You are god.

To tak jakby skrpy nie byl skryptem.. tzn.
Sam nie wiem ;/
 
Last edited:
OP
Azi

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Best answers
0
Reaction score
51
Location
Włocławek
#sorry for pl. :p

ee, na postaci czy masz access na 5 :p

#up
to nie wiem czemu, jak błędu nie ma to trudno się dowiedzieć. ;s
 

Master-m

Need help? Just ask!
Joined
May 28, 2007
Messages
4,339
Best answers
0
Reaction score
15
Location
The Netherlands
Next one who speaks non english in this thread without an translation to english will get an warning.
 

Drakos

Banned User
Joined
May 27, 2008
Messages
218
Best answers
0
Reaction score
1
Location
Poland
im using tfs 0.22
Code:
Lua Script Error: [TalkAction Interface] 
data/talkactions/scripts/portal.lua:onSay

data/talkactions/scripts/portal.lua:2: attempt to call field 'explode' (a nil value)
stack traceback:
	data/talkactions/scripts/portal.lua:2: in function <data/talkactions/scripts/portal.lua:1>
 

Pitufo™

InfinityOT.com
Joined
Feb 14, 2008
Messages
1,438
Best answers
0
Reaction score
7
Location
Mexico, Cuernavaca
@up
You dont have the function string.explode!

How to add it?
Open global.lua and add this:

PHP:
function string.explode(str, sep, limit)
    -- Function by Colandus
    if limit and type(limit) ~= 'number' then
        error("string.explode: limit must be a number", 2)
    end

    if #sep == 0 or #str == 0 then return end
    local pos, i, t = 1, 1, {}
    for s, e in function() return str:find(sep, pos) end do
        table.insert(t, str:sub(pos, s-1):trim())
        pos = e + 1
        i = i + 1
        if limit and i == limit then break end
    end
    table.insert(t, str:sub(pos):trim())
    return t
end
Function thanks to Colandus :D
 

Drakos

Banned User
Joined
May 27, 2008
Messages
218
Best answers
0
Reaction score
1
Location
Poland
ok, thanks i added it.

but it doesn't work. I have this same error like Your Master:

on console everything looks fine, 0 errors but it doesnt work.
 

STiX

Intermediate OT User
Joined
Aug 22, 2007
Messages
437
Best answers
0
Reaction score
105
Location
Western Australia
and 20 players who goto portal are teleported to position 127,54,7 and portal auto remove. : ))
I'm used it's to events ( 5 first players win! :p )
Seems it creates the portal @ the said position and teleports to where you were standing when you made the portal. Not the other way around like you said, where it would create a portal where you are standing that goes to a said position.

Works none-the-less.
I'm going to use it!
 
OP
Azi

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Best answers
0
Reaction score
51
Location
Włocławek
#updated.
added "cloud" effect when teleport was removing and descriptions (with auto change) how many players may go to tp. :)
 

zednem

New Member
Joined
Nov 15, 2008
Messages
108
Best answers
0
Reaction score
0
It's get in shock with another movement that already exists (citizen) how i may proceed?
 
Last edited:
OP
Azi

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Best answers
0
Reaction score
51
Location
Włocławek
you can add script to citizen.lua : )
 

Dundox

New Member
Joined
Oct 22, 2007
Messages
34
Best answers
0
Reaction score
0
can you do:


'Broadcast' [param5]


idk how to write it so, can you fix that for me? and maybe show me what the script would look like with a broadcast message too?

thanks
 

Dundox

New Member
Joined
Oct 22, 2007
Messages
34
Best answers
0
Reaction score
0
PHP:
function onSay(cid, words, param)
    local param = param.explode(param, ',')
    if param then
    teleport = doCreateTeleport(1387, {x=param[1], y=param[2], z=param[3]}, getPlayerPosition(cid))
	doSetItemSpecialDescription(teleport, 'The portal may enter '..param[4]..' people left.')
    doSetItemActionId(teleport, 100+param[4])
   doBroadcastMessage(param[5], MESSAGE_EVENT_ADVANCE)     
    else
    doPlayerSendCancel(cid, "You must set param.")
    end
    return TRUE
end


edit: this works for broadcasting a message with your event portal
 
Last edited:
Top