• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[Help] Help in system teleport plz

Shiko Erye

LUA - Scripter
Joined
Dec 7, 2010
Messages
106
Reaction score
12
LUA:
local tp_wait_time = -300
local viridian = {x=707, y=1089, z=7}
local pewter = {x=718, y=858, z=6}
local cerulean = {x=1060, y=904, z=7}
local saffron = {x=1054, y=1049, z=7}
local celadon = {x=863, y=1036, z=6}
local lavender = {x=1204, y=1045, z=7}
local vermilion = {x=1072, y=1167, z=7}
local fuchsia = {x=1213, y=1324, z=7}
local cinnabar = {x=776, y=1270, z=7}

function msgcontains(txt, str)
  	return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end

function onSay(cid, type, msg)
  	msg = string.lower(msg)
local pokes = {
['Abra'] = {1},
['Kadabra'] = {1},
['Alakazam'] = {1},
['Drowzee'] = {1},
['Hypno'] = {1},
['Porygon'] = {1},
['Mew'] = {1},
['Mewtwo'] = {1},
['Rattata'] = {1},
}
local poketp = getCreatureName(getCreatureSummons(cid)[1])
	if pokes[poketp] then
			if (os.clock() - tp_wait_time) >=300 then
				if msgcontains(msg, 'tp"viridian') then
					doCreatureSay(cid,poketp.." teleport to Viridian.", 1)
					doTeleportThing(cid, viridian)
					doSendMagicEffect(1,10)
					tp_wait_time = os.clock()
				elseif msgcontains(msg, 'tp"pewter') then
					doCreatureSay(cid,poketp.." teleport to Pewter.", 1)
					doTeleportThing(cid, pewter)
					doSendMagicEffect(1,10)
					tp_wait_time = os.clock()
				elseif msgcontains(msg, 'tp"cerulean') then
					doCreatureSay(cid,poketp.." teleport to Cerulean.", 1)
					doTeleportThing(cid, cerulean)
					doSendMagicEffect(1,10)
					tp_wait_time = os.clock()
				elseif msgcontains(msg, 'tp"saffron') then
					doCreatureSay(cid,poketp.." teleport to Saffron.", 1)
					doTeleportThing(cid, saffron)
					doSendMagicEffect(1,10)
					tp_wait_time = os.clock()
				elseif msgcontains(msg, 'tp"celadon') then
					doCreatureSay(cid,poketp.." teleport to Celadon.", 1)
					doTeleportThing(cid, celadon)
					doSendMagicEffect(1,10)
					tp_wait_time = os.clock()
				elseif msgcontains(msg, 'tp"lavender') then
					doCreatureSay(cid,poketp.." teleport to Lavender.", 1)
					doTeleportThing(cid, lavender)
					doSendMagicEffect(1,10)
					tp_wait_time = os.clock()
				elseif msgcontains(msg, 'tp"vermilion') then
					doCreatureSay(cid,poketp.." teleport to Vermilion.", 1)
					doTeleportThing(cid, vermilion)
					doSendMagicEffect(1,10)
					tp_wait_time = os.clock()
				elseif msgcontains(msg, 'tp"cinnabar') then
					doCreatureSay(cid,poketp.." teleport to Cinnabar.", 1)
					doTeleportThing(cid, cinnabar)
					doSendMagicEffect(1,10)
					tp_wait_time = os.clock()
				elseif msgcontains(msg, 'tp"fuchsia') then
					doCreatureSay(cid,poketp.." teleport to Fuchsia.", 1)
					doTeleportThing(cid, fuchsia)
					doSendMagicEffect(1,10)
					tp_wait_time = os.clock()
				else
					doPlayerSendTextMessage(cid,27, "This place doesn't exist.")
				end
			else
				return doPlayerSendTextMessage(cid,27,"Sorry, you have to wait " ..(300-(os.clock() - tp_wait_time)).. " seconds.")
			end
	else
	doCreatureSay(cid,"This pokemon can't use teleport.", 1)
	end
end
Somebody help me fix it:(
 
Last edited:
Try now, btw I made it shorter
LUA:
local tp_wait_time = -300

function msgcontains(txt, str)
      return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end

function onSay(cid, type, msg)
      msg = string.lower(msg)
local pokes = {
['Abra'] = {1},
['Kadabra'] = {1},
['Alakazam'] = {1},
['Drowzee'] = {1},
['Hypno'] = {1},
['Porygon'] = {1},
['Mew'] = {1},
['Mewtwo'] = {1},
['Rattata'] = {1},
}

local t = {
['tp"viridian'] = {Viridian,{x=707, y=1089, z=7}},
['tp"pewter'] = {Pewter,{x=718, y=858, z=6}},
['tp"cerulean'] = {Cerulean,{x=1060, y=904, z=7}},
['tp"saffron'] = {Saffron,{x=1054, y=1049, z=7}},
['tp"celadon'] = {Celadon,{x=863, y=1036, z=6}},
['tp"lavender'] = {Lavender,{x=1204, y=1045, z=7}},
['tp"vermilion'] = {Vermilion,{x=1072, y=1167, z=7}},
['tp"cinnabar'] = {Cinnabar,{x=776, y=1270, z=7}},
['tp"fuchsia'] = {Fuchsia,{x=1213, y=1324, z=7}}
}


local poketp = getCreatureName(getCreatureSummons(cid)[1])
    if pokes[poketp] then
       for txt, v in pairs(t) do
            if (os.clock() - tp_wait_time) >= 300 then
                if msgcontains(msg, txt) then
                    doCreatureSay(cid," " .. poketp .." teleport to " .. v[1] .. " .", 1)
                    doTeleportThing(cid, v[2])
                    doSendMagicEffect(1,10)
                    tp_wait_time = os.clock()
                else
                    doPlayerSendTextMessage(cid,27, "This place doesn't exist.")
                end
            else
                return doPlayerSendTextMessage(cid,27,"Sorry, you have to wait " ..(300-(os.clock() - tp_wait_time)).. " seconds.")
            end
       end
    else
    doCreatureSay(cid,"This pokemon can't use teleport.", 1)
    end
return true
end
 
Code:
13:41 This place doesn't exist.
13:41 This place doesn't exist.
13:41 This place doesn't exist.
13:41 This place doesn't exist.
13:41 This place doesn't exist.
13:41 This place doesn't exist.
13:41 This place doesn't exist.
13:41 This place doesn't exist.
13:41 This place doesn't exist.
error as my product
function IF maybe not work as I want
can you help me again?:(

Srr for my bad english
 
Back
Top