• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Residence Script error!

Shanksera

New Member
Joined
Sep 23, 2008
Messages
379
Reaction score
1
I use this script

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:
<!-- Residencia -->
<movevent event="StepIn" itemid="1387" script="temple.lua" />

In RME i put on the magicforce field action id for example 5000 and it shows [LUA sciprt interface]blabla
attempt to call a table value stack traceback:

Please Notice! That i got the same problem with this script
Code:
function onStepIn(cid, item, position, fromPosition)
	if(item.actionid > 30020 and item.actionid < 30100) then
		doPlayerSetTown(cid, item.actionid - 30020)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Welcome new citizen of " ..getTownName(getPlayerTown(cid))..".")
	end
	return TRUE
end
 
Not Tested :thumbup:

LUA:
local config = {
        town1 = "Name Here",
        town2 = "Name Here",
        town3 = "Name Here"
}

function onStepIn(cid, item, pos)
if (item.actionid == 5000) then
    doPlayerSendTextMessage(cid,22,"Now you are citizen of "config.town1".")
    doPlayerSetTown(cid,1)
    return TRUE
end

if (item.actionid == 5001) then
    doPlayerSendTextMessage(cid,22,"Now you are citizen of "config.town2".")
    doPlayerSetTown(cid,2)
    return TRUE
end

if (item.actionid == 5002) then
    doPlayerSendTextMessage(cid,22,"Now you are citizen of "config.town3".")
    doPlayerSetTown(cid,3)
    return TRUE
    end
end
 
'>' expected near 'config' that show in console and it cannot load script Note
Town ID = 1 on my server is rookgard so change
Code:
doPlayerSetTown(cid,1)
to
Code:
doPlayerSetTown(cid,2)
 
@JDB..
No.
LUA:
local config = {
        town1 = "Name Here",
        town2 = "Name Here",
        town3 = "Name Here"
}

function onStepIn(cid, item, pos)
if (item.actionid == 5000) then
    doPlayerSendTextMessage(cid,22,"Now you are citizen of "..config.town1..".")
    doPlayerSetTown(cid,1)
    return TRUE
end

if (item.actionid == 5001) then
    doPlayerSendTextMessage(cid,22,"Now you are citizen of "..config.town2..".")
    doPlayerSetTown(cid,2)
    return TRUE
end

if (item.actionid == 5002) then
    doPlayerSendTextMessage(cid,22,"Now you are citizen of "..config.town3..".")
    doPlayerSetTown(cid,3)
    return TRUE
    end
You cant use "config.townX".. is not like this.. It is like this: "..config.townX.."
 
All you need to do, is erase the config.
Just use the rest.

I just added that to make it fancy...
 
Back
Top