Help with Globalevent

villelagui

C++ Programmer
Joined
May 16, 2009
Messages
27
Best answers
0
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
 

Sun

Knowledge is power - France is bacon
Joined
Jan 26, 2015
Messages
333
Best answers
22
Reaction score
174
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
 
OP
villelagui

villelagui

C++ Programmer
Joined
May 16, 2009
Messages
27
Best answers
0
Reaction score
3
Location
Brasil
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++
 
Top