Lua:
local function checkForPartyChanges(cid)
if not isPlayer(cid) then
return
end
if not isInParty(cid) then
return
end
local sto = getPlayerStorageValue(cid, 4875498)
local party = getPartyMembers(cid)
local canEnableExpShare = true
if sto == 1 then
return
end
for i = 1, #party do
for j = i + 1, #party do
local levelDifference = math.abs(getPlayerLevel(party[i]) - getPlayerLevel(party[j]))
if levelDifference > 15 then
canEnableExpShare = false
break
end
end
if not canEnableExpShare then
break
end
end
if not canEnableExpShare then
for i = 1, #party do
setPlayerStorageValue(party[i], 4875498, 1)
doPlayerSendTextMessage(party[i], 22, "The Exp in Party is disabled! Reason: Experience difference between party members.")
end
return
end
if canEnableExpShare then
for i = 1, #party do
setPlayerStorageValue(party[i], 4875498, 2)
end
end
addEvent(checkForPartyChanges, 1000, cid)
end
function onSay(cid, words, param, channel)
if isInParty(cid) then
local party = getPartyMembers(cid)
local canEnableExpShare = true
local sto = getPlayerStorageValue(cid, 4875498)
for i = 1, #party do
for j = i + 1, #party do
local levelDifference = math.abs(getPlayerLevel(party[i]) - getPlayerLevel(party[j]))
if levelDifference > 15 then
canEnableExpShare = false
break
end
end
if not canEnableExpShare then
break
end
end
if party[#party] == cid then
if canEnableExpShare then
for i = 1, #party do
if sto == 2 then
setPlayerStorageValue(party[i], 4875498, 1)
doPlayerSendTextMessage(party[i], 22, "The Exp in Party is disabled!")
else
setPlayerStorageValue(party[i], 4875498, 2)
doPlayerSendTextMessage(party[i], 22, "The Exp in Party is enabled!")
if cid == party[i] then
checkForPartyChanges(cid)
doPlayerSendTextMessage(party[i], 22, "Automatic Party Checker activated.")
end
end
end
else
doPlayerSendTextMessage(cid, 27, "The level difference between party members cannot exceed 15 levels.")
setPlayerStorageValue(cid, 4875498, 0)
end
else
doPlayerSendTextMessage(cid, 27, "Only the leader of the party can do that!")
end
else
doPlayerSendTextMessage(cid, 27, "You need to be a leader of a party to do that!")
end
return true
end
Last edited: