• 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!

Please someone fix and shorten this script

Dantarrix

Member
Joined
Aug 27, 2010
Messages
546
Reaction score
18
Location
Stgo, Chile
Lua:
function onSay(cid, words, param, channel)
	local param = string.explode(param, ",")
	local params = {
		["temple"] = {x=159, y=387, z=6},
		["depot"] = {x=, y=, z=}
		}
	if (param[1] == nil) then
		doPlayerSendCancel(cid, "You need to specificate a place or coordinates.")
		return true
	end
	if not(isNumber(param[1])) then
		param = string.lower(param)
		for k, v in pairs(params) do
			if (k[param]) then
				doTeleportThing(cid, v)
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "All players have been teleported to ".. k .. ".")
				doBroadcastMessage("All players have been teleported to ".. k .." by " .. getCreatureName(cid) .. ".")
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
			else
				doPlayerSendCancel(cid, "Place does not exist.")
			end
		end
	else
		if ((param[2] == nil) then
			doPlayerSendCancel(cid, "You necesarily need x and y coordinates.")
			return true
		end
		local z = param[3]
		if z == nil then
			z = 7
		end
		local y = param[2]
		local x = param[1]
		for _, pid in ipairs(getPlayersOnline()) do
			doTeleportThing(pid, {x=x, y=y, z=z})
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "All players have been teleported to x=".. x ..", y=".. y ..", z=".. z ..".")
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
			oBroadcastMessage("All players have been teleported to x=".. x ..", y=".. y ..", z=".. z .." by " .. getCreatureName(cid) .. ".")
		end
	end
return true
end

The script should tp all conected players to a place, this place could be pre defined, like the temple or depot, or the god can say like /tpall 100, 100, 3 and it tps there all players..... If the god doesnt says the z coordinate, this should be 7 by default.... Thank you ;)
 
Yeah, it should work, but in your script:

1. There are no pre-configurable places...
2. z always is 7, i want it to be 7 if players dont give a value for z
3. it will show error if player only says 1 parameter, like /tpall 205, cause you dont have a "t[2]"...

;)
 
Yep, it will not show any error now, but still missing point 1, the pre-configurable places.... But you gave me an idea.... That one that says z = t[3] or 7.... xD That will shorten my first script posted....

Are you working in any specific proyect?
 
I edited my script, I shorten it...
So here it is, I will be grateful if you give it a try... Ty...
Lua:
function onSay(cid, words, param, channel)
	local param = string.explode(param, ",")
	local params = {
		["temple"] = {x=159, y=387, z=6},
		["depot"] = {x=, y=, z=}
		}
	if (param[1] == nil) then
		doPlayerSendCancel(cid, "You need to specificate a place or coordinates.")
		return true
	end
	if not(isNumber(param[1])) then
		param = string.lower(param)
		for k, v in pairs(params) do
			if (k[param]) then
				doTeleportThing(cid, v)
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "All players have been teleported to ".. k .. ".")
				doBroadcastMessage("All players have been teleported to ".. k .." by " .. getCreatureName(cid) .. ".")
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
			else
				doPlayerSendCancel(cid, "Place does not exist.")
			end
		end
	else
		if ((param[2] == nil) then
			doPlayerSendCancel(cid, "You necesarily need x and y coordinates.")
			return true
		end
		for _, pid in ipairs(getPlayersOnline()) do
			doTeleportThing(pid, {x=param[1], y=y, z=(param[3] or 7)})
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "All players have been teleported to x=".. param[1] ..", y=".. param[2] ..", z="(.. param[3] .. or 7)".")
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
			doBroadcastMessage("All players have been teleported to x=".. param[1] ..", y=".. param[2] ..", z="(.. param[3] .. or 7)" by " .. getCreatureName(cid) .. ".")
		end
	end
return true
end


EDIT: If you want some help in your proyect, count with me to help you with
Lua:
 scripts and [PHP/HTML] Resources..... ;) For free, obviously... :B
 
Last edited:
Back
Top