Jump to content

Help with Flood


Italo

Recommended Posts

Posted (edited)

I have this anti-deslog in whose combat with this error when the player bleeds or gets shot it appears in the chat endlessly. Warning not to logout. I want to appear only the first time to take a shot or bleed. This script is intended for game mode DayZ.

Mi Please help

Server:

@Edit

Work

Edited by Guest
Posted
So, the problem is that it keeps sending the warning everytime you get shoot? and you just want it to show it once?

Yes

Posted

Try that.

local warningGiven = { } 
  
function outputChange(dataName,oldValue) 
    if getElementType(source) == "player" and dataName == "blood" then 
        local newValue = getElementData(source,dataName) 
        if newValue-oldValue < 0 then 
            if ( not warningGiven [ source ] ) then 
                local time = getRealTime() 
                setElementData ( source, "attacked", time.timestamp ) 
                outputChatBox ( "??? ??? ??????? ????.", getRootElement (), 255, 5, 0 ) 
                outputChatBox ( "?? ???????? ?? ???? 30 ??????.", getRootElement (), 255, 5, 0 ) 
                warningGiven [ source ] = true 
            end 
        end 
    end 
end 
addEventHandler("onElementDataChange",getRootElement(),outputChange) 
  
function antiQuitPlayer ( quitType ) 
    if quitType == "Quit" or quitType == "Timed out" then 
        local time = getRealTime() 
        local leavedTime = getElementData ( source, "attacked" ) 
        if leavedTime then 
            if time.timestamp-leavedTime < 30 then 
            --banPlayer ( source, false, false, true, nil, nil, 3600 ) -- ??? (????????) 
            local playerAccount = getPlayerAccount(source) 
            if (playerAccount) then 
             setAccountData(playerAccount,'blood',-5) 
               end 
            end 
        end 
    end 
    warningGiven [ source ] = nil 
end 
addEventHandler ( "onPlayerQuit", getRootElement(), antiQuitPlayer ) 
  
function onJoin() 
    outputChatBox ( "?? ??????? ??????????", getRootElement (), 255, 5, 0 )   
    outputChatBox ( "Anti Relog 1.2", getRootElement (), 255, 5, 0 )    
end 
addEventHandler("onPlayerJoin",getRootElement(),onJoin) 

P.S: Restore your messages, they all changed to "??????" when I copied it to notepad++.

Posted
Try that.
local warningGiven = { } 
  
function outputChange(dataName,oldValue) 
    if getElementType(source) == "player" and dataName == "blood" then 
        local newValue = getElementData(source,dataName) 
        if newValue-oldValue < 0 then 
            if ( not warningGiven [ source ] ) then 
                local time = getRealTime() 
                setElementData ( source, "attacked", time.timestamp ) 
                outputChatBox ( "??? ??? ??????? ????.", getRootElement (), 255, 5, 0 ) 
                outputChatBox ( "?? ???????? ?? ???? 30 ??????.", getRootElement (), 255, 5, 0 ) 
                warningGiven [ source ] = true 
            end 
        end 
    end 
end 
addEventHandler("onElementDataChange",getRootElement(),outputChange) 
  
function antiQuitPlayer ( quitType ) 
    if quitType == "Quit" or quitType == "Timed out" then 
        local time = getRealTime() 
        local leavedTime = getElementData ( source, "attacked" ) 
        if leavedTime then 
            if time.timestamp-leavedTime < 30 then 
            --banPlayer ( source, false, false, true, nil, nil, 3600 ) -- ??? (????????) 
            local playerAccount = getPlayerAccount(source) 
            if (playerAccount) then 
             setAccountData(playerAccount,'blood',-5) 
               end 
            end 
        end 
    end 
    warningGiven [ source ] = nil 
end 
addEventHandler ( "onPlayerQuit", getRootElement(), antiQuitPlayer ) 
  
function onJoin() 
    outputChatBox ( "?? ??????? ??????????", getRootElement (), 255, 5, 0 )   
    outputChatBox ( "Anti Relog 1.2", getRootElement (), 255, 5, 0 )    
end 
addEventHandler("onPlayerJoin",getRootElement(),onJoin) 

P.S: Restore your messages, they all changed to "??????" when I copied it to notepad++.

Worked. But it appears only 1 time. I wish that when the player took damage aparessece 1 time and when the message appeared again levassse other damage. This way you put so appears 1 time and will not appear mais.Mi sorry if I'm a little confused to understand because I do not speak English and do not know how to explain the situation well. You could set it up for this?

Posted

When a player takes damage warning appears 1 time and no longer appears. I wanted it to appear first time every time the player takes damage. For before he was appearing at the time that led to an injury.

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...