• 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 Creaturevent script error

H3xed

New Member
Joined
Sep 28, 2007
Messages
93
Reaction score
2
Location
Poland
Hello,

I wrote this script, but somewhere in this is error - when player died, he had 0hp and is referred to as... In console i don't have any errors. Please help where is error ?

team2_count and team1_count are global vars

Code:
function onKill(cid, target)
   local team_1_ = db.getResult("SELECT `team_1`, `team_2` FROM `castle_war` WHERE  `done` = 0 LIMIT 1") 
local team_1_id = team_1_:getDataInt("team_1")
local team_2_id = team_1_:getDataInt("team_2")

local monster_spawn = {x=1056, y=1065, z=7}
local monster_name = "King"
						
local status = db.getResult("SELECT `status` FROM `castle`") 
local castle_status = status:getDataInt("status")
						
   if isPlayer(cid) == TRUE and isPlayer(target) == TRUE then
	local player_1_gid = getPlayerGuildId(cid)
	local player_2_gid = getPlayerGuildId(target)
	   if player_1_gid == team_1_id and player_2_gid == team_2_id and castle_status == 1 then
		team2_count = team_2_id - 1
	   end
		if player_1_gid == team_2_id and player_2_gid == team_1_id and castle_status == 1 then
		   team1_count = team_1_id - 1
		end
						
	if team1_count == 0 then 
	   doCreateMonster(monster_name, monster_spawn)
	end
						
	if team2_count == 0 then
	   doCreateMonster(monster_name, monster_spawn)
	end
   end
return TRUE
end
 
Back
Top