Tente assim:
local function isInWar(cid)
local check = {}
if getPlayerGuildId(cid) and getPlayerGuildId(cid) > 0 then
local query = db.getResult("SELECT `status` FROM `guild_wars` WHERE `guild_id` = '"..getPlayerGuildId(cid).."'")
if query:getID() == -1 then
return false
end
repeat
local status = query:getDataInt("status")
table.insert(check, status)
until not query:next()
query:free()
if isInArray(check, 1) then
return true
end
end
return false
end
local function isFighting(cid, target)
if getPlayerGuildId(cid) and getPlayerGuildId(cid) > 0 and getPlayerGuildId(target) and getPlayerGuildId(target) > 0 then
local query = db.getResult("SELECT `enemy_id` FROM `guild_wars` WHERE `guild_id` = '"..getPlayerGuildId(cid).."' AND `status` = '1'")
if query:getID() == -1 then
local tery = db.getResult("SELECT `enemy_id` FROM `guild_wars` WHERE `guild_id` = '"..getPlayerGuildId(target).."' AND `status` = '1'")
if tery:getID() == -1 then
return false
end
local guild = tery:getDataInt("enemy_id")
tery:free()
if guild == getPlayerGuildId(cid) then
return true
end
else
local enemy = query:getDataInt("enemy_id")
query:free()
if enemy == getPlayerGuildId(target) then
return true
end
end
end
return false
end
function onCombat(cid, target)
if isPlayer(cid) and isPlayer(target) then
if getPlayerGuildId(cid) == getPlayerGuildId(target) and not isInWar(cid) then
if getPlayerStorageValue(cid, 0442200) == 1 then
return false
end
end
if getPlayerStorageValue(cid, 0442201) == 1 and getCreatureSkull(target) == 0 and not isFighting(cid, target) then
return false
end
if getPlayerStorageValue(cid, 0442202) == 1 and not isFighting(cid, target) then
return false
end
if getPlayerStorageValue(cid, 0442203) ~= -1 and getPlayerLevel(target) < getPlayerStorageValue(cid, 0442203) then
return false
end
end
return true
end
function onTarget(cid, target)
if isPlayer(cid) and isPlayer(target) then
if getPlayerStorageValue(cid, 0442201) == 1 and getCreatureSkull(target) == 0 and not isFighting(cid, target) then
doPlayerSendCancel(cid, "Voce nao pode atacar alguem sem skull pois o modo de pvp marked esta ativado.")
return false
end
if getPlayerStorageValue(cid, 0442202) == 1 and not isFighting(cid, target) then
doPlayerSendCancel(cid, "Voce nao pode atacar alguem que nao esteja em war contra sua guild pois o modo pvp war esta ativado.")
return false
end
if getPlayerStorageValue(cid, 0442203) ~= -1 and getPlayerLevel(target) < getPlayerStorageValue(cid, 0442203) then
doPlayerSendCancel(cid, "Voce nao pode atacar alguem com level menor que "..getPlayerStorageValue(cid, 0442203).." pois o modo de pvp level esta ativado.")
return false
end
end
return true
end
function onLogin(cid)
registerCreatureEvent(cid, "PVPSystemC")
registerCreatureEvent(cid, "PVPSystemT")
return true
end
Se nao ficar como o desejado, tente explicar melhor como funciona este sistema na íntegra e como o deseja.



info
Grupo: Visconde
Registrado: 02/10/13
Posts: 320
Reputação: +22
Gênero: Masculino
Olá. eu tenho um script aqui, que ele funciona para que o jogador meio que "filtre" qual jogador ele vai atacar ou seja, caso ele use um certo comando, ele só ataca jogadores que tenha SKULL (PK,RED ou Black)
Esse meu script, ele tem uma função, que mesmo que o jogador coloque esse filtro, ele ataca jogadores da war do time inimigo, ou seja, esse script não filtra os jogadores da war do time inimigo. Mas tem um problema, ele filtra os jogadores do meu time, ou seja, se eu usar o comando ele não ataca os jogadores do meu time, e eu queria colocar para isso não acontecer, porque se isso acontecer a war ficaria chata
local function isInWar(cid) local check = {} if getPlayerGuildId(cid) and getPlayerGuildId(cid) > 0 then local query = db.getResult("SELECT `status` FROM `guild_wars` WHERE `guild_id` = '"..getPlayerGuildId(cid).."'") if query:getID() == -1 then return false end repeat local status = query:getDataInt("status") table.insert(check, status) until not query:next() query:free() if isInArray(check, 1) then return true end end return false end local function isFighting(cid, target) if getPlayerGuildId(cid) and getPlayerGuildId(cid) > 0 and getPlayerGuildId(target) and getPlayerGuildId(target) > 0 then local query = db.getResult("SELECT `enemy_id` FROM `guild_wars` WHERE `guild_id` = '"..getPlayerGuildId(cid).."' AND `status` = '1'") if query:getID() == -1 then local tery = db.getResult("SELECT `enemy_id` FROM `guild_wars` WHERE `guild_id` = '"..getPlayerGuildId(target).."' AND `status` = '1'") if tery:getID() == -1 then return false end local guild = tery:getDataInt("enemy_id") tery:free() if guild == getPlayerGuildId(cid) then return true end else local enemy = query:getDataInt("enemy_id") query:free() if enemy == getPlayerGuildId(target) then return true end end end return false end function onCombat(cid, target) if isPlayer(cid) and isPlayer(target) then if getPlayerGuildId(cid) == getPlayerGuildId(target) and not isInWar(cid) then if getPlayerStorageValue(cid, 0442200) == 1 then return false end end if getPlayerStorageValue(cid, 0442201) == 1 and getCreatureSkull(target) == 0 and not isFighting(cid, target) then return false end if getPlayerStorageValue(cid, 0442202) == 1 and not isFighting(cid, target) then return false end if getPlayerStorageValue(cid, 0442203) ~= -1 and getPlayerLevel(target) < getPlayerStorageValue(cid, 0442203) then return false end end return true end function onTarget(cid, target) if isPlayer(cid) and isPlayer(target) then if getPlayerGuildId(cid) == getPlayerGuildId(target) and not isInWar(cid) then if getPlayerStorageValue(cid, 0442200) == 1 then doPlayerSendCancel(cid, "Voce nao pode atacar alguem da sua guild pois o modo de pvp guild esta ativado.") return false end end if getPlayerStorageValue(cid, 0442201) == 1 and getCreatureSkull(target) == 0 and not isFighting(cid, target) then doPlayerSendCancel(cid, "Voce nao pode atacar alguem sem skull pois o modo de pvp marked esta ativado.") return false end if getPlayerStorageValue(cid, 0442202) == 1 and not isFighting(cid, target) then doPlayerSendCancel(cid, "Voce nao pode atacar alguem que nao esteja em war contra sua guild pois o modo pvp war esta ativado.") return false end if getPlayerStorageValue(cid, 0442203) ~= -1 and getPlayerLevel(target) < getPlayerStorageValue(cid, 0442203) then doPlayerSendCancel(cid, "Voce nao pode atacar alguem com level menor que "..getPlayerStorageValue(cid, 0442203).." pois o modo de pvp level esta ativado.") return false end end return true end function onLogin(cid) registerCreatureEvent(cid, "PVPSystemC") registerCreatureEvent(cid, "PVPSystemT") return true end