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

Two scripts

Alegres

You break it you buy it
Joined
Jun 27, 2009
Messages
325
Reaction score
14
Location
Wroclaw,Poland
Hello. I'd like to use the race system on my server, so I tried to use this code:


In creaturescripts.xml:

PHP:
	<event type="combat" name="Combating" event="script" value="combat.lua"/>
	<event type="target" name="Targeting" event="script" value="target.lua"/>

login.lua:
PHP:
	registerCreatureEvent(cid, "Combating")
	registerCreatureEvent(cid, "Targeting")

and that's how both scripts look like:

combat.php:

PHP:
local vocations = {
	horde = {1, 3},
	alliance = {2, 4}
}

function onCombat(cid, target)
if (not isPlayer(cid) or not isPlayer(target)) then return true end
	if isInArray(vocations.horde, getPlayerVocation(cid)) and isInArray(vocations.horde, getPlayerVocation(target)) or isInArray(vocations.alliance, getPlayerVocation(cid)) and isInArray(vocations.alliance, getPlayerVocation(target)) then
		doPlayerSendCancel(cid, "You can't attack someone from the same side.")
		return 0
	end
	return 1
end

target.php:
PHP:
local vocations = {
	horde = {1, 3},
	alliance = {2, 4}
}

function onTarget(cid, target)
if (not isPlayer(cid) or not isPlayer(target)) then return true end
	if isInArray(vocations.horde, getPlayerVocation(cid)) and isInArray(vocations.horde, getPlayerVocation(target)) or isInArray(vocations.alliance, getPlayerVocation(cid)) and isInArray(vocations.alliance, getPlayerVocation(target)) then
		doPlayerSendCancel(cid, "You can't attack someone from the same side.")
		return 0
	end
	return 1
end

But there's an error:

Error: [CreatureEvent::configureEvent] No valid type for creature event.combat Warning: [BaseEvents::loadFromXml] Can not configure event

Error: [CreatureEvent::configureEvent] No valid type for creature event.combat Warning: [BaseEvents::loadFromXml] Can not configure event

What am I doing wrong?

The second thing I'd like to talk about is the system of casting spells directly from player's backpack (you have to click on a special icon to cast, for example, utevo lux).

Likewise, if player aims monsters, he has to press special "Auto Attack" button (also located in his backpack) to start attacking it.

How can I do it? Thanks.
 
Back
Top