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

Help with Globalevent

villelagui

C++ Programmer
Joined
May 16, 2009
Messages
25
Reaction score
3
Location
Brasil
So, i got this script , already configured everything and it's working great, however i wanted to add an exception, for when the player is in protected zone the script wont affect them...


Here's the script:
Lua:
function onThink(interval, lastExecution)
for x=1,#getOnlinePlayers() do
if getPlayerAccess(getCreatureByName(getOnlinePlayers()[x])) < 4 and (not isPlayerPzLocked(getCreatureByName(getOnlinePlayers()[x]))) and getOnlinePlayers()[x] ~= "Account Manager" then
    if getPlayerStorageValue(getCreatureByName(getOnlinePlayers()[x]),9564) == -1 then
        local numero = math.random(0,99999)
        doPlayerSendTextMessage(getCreatureByName(getOnlinePlayers()[x]), MESSAGE_STATUS_WARNING, 'Anti-bot system by Villela. Seu número de confirmação anti-bot é: '..numero..'. Por favor digite !anthaab XXXXX onde XXXXX é seu número de confirmação.')
        setPlayerStorageValue(getCreatureByName(getOnlinePlayers()[x]),9564,numero)
    elseif getPlayerStorageValue(getCreatureByName(getOnlinePlayers()[x]),9565) == -1 then
        setPlayerStorageValue(getCreatureByName(getOnlinePlayers()[x]),9565,1)
        doPlayerSendTextMessage(getCreatureByName(getOnlinePlayers()[x]), MESSAGE_STATUS_WARNING, 'Último aviso. Confirme seu número gerado pelo sistema anti-bot pelo comando !anthaab ou você será banido.')
    elseif getPlayerStorageValue(getCreatureByName(getOnlinePlayers()[x]),9565) == 1 then
        doAddAccountBanishment(getAccountIdByName(getOnlinePlayers()[x]))
        setPlayerStorageValue(getCreatureByName(getOnlinePlayers()[x]),9565,-1)
        doRemoveCreature(getCreatureByName(getOnlinePlayers()[x]))
    end
end
end
   return TRUE
end

As you can see here there's an exception that's almost like the one i want, that is to check if player is pzlocked or not, wanted to add another one to check if player is in safe zone...
Lua:
if getPlayerAccess(getCreatureByName(getOnlinePlayers()[x])) < 4 and (not isPlayerPzLocked(getCreatureByName(getOnlinePlayers()[x]))) and getOnlinePlayers()[x] ~= "Account Manager" then
 
Solution
Lua:
function onThink(interval, lastExecution)

    for _,pid in ipairs(getPlayersOnline()) do

        if getPlayerAccess(pid) < 4 and (not isPlayerPzLocked(pid)) and getCreatureName(pid) ~= "Account Manager" and (not getTilePzInfo(getCreaturePosition(pid))) then
            if getPlayerStorageValue(pid,9564) == -1 then
                local numero = math.random(0,99999)
                doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, 'Anti-bot system by Villela. Seu número de confirmação anti-bot é: '..numero..'. Por favor digite !anthaab XXXXX onde XXXXX é seu número de confirmação.')
                setPlayerStorageValue(pid,9564,numero)
            elseif getPlayerStorageValue(pid,9565) == -1 then...
Lua:
function onThink(interval, lastExecution)

    for _,pid in ipairs(getPlayersOnline()) do

        if getPlayerAccess(pid) < 4 and (not isPlayerPzLocked(pid)) and getCreatureName(pid) ~= "Account Manager" and (not getTilePzInfo(getCreaturePosition(pid))) then
            if getPlayerStorageValue(pid,9564) == -1 then
                local numero = math.random(0,99999)
                doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, 'Anti-bot system by Villela. Seu número de confirmação anti-bot é: '..numero..'. Por favor digite !anthaab XXXXX onde XXXXX é seu número de confirmação.')
                setPlayerStorageValue(pid,9564,numero)
            elseif getPlayerStorageValue(pid,9565) == -1 then
                setPlayerStorageValue(pid,9565,1)
                doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, 'Último aviso. Confirme seu número gerado pelo sistema anti-bot pelo comando !anthaab ou você será banido.')
            elseif getPlayerStorageValue(pid,9565) == 1 then
                doAddAccountBanishment(getAccountIdByName(getOnlinePlayers()[x]))
                setPlayerStorageValue(pid,9565,-1)
                doRemoveCreature(pid)
            end
        end
    end

    return true
end
 
Solution
Lua:
function onThink(interval, lastExecution)

    for _,pid in ipairs(getPlayersOnline()) do

        if getPlayerAccess(pid) < 4 and (not isPlayerPzLocked(pid)) and getCreatureName(pid) ~= "Account Manager" and (not getTilePzInfo(getCreaturePosition(pid))) then
            if getPlayerStorageValue(pid,9564) == -1 then
                local numero = math.random(0,99999)
                doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, 'Anti-bot system by Villela. Seu número de confirmação anti-bot é: '..numero..'. Por favor digite !anthaab XXXXX onde XXXXX é seu número de confirmação.')
                setPlayerStorageValue(pid,9564,numero)
            elseif getPlayerStorageValue(pid,9565) == -1 then
                setPlayerStorageValue(pid,9565,1)
                doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, 'Último aviso. Confirme seu número gerado pelo sistema anti-bot pelo comando !anthaab ou você será banido.')
            elseif getPlayerStorageValue(pid,9565) == 1 then
                doAddAccountBanishment(getAccountIdByName(getOnlinePlayers()[x]))
                setPlayerStorageValue(pid,9565,-1)
                doRemoveCreature(pid)
            end
        end
    end

    return true
end


thank you so much my friend, rep++
 
Back
Top