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

Storage can't attack Storage

Joined
May 23, 2010
Messages
185
Reaction score
23
How can i make a script that a person who has the Storage X can't attack the person who have storage X too.
 
Lua:
function onCombat(cid, target)
	if isPlayer(target) and getCreatureStorage(cid, x) ~= -1 and getCreatureStorage(target, x) ~= -1 then
		return false
	end
	return true
end
 
Last edited:
Lua:
function onCombat(cid, target)
	if isPlayer(target) and getCreatureStorage(cid, x) ~= -1 and getCreatureStorage(cid, target) ~= -1 then
		return false
	end
	return true
end

Mmm... Cykotitan, why u put in the getCreatureStorage of the player that attacks (cid, TARGET)???
I think there need to be the storage number... :/
Lua:
local storage = xxxxxx
function onCombat(cid, target)
	if isPlayer(target) and getCreatureStorage(cid, storage) ~= -1 and getCreatureStorage(cid, storage) ~= -1 then
		return false
	end
	return true
end
In mine u can configure the storage changing the x to the number of the storage... ;)
Hope it works...

Credits:
Cykotitan: 90% ---- does the script
Me: 10% ------ Fix the script and make it configurable...
 
In mine u can configure the storage changing the x to the number of the storage...
Hope it works...

Credits:
Cykotitan: 90% ---- does the script
Me: 10% ------ Fix the script and make it configurable...

-- Cykotitan: 99%
You: 1% for add local storage.... ¬¬
 
In mine u can configure the storage changing the x to the number of the storage...
Hope it works...

Credits:
Cykotitan: 90% ---- does the script
Me: 10% ------ Fix the script and make it configurable...

-- Cykotitan: 99%
You: 1% for add local storage.... ¬¬
 
Mmm... Cykotitan, why u put in the getCreatureStorage of the player that attacks (cid, TARGET)???
I think there need to be the storage number... :/
Lua:
local storage = xxxxxx
function onCombat(cid, target)
	if isPlayer(target) and getCreatureStorage(cid, storage) ~= -1 and getCreatureStorage(cid, storage) ~= -1 then
		return false
	end
	return true
end
In mine u can configure the storage changing the x to the number of the storage... ;)
Hope it works...

Credits:
Cykotitan: 90% ---- does the script
Me: 10% ------ Fix the script and make it configurable...
3674050796_23706d55bb.jpg
 
Code:
if isPlayer(target) and [COLOR="red"]getCreatureStorage(cid, storage) ~= -1 and getCreatureStorage(cid, storage) ~= -1[/COLOR] then
What? <_<

EDIT:
Lua:
local storage = xxxxxx
function onCombat(cid, target)
	if(isPlayer(target) and getCreatureStorage(cid, storage) > 0 and getCreatureStorage(target, storage) > 0) then
		return false
	end

	return true
end
In this case I think it's better to use '> 0' but oh well...it's just me, you can change it to '~= 1' again if you want.

Or try this...
Lua:
local storage = xxxxxx
function onCombat(cid, target)
	if(isPlayer(target)) then
		if(getCreatureStorage(cid, storage) == getCreatureStorage(target, storage)) then
			return false
		end
	end

	return true
end
This will return false if a player with certain storage value attacks another with the same value.

@down: Probably he thought that one check is not enough and you have to check it 2+ times...like Santa!
 
Last edited:
Mmm... Cykotitan, why u put in the getCreatureStorage of the player that attacks (cid, TARGET)???
I think there need to be the storage number... :/
Lua:
local storage = xxxxxx
function onCombat(cid, target)
	if isPlayer(target) and getCreatureStorage(cid, storage) ~= -1 and getCreatureStorage(cid, storage) ~= -1 then
		return false
	end
	return true
end
In mine u can configure the storage changing the x to the number of the storage... ;)
Hope it works...

Credits:
Cykotitan: 90% ---- does the script
Me: 10% ------ Fix the script and make it configurable...
0/10

thats still not it. you're checking the same thing twice? :s
 
Code:
if isPlayer(target) and [COLOR="red"]getCreatureStorage(cid, storage) ~= -1 and getCreatureStorage(cid, storage) ~= -1[/COLOR] then
What? <_<

EDIT:
Lua:
local storage = xxxxxx
function onCombat(cid, target)
	if(isPlayer(target) and getCreatureStorage(cid, storage) > 0 and getCreatureStorage(target, storage) > 0) then
		return false
	end

	return true
end
In this case I think it's better to use '> 0' but oh well...it's just me, you can change it to '~= 1' again if you want.

Or try this...
Lua:
local storage = xxxxxx
function onCombat(cid, target)
	if(isPlayer(target)) then
		if(getCreatureStorage(cid, storage) == getCreatureStorage(target, storage)) then
			return false
		end
	end

	return true
end
This will return false if a player with certain storage value attacks another with the same value.

@down: Probably he thought that one check is not enough and you have to check it 2+ times...like Santa!

~= is faster than >
 
Lua:
local storage = 12345
function onCombat(cid, target)
	if(not isPlayer(target)) then return true end
	if(getCreatureStorage(cid, storage) ~= getCreatureStorage(target, storage)) then return true end
	return false
end
 
Yeah.... the default value is -1..... So they will no attack anybody.??? And when someone obtains the storage with value 1..... He will be only one u can attack??? :/ Lol
 
Lua:
local storage = 12345
function onCombat(cid, target)
	if(not isPlayer(target)) then return true end
	return (getCreatureStorage(cid, storage) + getCreatureStorage(target, storage)) == 2 and false or true
end

weak but might do the trick
 
No. Neither he nor we need such a script because it's weak and unoptimized. Scripts like this will slow down everything :f
 
Lua:
local storage = 12345
function onCombat(cid, target)
	if(not isPlayer(target)) then return true end
	return (getCreatureStorage(cid, storage) + getCreatureStorage(target, storage)) == 2 and false or true
end

weak but might do the trick
nara. mine is faster
 
Back
Top