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

Nesaj

New Member
Joined
Apr 10, 2008
Messages
126
Reaction score
0
Well, im using a script for a PVP arena and every time a player get killed by a field item (inside the arena) my server crash.

The Script:
Code:
local ArenaJungle = { frompos = {x=1908,y=1208,z=7}, topos = {x=1992,y=1290,z=7} }
local ArenaJungleSub = { frompos = {x=1908,y=1208,z=8}, topos = {x=1992,y=1290,z=8} }
local ArenaCity = { frompos = {x=1871,y=1298,z=7}, topos = {x=1920,y=1342,z=7} }
local TemploArenas = {x = 1296, y = 1330, z = 6}

function onStatsChange(cid, attacker, type, combat, value)
	if isInRange(getCreaturePosition(cid), ArenaJungle.frompos, ArenaJungle.topos) or isInRange(getCreaturePosition(cid), ArenaJungleSub.frompos, ArenaJungleSub.topos) or isInRange(getCreaturePosition(cid), ArenaCity.frompos, ArenaCity.topos) then
		if type == 1 then
			if getCreatureHealth(cid) <= value then
				if isPlayer(cid) then
					doSendMagicEffect(TemploArenas, 10)
					doTeleportThing(cid, TemploArenas, true)
					doRemoveConditions(cid)
					if getCreatureCondition(cid, CONDITION_POISON) then
						doRemoveCondition(cid, CONDITION_POISON)
					end
					if getCreatureCondition(cid, CONDITION_FIRE) then
						doRemoveCondition(cid, CONDITION_FIRE)
					end
					if getCreatureCondition(cid, CONDITION_ENERGY) then
						doRemoveCondition(cid, CONDITION_ENERGY)
					end
					if getCreatureCondition(cid, CONDITION_PARALYZE) then
						doRemoveCondition(cid, CONDITION_PARALYZE)
					end
					doCreatureAddHealth(cid, getCreatureMaxHealth(cid), true)
				end
				return false
			end
		end
	end
	return true
end

Can someone help me to fix this? =X

@Edit:
The bug happen only when the player die to the condition (burning, poisoned, etc...), not when he steps on the field item and lose some hp.
Example:
11:50 You lose 20 hitpoints. (steping on a fire field, if the player get killed by this the server wont crash)
11:53 You lose 10 hitpoints. (condition burning, if the player get killed by this the server will crash)
 
Last edited:
Lua:
local ArenaJungle = { frompos = {x=1908,y=1208,z=7}, topos = {x=1992,y=1290,z=7} }
local ArenaJungleSub = { frompos = {x=1908,y=1208,z=8}, topos = {x=1992,y=1290,z=8} }
local ArenaCity = { frompos = {x=1871,y=1298,z=7}, topos = {x=1920,y=1342,z=7} }
local TemploArenas = {x = 1296, y = 1330, z = 6}

function onStatsChange(cid, attacker, type, combat, value)
	if isPlayer(cid) and isPlayer(attacker) then
		local p = getThingPos(cid)
		if type == 1 and getCreatureHealth(cid) <= value and isInRange(p, ArenaJungle.frompos, ArenaJungle.topos) or isInRange(p, ArenaJungleSub.frompos, ArenaJungleSub.topos) or isInRange(p, ArenaCity.frompos, ArenaCity.topos) then
			doSendMagicEffect(TemploArenas, 10)
			doTeleportThing(cid, TemploArenas, true)
			doRemoveConditions(cid, false)
			doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
			return false
		end
	end
	return true
end
 
Back
Top