John_Scott Posted July 28, 2013 Share Posted July 28, 2013 Hello! I have a DayZ szerver, and i see some player has log out when other player shoot he. I would like to found a Anti Combat Logout system. How i imagine this? When the player get shoot, the system put he to Combat state. When the player logout in this, the system ban he to 1day. The combat state lasts 1 minute and not activate to hiting and falling. Anybody can write this? Please help me and my server whit this resource. Thanks! Link to comment
iMr.3a[Z]eF Posted July 28, 2013 Share Posted July 28, 2013 You mean like this? addEventHandler("onPlayerLogout", getRootElement(), function() if isPlayerDead(source) then cancelEvent() end end ) Link to comment
John_Scott Posted July 28, 2013 Author Share Posted July 28, 2013 You mean like this? addEventHandler("onPlayerLogout", getRootElement(), function() if isPlayerDead(source) then cancelEvent() end end ) Yes, when player logging out in combat, the script ban he for 1 day Link to comment
iMr.3a[Z]eF Posted July 28, 2013 Share Posted July 28, 2013 Why no't canceling instead ban? Link to comment
John_Scott Posted July 28, 2013 Author Share Posted July 28, 2013 Why no't canceling instead ban? I want to warning the player, not ban forever, but i just would like a base script Link to comment
FatalTerror Posted July 28, 2013 Share Posted July 28, 2013 Hello!I have a DayZ szerver, and i see some player has log out when other player shoot he. I would like to found a Anti Combat Logout system. How i imagine this? When the player get shoot, the system put he to Combat state. When the player logout in this, the system ban he to 1day. The combat state lasts 1 minute and not activate to hiting and falling. Anybody can write this? Please help me and my server whit this resource. Thanks! I think I understand what you are looking for: addEventHandler("onPlayerDamage", getRootElement(), function(attacker, weapon, body, loss) if (attacker ~= source) then local attackAccount = getPlayerAccount(attacker) local sourceAccount = getPlayerAccount(source) if not isGuestAccount(attackAccount) then if not isGuestAccount(sourceAccount) then setAccountData(attackAccount, "antideslog", false) setTimer(function() for i, v in ipairs(getElementsByType("player"))do if v == attacker then setAccountData(attackAccount, "antideslog", true) end end end, 60000, 1) end setAccountData(sourceAccount, "antideslog", false) setTimer(function() for i, v in ipairs(getElementsByType("player"))do if v == source then setAccountData(sourceAccount, "antideslog", true) end end end, 60000, 1) end end end) addEventHandler("onPlayerLogin", getRootElement(), function(previous, current, autologin) if current then local data = getAccountData(current, "antideslog") if (data == true) then -- ok, he can play elseif(data == false)then -- ban the player setAccountData(current, "antideslog", true) banPlayer(source) else end end end) Link to comment
John_Scott Posted July 28, 2013 Author Share Posted July 28, 2013 Hello!I have a DayZ szerver, and i see some player has log out when other player shoot he. I would like to found a Anti Combat Logout system. How i imagine this? When the player get shoot, the system put he to Combat state. When the player logout in this, the system ban he to 1day. The combat state lasts 1 minute and not activate to hiting and falling. Anybody can write this? Please help me and my server whit this resource. Thanks! I think I understand what you are looking for: addEventHandler("onPlayerDamage", getRootElement(), function(attacker, weapon, body, loss) if (attacker ~= source) then local attackAccount = getPlayerAccount(attacker) local sourceAccount = getPlayerAccount(source) if not isGuestAccount(attackAccount) then if not isGuestAccount(sourceAccount) then setAccountData(attackAccount, "antideslog", false) setTimer(function() for i, v in ipairs(getElementsByType("player"))do if v == attacker then setAccountData(attackAccount, "antideslog", true) end end end, 60000, 1) end setAccountData(sourceAccount, "antideslog", false) setTimer(function() for i, v in ipairs(getElementsByType("player"))do if v == source then setAccountData(sourceAccount, "antideslog", true) end end end, 60000, 1) end end end) addEventHandler("onPlayerLogin", getRootElement(), function(previous, current, autologin) if current then local data = getAccountData(current, "antideslog") if (data == true) then -- ok, he can play elseif(data == false)then -- ban the player setAccountData(current, "antideslog", true) banPlayer(source) else end end end) Oh sorry, i can't scripting too good, and this code not working you would do me, write messages, where put In combat, where put OUT combat and etc... Link to comment
FatalTerror Posted July 28, 2013 Share Posted July 28, 2013 Oh sorry, i can't scripting too good, and this code not working you would do me, write messages, where put In combat, where put OUT combat and etc... Well, the script should work... I put some comments in the code. addEventHandler("onPlayerDamage", getRootElement(), function(attacker, weapon, body, loss) if not (attacker == source) then local attackAccount = getPlayerAccount(attacker) local sourceAccount = getPlayerAccount(source) if not isGuestAccount(sourceAccount) then if not isGuestAccount(attackAccount) then setAccountData(attackAccount, "antideslog", false) setTimer(function() for i, v in ipairs(getElementsByType("player"))do -- check if the player still connected in the server if v == attacker then setAccountData(attackAccount, "antideslog", true) -- The attacker is not in combat anymore after 1 min end end end, 60000, 1) end setAccountData(sourceAccount, "antideslog", false) setTimer(function() for i, v in ipairs(getElementsByType("player"))do -- check if the player still connected in the server if v == source then setAccountData(sourceAccount, "antideslog", true) -- The player who receive the shot is not in combat anymore after 1 min end end end, 60000, 1) end -- They are now in combat. end end) addEventHandler("onPlayerLogin", getRootElement(), function(previous, current, autologin) if current then local data = getAccountData(current, "antideslog") if (data == true) then -- ok, he can play elseif(data == false)then -- ban the player setAccountData(current, "antideslog", true) banPlayer(source) else end end end) Link to comment
John_Scott Posted July 28, 2013 Author Share Posted July 28, 2013 Oh sorry, i can't scripting too good, and this code not working you would do me, write messages, where put In combat, where put OUT combat and etc... Well, the script should work... I put some comments in the code. addEventHandler("onPlayerDamage", getRootElement(), function(attacker, weapon, body, loss) if not (attacker == source) then local attackAccount = getPlayerAccount(attacker) local sourceAccount = getPlayerAccount(source) if not isGuestAccount(sourceAccount) then if not isGuestAccount(attackAccount) then setAccountData(attackAccount, "antideslog", false) setTimer(function() for i, v in ipairs(getElementsByType("player"))do -- check if the player still connected in the server if v == attacker then setAccountData(attackAccount, "antideslog", true) -- The attacker is not in combat anymore after 1 min end end end, 60000, 1) end setAccountData(sourceAccount, "antideslog", false) setTimer(function() for i, v in ipairs(getElementsByType("player"))do -- check if the player still connected in the server if v == source then setAccountData(sourceAccount, "antideslog", true) -- The player who receive the shot is not in combat anymore after 1 min end end end, 60000, 1) end -- They are now in combat. end end) addEventHandler("onPlayerLogin", getRootElement(), function(previous, current, autologin) if current then local data = getAccountData(current, "antideslog") if (data == true) then -- ok, he can play elseif(data == false)then -- ban the player setAccountData(current, "antideslog", true) banPlayer(source) else end end end) Many thanks! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now