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

Check Player Summons function

Reyn

On to the next One
Joined
May 15, 2010
Messages
259
Reaction score
1
Location
Germany ;3
Hei all :o
i need the function which checks the players summons... i'm not really a master of lua and am not known to all functions :S a function list would be cool too....
Sth. like this one ^^ just it gotta work
Code:
if getPlayerSummons(cid) >= 1 then
Regards,
Reyn
 
getCreatureSummons(cid)

example
LUA:
if getCreatureSummons(cid) >= 1 then
doPlayerSendCalcel(cid, "Sorry but you already have more than 1 summoned monster.")
end

Rep++
 
getCreatureSummons(cid)

example
LUA:
if getCreatureSummons(cid) >= 1 then
doPlayerSendCalcel(cid, "Sorry but you already have more than 1 summoned monster.")
end

Rep++
Thats exactly what i searched for , thanks ^^
but i think u meant Cancel not Calcel :P
 
@Sonical, Reyn:
Did u guys even notice what koob did write? There has to be # before getCreatureSummons, because that function returns LIST of cids of certain creature summons. And by this way, # returns SIZE of array, so it's amount of summons.
kthksbai
 
Try
LUA:
function onSay(cid, words, param, channel)
local queststatus = getPlayerStorageValue(cid,1212)
	if getCreatureSummons(cid) >= 1 then
		if queststatus == 1 then
			doSummonCreature(cid, "Demon")
		else
		doPlayerSendTextMessage(cid,22,"You can't summon this Monster yet.")
		end
		else
		doPlayerSendTextMessage(cid,22,"You already have more than 1 summoned monster!")
	end
return 1
end
Talkactions.xml add
Code:
	<talkaction words="/demon" event="script" value="demon.lua"/>
 
<_< he doesn't understand

LUA:
table.maxn(getCreatureSummons(cid))
#getCreatureSummons(cid)

[cpp]
int32_t LuaInterface::luaGetCreatureSummons(lua_State* L)
{
//getCreatureSummons(cid)
ScriptEnviroment* env = getEnv();

Creature* creature = env->getCreatureByUID(popNumber(L));
if(!creature)
{
errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));
lua_pushboolean(L, false);
return 1;
}

const std::list<Creature*>& summons = creature->getSummons();
CreatureList::const_iterator it = summons.begin();

lua_newtable(L);
for(uint32_t i = 1; it != summons.end(); ++it, ++i)
{
lua_pushnumber(L, i);
lua_pushnumber(L, env->addThing(*it));
pushTable(L);
}

return 1;
}
[/cpp]
 
Back
Top