Shanksera
New Member
- Joined
- Sep 23, 2008
- Messages
- 379
- Reaction score
- 1
Mam problem ze skryptem na to zeby gracz moglby stac sie mieszkancem danego miasta.Probowalem okolo 8 skrytpow kazdy inny.
Oto 2 przyklady
Error
Prosze nie pisac zeby poszukac w google bo bym tutaj nie pisal,gdybym znalazl.
Oto 2 przyklady
Code:
local portals = {
{town=2, name="xxx", portalpos={x=32360, y=31744, z=8}},
{town=3, name="xx", portalpos={x=32951, y=32045, z=7}},
{town=4, name="x", portalpos={x=32350, y=32226, z=6}},
{town=5, name="x", portalpos={x=33210, y=31804, z=8}},
{town=6, name="x", portalpos={x=32667, y=31682, z=7}},
{town=8, name="x", portalpos={x=33197, y=32849, z=6}},
{town=9, name="x", portalpos={x=35516, y=32455, z=2}},
{town=12, name="x", portalpos={x=32552, y=12925, z=1}}
}
function onStepIn(cid, item, position, fromPosition)
print "STEPIN"
for _, v in ipairs(portals) do
if v.portalpos.x == position.x and v.portalpos.y == position.y and v.portalpos.z == position.z then
-- Proper portal!
doPlayerSetTown(cid, v.town)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are now a citizen of " .. v.name .. ".")
doTeleportThing(cid, getTownTemplePosition(v.town))
doSendMagicEffect(getTownTemplePosition(v.town), CONST_ME_TELEPORT)
end
end
return TRUE
end
Code:
function onStepIn(cid, item, pos)
if isPlayer(cid) == TRUE then
if (item.actionid == 5000) then
doPlayerSendTextMessage(cid,22,"Now you are citizen of Gold-City.")
doPlayerSetTown(cid,1)
elseif (item.actionid == 5001) then
doPlayerSendTextMessage(cid,22,"Now you are citizen of CITY NAME City.")
doPlayerSetTown(cid,2)
elseif (item.actionid == 5002) then
doPlayerSendTextMessage(cid,22,"Now you are citizen of CITY NAME City.")
doPlayerSetTown(cid,3)
end
end
end
Code:
<!-- Residence -->
<movevent event="StepIn" itemid="1387" script="citizen.lua" />
Error
Code:
[LUA sciprt interface] Function OnStepIn
attempt to call a table value stack traceback: