• 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 Script help?

GOD Wille

Excellent OT User
Joined
Jan 11, 2010
Messages
2,826
Solutions
2
Reaction score
815
Location
Sweden
What is wrong with this script?

LUA:
function onSay(cid, words, param)
local summons = getCreatureSummons(cid)
local knight = getPlayerVocation(cid)
	if param == "" then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must type something first.")
		return false
		else if summons == 2 then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already have" .. getCreatureSummons(cid) .. ".")
			if param == "Hercules" and knight == 8 then
				doSummonCreature("Hercules", fromPosition.x + 1)
			else 
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are not Elite Knight or you got another error please report to gamemaster.")
			end
		end
	end
	return true
end
need some help.. it doesn't work.
 
Last edited:
Uhm, I dont see any major bugs or errors, but try this:
LUA:
function onSay(cid, words, param)
local summons = getCreatureSummons(cid)
local knight = getPlayerVocation(cid)
ppos = getPlayerPosition(cid)
	if param == "" then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must type something first.")
		return false
	end
		if summons == 2 then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already have" .. getCreatureSummons(cid) .. ".")
			if param == "Hercules" then
			   if knight == 8 then
				  doSummonCreature("Hercules", {x=ppos.x+1, y=ppos.y, z=ppos.z})
			   else 
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are not Elite Knight.")
			   end
	        else
	            doPlayerSendCancel(cid, "Invalid param")
             end
		end
	return true
end
 
Rep?
LUA:
function onSay(cid, words, param)
	local summons, voc = getCreatureSummons(cid), getPlayerVocation(cid)

	if param:lower() ~= "hercules" then
		return doPlayerSendCancel(cid, "Invalid parameters.")
	end
	
	if voc ~= 8 then
		return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are not Elite Knight.")
	end 
	
	if summons == 2 then
		return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already have" .. summons .. ".")
	end
	
	local tile = getClosestFreeTile(cid, getThingPos(cid))
	doSummonCreature("Hercules", tile)
	doSendMagicEffect(tile, 10)

	return true
end
 
LUA:
function onSay(cid, words, param, channel)
	if param:lower() ~= 'hercules' then
		doPlayerSendCancel(cid, 'Invalid parameters.')
	elseif getPlayerVocation(cid) ~= 8 then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You are not Elite Knight.')
	else
		local n = #getCreatureSummons(cid)
		if n == 2 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You already have ' .. n .. ' summons.')
		else
			doSummonMonster(cid, 'Hercules')
			doSendMagicEffect(getThingPos(getCreatureSummons(cid)[n+1]), CONST_ME_TELEPORT)
		end
	end
	return true
end
 
Your script doesn't work cyko, it never summons a monster, instead it stays: You are not Elite Knight or you got another error please report to gamemaster. Should i use it as a spell? I used it as a talkaction..
 
Back
Top