• 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 HELP Talkaction only on PZ!

Josolo

New Member
Joined
Jul 1, 2009
Messages
6
Reaction score
0
Hello, I have a question how can I make a talkaction only can be done in Pz zone?

If anyone can help me is my Rep + +
 
TFS 0.2
Code:
if(getTilePzInfo(getCreaturePosition(cid)) == TRUE) then
TFS 0.3
Code:
if(getTileInfo(getCreaturePosition(cid)).protection) then
 
In pz tell me "You are Currently in a fight" this is my script, I need only can be done in Pz zone...

function onSay(cid, words, param, channel)
local destinations = {
["1"] = {p = {x=501, y=515, z=7}, l = 10, c = 100, v = 12345},
["2"] = {p = {x=500, y=439, z=7}, l = 20, c = 200, v = 67891},
["3"] = {p = {x=761, y=657, z=10}, l = 50, c = 300, v = 23456}
}
local tp = destinations[param]
if(param == "") then
doPlayerSendCancel(cid, "Command param required.")
return true
end
if(getPlayerLevel(cid) < tp.l) then
doPlayerSendCancel(cid, "Your level is not high enough.")
elseif(getTileInfo(getCreaturePosition(cid)).protection) then
doPlayerSendCancel(cid, "You are currently in a fight.")
elseif(getPlayerPremiumDays(cid) < 1) then
doPlayerSendCancel(cid, "You must have premium.")
else
doPlayerRemoveMoney(cid, tp.c)
doTeleportThing(cid, tp.p)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have successfully teleported to ".. param ..".")
end
return true
end
 
In pz tell me "You are Currently in a fight" this is my script, I need only can be done in Pz zone...

Code:
function onSay(cid, words, param, channel)
local destinations = {
["1"] = {p = {x=501, y=515, z=7}, l = 10, c = 100, v = 12345},
["2"] = {p = {x=500, y=439, z=7}, l = 20, c = 200, v = 67891},
["3"] = {p = {x=761, y=657, z=10}, l = 50, c = 300, v = 23456}
}
local tp = destinations[param]
if(param == "") then
doPlayerSendCancel(cid, "Command param required.")
return true
end
if(getPlayerLevel(cid) < tp.l) then
doPlayerSendCancel(cid, "Your level is not high enough.")
[B]if not getTileInfo(getCreaturePosition(cid)).protection then
[/B]doPlayerSendCancel(cid, "You are currently in a fight.")
elseif(getPlayerPremiumDays(cid) < 1) then
doPlayerSendCancel(cid, "You must have premium.")
else
doPlayerRemoveMoney(cid, tp.c)
doTeleportThing(cid, tp.p)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have successfully teleported to ".. param ..".")
end
return true
end
 
Code:
function onSay(cid, words, param, channel)
local destinations = {
["1"] = {p = {x=501, y=515, z=7}, l = 10, c = 100, v = 12345},
["2"] = {p = {x=500, y=439, z=7}, l = 20, c = 200, v = 67891},
["3"] = {p = {x=761, y=657, z=10}, l = 50, c = 300, v = 23456}
}
local tp = destinations[param]
if(param == "") then
doPlayerSendCancel(cid, "Command param required.")
return true
end
if(getPlayerLevel(cid) < tp.l) then
doPlayerSendCancel(cid, "Your level is not high enough.")
if not getTileInfo(getCreaturePosition(cid)).protection then
doPlayerSendCancel(cid, "You are currently in a fight.")
elseif(getPlayerPremiumDays(cid) < 1) then
doPlayerSendCancel(cid, "You must have premium.")
else
doPlayerRemoveMoney(cid, tp.c)
doTeleportThing(cid, tp.p)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have successfully teleported to ".. param ..".")
end
return true
end
end


=) Your program ran successfully.
 
fixedS
Code:
local destinations = {
	["one"] = {{x=501, y=515, z=7}, 10, 100},
	["two"] = {{x=500, y=439, z=7}, 20, 200},
	["three"] = {{x=761, y=657, z=10}, 50, 300}
}
function onSay(cid, words, param, channel)
	local tp = destinations[param:lower()]
	if not param or not tp then
		doPlayerSendCancel(cid, "Command param required.")
	elseif getPlayerLevel(cid) < tp[2] then
		doPlayerSendCancel(cid, "Your level is not high enough.")
	elseif not getTileInfo(getCreaturePosition(cid)).protection then
		doPlayerSendCancel(cid, "You are not in a protection zone.")
	elseif not isPremium(cid) then
		doPlayerSendCancel(cid, "You must have premium.")
	else
		doPlayerRemoveMoney(cid, tp[3])
		doTeleportThing(cid, tp[1])
		doSendMagicEffect(tp[1], CONST_ME_TELEPORT)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have successfully teleported to ".. param:lower() ..".")
	end
	return true
end
 
Back
Top