zbizu
Legendary OT User
Do not post that script on other forums without my permission
talkactions.xml:
flagcalc.lua:
creaturescripts.xml:
login.lua:
flag_window.lua:
talkactions.xml:
Code:
<talkaction words="/flags" script="flagcalc.lua"/>
flagcalc.lua:
Code:
player_flags = {
[0] = "CannotUseCombat",
[1] = "CannotAttackPlayer",
[2] = "CannotAttackMonster",
[3] = "CannotBeAttacked",
[4] = "CanConvinceAll",
[5] = "CanSummonAll",
[6] = "CanIllusionAll",
[7] = "CanSenseInvisibility",
[8] = "IgnoredByMonsters",
[9] = "NotGainInFight",
[10] = "HasInfiniteMana",
[11] = "HasInfiniteSoul",
[12] = "HasNoExhaustion",
[13] = "CannotUseSpells",
[14] = "CannotPickupItem",
[15] = "CanAlwaysLogin",
[16] = "CanBroadcast",
[17] = "CanEditHouses",
[18] = "CannotBeBanned",
[19] = "CannotBePushed",
[20] = "HasInfiniteCapacity",
[21] = "CanPushAllCreatures",
[22] = "CanTalkRedPrivate",
[23] = "CanTalkRedChannel",
[24] = "TalkOrangeHelpChannel",
[25] = "NotGainExperience",
[26] = "NotGainMana",
[27] = "NotGainHealth",
[28] = "NotGainSkill",
[29] = "SetMaxSpeed",
[30] = "SpecialVIP",
[31] = "NotGenerateLoot",
[32] = "CanTalkRedChannelAnonymous",
[33] = "IgnoreProtectionZone",
[34] = "IgnoreSpellCheck",
[35] = "IgnoreWeaponCheck",
[36] = "CannotBeMuted",
[37] = "IsAlwaysPremium"
}
player_flags_calc = {}
function nextFlag(cid, id, modalid)
local firstWindow = ModalWindow(modalid, "Player Flag Calculator", player_flags[id])
firstWindow:addButton(1, "true")
firstWindow:addButton(2, "false")
firstWindow:addButton(3, "stop")
firstWindow:setDefaultEnterButton(1)
firstWindow:setDefaultEscapeButton(3)
firstWindow:sendToPlayer(cid)
return true
end
function onSay(cid, words, param)
if Player(cid):getAccountType() >= ACCOUNT_TYPE_GOD then
player_flags_calc[cid] = 0
nextFlag(cid, 0, 9000)
end
return false
end
creaturescripts.xml:
Code:
<event type="modalwindow" name="flagw" script="flag_window.lua"/>
login.lua:
Code:
player:registerEvent("flagw")
flag_window.lua:
Code:
function onModalWindow(cid, modalWindowId, buttonId, choiceId)
if modalWindowId < 9000 or modalWindowId > 9050 then
return false
end
if Player(cid):getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
if buttonId == 1 then
player_flags_calc[cid] = player_flags_calc[cid] + 2 ^ (modalWindowId - 9000)
elseif buttonId == 3 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Output: " .. player_flags_calc[cid])
return true
end
if player_flags[modalWindowId + 1 - 9000] ~= nil then
nextFlag(cid, modalWindowId + 1 - 9000, modalWindowId + 1)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Output: " .. player_flags_calc[cid])
end
return true
end
Last edited: