- 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(cid, target) ~= -1 then return false end return true end
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...
Mmm... Cykotitan, why u put in the getCreatureStorage of the player that attacks (cid, TARGET)???
I think there need to be the storage number... :/
In mine u can configure the storage changing the x to the number of the storage...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
Hope it works...
Credits:
Cykotitan: 90% ---- does the script
Me: 10% ------ Fix the script and make it configurable...
if isPlayer(target) and [COLOR="red"]getCreatureStorage(cid, storage) ~= -1 and getCreatureStorage(cid, storage) ~= -1[/COLOR] then
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
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
0/10Mmm... Cykotitan, why u put in the getCreatureStorage of the player that attacks (cid, TARGET)???
I think there need to be the storage number... :/
In mine u can configure the storage changing the x to the number of the storage...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
Hope it works...
Credits:
Cykotitan: 90% ---- does the script
Me: 10% ------ Fix the script and make it configurable...
What? <_<Code:if isPlayer(target) and [COLOR="red"]getCreatureStorage(cid, storage) ~= -1 and getCreatureStorage(cid, storage) ~= -1[/COLOR] then
EDIT:
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.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
Or try this...
This will return false if a player with certain storage value attacks another with the same value.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
@down: Probably he thought that one check is not enough and you have to check it 2+ times...like Santa!
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
it'll only work if they have different values? nice logic, what if they're both set to -1?Lua:if(getCreatureStorage(cid, storage) ~= getCreatureStorage(target, storage)) then return true end
How can i make a script that a person who has the Storage X can't attack the person who have storage X too.
@Cykotitan
-1 == -1 => storage == storage => can't attack
same as in request : D
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
nara. mine is fasterLua: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