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

Guild No atack And Website No invited

Elexonic

Well-Known Member
Joined
Jun 18, 2008
Messages
1,920
Reaction score
59
as I can make the same guild members can not be hurt either with weapons or magic away .. no way .. agan not any harm only if the same guild ..

This might work?

Code:
function onAttack(cid, target)
 
  if isPlayer(target) and getPlayerGuildId(cid) == getPlayerGuildId(target) then
     local storageId = 101
 
   if getPlayerStorageValue(cid, storageId) == 1 then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You choose not to attack and not to be attacked by guild members.")
     doCreatureSetSkullType(cid, 0) 
	 return false
   elseif getPlayerStorageValue(target, storageId) == 1 then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your target choose to not to attack and not to be attacked by guild members.")
      doCreatureSetSkullType(cid, 0) 
	  return false
   end
  end
 
return true
end
 
Last edited:
your version only protects when attacking, they'd still take magic damage

Code:
function onStatsChange(cid, attacker, type, combat, value)
    if isPlayer(attacker) and getPlayerGuildId(cid) > 0 and getPlayerGuildId(cid) == getPlayerGuildId(attacker) then
        return false
    end
    return true
end
This should work :)

Note: I don't know if getPlayerGuildId returns 0 or nil when the player doesn't have one, but I'm guessing it's 0
If it doesn't work, let me know :p
 
MMmm
works but gives skull I think putting this line is solved .. doCreatureSetSkullType(cid, 0)

also fails to invite me to a player Buged ..fails and does not invite ..
when I invite a player several times I get this error ..

A Database Error Occurred
Error Number: 1062

Duplicate entry '22-1' for key 'player_id'

INSERT INTO `guild_invites` VALUES('22', '1')

Edit:
lol a bug I can not heal S = with exura or other magic ..
 
Last edited:
this script changes nothing related to guild invites, so that isnt the fault of this script
about the skulls, you can't just use that, if a player has a white/red/black skull and he attacks a guild member, that line would remove the skull
without source changes, I can only think of a way to prevent players from getting skulls by targetted attacks, can't think of how to solve area attacks though..

healing fix
Code:
function onStatsChange(cid, attacker, type, combat, value)
    if (combat == STATSCHANGE_HEALTHLOSS or combat == STATSCHANGE_MANALOSS) and isPlayer(attacker) and getPlayerGuildId(cid) > 0 and getPlayerGuildId(cid) == getPlayerGuildId(attacker) then
        return false
    end
    return true
end

Fix target attacks
Code:
function onTarget(cid, target)
    if isPlayer(attacker) and getPlayerGuildId(cid) > 0 and getPlayerGuildId(cid) == getPlayerGuildId(attacker) then
        return false
    end
    return true
end
 
would have to put the two files? and the second prevents the skull ?

testing..

Edit: Don`t Work now if you can heal, but I can do damage, I can attack.
 
Last edited:
This'll do
Code:
function onStatsChange(cid, attacker, type, combat, value)
    if combat ~= STATSCHANGE_HEALTHLOSS and combat ~= STATSCHANGE_MANALOSS and isPlayer(attacker) and getPlayerGuildId(cid) > 0 and getPlayerGuildId(cid) == getPlayerGuildId(attacker) then
        return false
    end
    return true
end
 
Up: Don`t Heal :S

and when I get to follow him in follow [about] if it hurts, with no effects of distance, but close yes.
 
try this
LUA:
function onCombat(cid, target)
local storageId = 101

if isPlayer(cid) and isPlayer(target) then
	if (getPlayerStorageValue(cid, storageId) == 1 and getPlayerGuildId(cid) == getPlayerGuildId(target)) then
		return doPlayerSendCancel(cid, "You choose not to attack and not to be attacked by guild members.")
	elseif (getPlayerStorageValue(target, storageId) == 1 and getPlayerGuildId(cid) == getPlayerGuildId(target)) then
		return doPlayerSendCancel(target, "Your target choose to not to attack and not to be attacked by guild members.")
	end
end
return true
end
XML:
<event type="combat" name="guild_target" event="script" value="guild_target.lua"/>
 
try this
LUA:
function onCombat(cid, target)
local storageId = 101
 
if isPlayer(cid) and isPlayer(target) then
	if getPlayerStorageValue(cid, storageId) == 1 then	
		if getPlayerGuildId(cid) == getPlayerGuildId(target) then
			return doPlayerSendCancel(cid, "You choose not to attack and not to be attacked by guild members.")
		end
	elseif getPlayerStorageValue(target, storageId) == 1 then
		if getPlayerGuildId(cid) == getPlayerGuildId(target) then
			return doPlayerSendCancel(cid, "Your target choose to not to attack and not to be attacked by guild members.")
		end
	end
end
return true
end
if it didn't works try this and tell me what appear in consol when player attack a guild member
LUA:
function onCombat(cid, target)
local storageId = 101
 
if isPlayer(cid) and isPlayer(target) then
	if getPlayerStorageValue(cid, storageId) == 1 then	
		if getPlayerGuildId(cid) == getPlayerGuildId(target) then
			return doPlayerSendCancel(cid, "You choose not to attack and not to be attacked by guild members.")
		end
	elseif getPlayerStorageValue(target, storageId) == 1 then
		if getPlayerGuildId(cid) == getPlayerGuildId(target) then
			return doPlayerSendCancel(cid, "Your target choose to not to attack and not to be attacked by guild members.")
		end
	end
print(getPlayerStorageValue(cid, storageId),getPlayerStorageValue(target, storageId),getPlayerGuildId(cid),getPlayerGuildId(target))
end
return true
end
 
I create new guild... id = 4 [ index.php/guilds/view/4 ]

12:27 You see Pedrico (Level 108). He is a druid. He is Member of the Prueba.
12:27 You see yourself. You are a sorcerer. You are Leader of the Prueba.

-1
-1
4
4
-1
-1
4
4

But somehow that does not give the same storage at the two = S
 
my bad forgot to return false :P
LUA:
function onCombat(cid, target)
local storageId = 101
 
if isPlayer(cid) and isPlayer(target) then
	if getPlayerStorageValue(cid, storageId) == 1 then	
		if getPlayerGuildId(cid) == getPlayerGuildId(target) then
			return doPlayerSendCancel(cid, "You choose not to attack and not to be attacked by guild members.") and false
		end
	elseif getPlayerStorageValue(target, storageId) == 1 then
		if getPlayerGuildId(cid) == getPlayerGuildId(target) then
			return doPlayerSendCancel(cid, "Your target choose to not to attack and not to be attacked by guild members.") and false
		end
	end
end
return true
end
 
Yeah Work :p
Thanks You!!

I am testing this also, do you think might work?
is to use a shorter, but if it does not use yours now works 100% I
I will test it well .. all

Code:
function onCombat(cid, target)
    if isPlayer(target) then
        local k = getPlayerGuildId(cid)
        if k ~= 0 and k == getPlayerGuildId(target) then
            return false
        end
    end
    return true
end
 
Back
Top