• 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 Movement - TP script error

Ghost Creations

Active Member
Joined
Aug 2, 2011
Messages
227
Solutions
1
Reaction score
25
Location
Now in Korat, Thailand
This is killing me. I got this error and can't figure it out

Info:
Server: 8.54 - The Forgotten Server - Version 0.2.07 (Mystic Spirit) -win32gui
What it does: I have 3 chairs it checks to see if you have done the Quest and if so allows you to teleport to location, if you have not done the Quest it gives you a message that you need to do the Quest.

The Error happens every 30sec.
Error:
Code:
Lua Script Error: [MoveEvents Interface] 
data/movements/scripts/tp spawn.lua:onStepIn

luaDoPlayerSendTextMessage(). Player not found


Lua:
function onStepIn(cid, item, pos)

	if item.uid == 1041 and getPlayerStorageValue(cid,97250) == 1 then
	doPlayerSendTextMessage(cid, 20, 'You have finished! Use your new power carefully!!')
	local npos = {x=736,y=634,z=7}
		doTeleportThing(cid,npos)

else if item.uid == 1042 and getPlayerStorageValue(cid,97250) == 1 then
	doPlayerSendTextMessage(cid, 20, 'You have finished! Use your new power carefully!!')
	local npos1 = {x=764,y=634,z=7}
		doTeleportThing(cid,npos1)

else if item.uid == 1043 and getPlayerStorageValue(cid,97250) == 1 then
	doPlayerSendTextMessage(cid, 20, 'You have finished! Use your new power carefully!!')
	local npos2 = {x=806,y=634,z=7}
		doTeleportThing(cid,npos2)

else
 	doPlayerSendTextMessage(cid, 20, 'Only those who have finished the quest can use the power of those tiles!')
    end
end
end
end

Other than the error the script works fine.
 
The Script works untill I get on the char with a guy that has done the Quest, No teleport.

Error:
30/12/2011 18:44:29] Lua Script Error: [MoveEvents Interface]
[30/12/2011 18:44:29] data/movements/scripts/tp spawn.lua:eek:nStepIn

[30/12/2011 18:44:29] attempt to index a nil value
[30/12/2011 18:44:29] stack traceback:
[30/12/2011 18:44:29] [C]: in function 'doTeleportThing'
[30/12/2011 18:44:30] data/movements/scripts/tp spawn.lua:12: in function <data/movements/scripts/tp spawn.lua:7>
 
The Script works untill I get on the char with a guy that has done the Quest
03.jpg
14.jpg

7.jpg
 
Got it fixed thanks to all who tried. Here is the fix.

From soul4soul:
You only need 1 end for every function and 1 end for every if. you dont need an end for elseif or else. Yours should of worked fine if you removed 2 ends but this is better. Im pretty sure elseif cant have a space between it. This should work.

Lua:
function onStepIn(cid, item, pos)
	local npos ={1000, 1000, 7}
	if getPlayerStorageValue(cid,97250) == 1 then
		if item.uid == 1041 then
			npos = {x=736,y=634,z=7}
		elseif item.uid == 1042 then
			npos = {x=764,y=634,z=7}
		elseif item.uid == 1043 then
			npos = {x=806,y=634,z=7}
		end
		doPlayerSendTextMessage(cid, 20, 'You have finished! Use your new power carefully!!')
		doTeleportThing(cid, npos)
	else
		doPlayerSendTextMessage(cid, 20, 'Only those who have finished the quest can use the power of those tiles!')
    end
end

This is a script for the "Choose your own spawn" In my Roxor 8.54ms r5 distro.
This worked perfectly.

I want to say Thank you for helping, without these OT forums I would have taken a year to get it released.
 
***** heres script wont bugg for you anymore


function onStepIn(cid, item, pos)
local npos ={1000, 1000, 7}
if getPlayerStorageValue(cid,97250) == 1 then
if item.uid == 1041 then
npos = {x=736,y=634,z=7}
elseif item.uid == 1042 then
npos = {x=764,y=634,z=7}
elseif item.uid == 1043 then
npos = {x=806,y=634,z=7}
end
doPlayerSendTextMessage(cid, 20, 'You have finished! Use your new power carefully!!')
doTeleportThing(cid, npos)
else
doPlayerSendTextMessage(cid, 20, 'Only those who have finished the quest can use the power of those tiles!')
end
 
Back
Top