Perfect Posted August 23, 2012 Share Posted August 23, 2012 Hi All, I get this script from a topic and i add some changes but script not working. function autounban(player,cmd,targetPlayer) tPlayer = getPlayerFromName(targetPlayer) if tPlayer then if not getElementData(tPlayer, "auto.unban") then setElementData(tPlayer, "auto.unban", true) outputChatBox("You have given unbanned protection to "..targetPlayer.." !", player) else setElementData(tPlayer, "lift.permission", false) outputChatBox("You have taken unbanned protestion from "..targetPlayer.." !", player) end end end addCommandHandler("banprotect", autounban) function(player,targetPlayer) tPlayer = getPlayerFromName(targetPlayer) if getElementData(player, "auto.unban") then local tIP = getPlayerIP(targetPlayer) local tSerial = getPlayerSerial(targetPlayer) local tName = getPlayerName(targetPlayer) addEventHandler ( "onBan", root, function ( theBan ) local bSerial = getBanSerial ( theBan ) local bIP = getBanIP ( theBan ) local bNick = getBanNick ( theBan ) if ( tSerial [ bSerial ] or tIP [ bIP ] or tName [ bNick ] ) then removeBan ( theBan ) end end ) Link to comment
denny199 Posted August 23, 2012 Share Posted August 23, 2012 debug it. something like this function autounban(player,cmd,targetPlayer) tPlayer = getPlayerFromName(targetPlayer) if tPlayer then outputChatBox ( "tplayer = true" ) if not getElementData(tPlayer, "auto.unban") then outputChatBox ( "auto ban data = false" ) setElementData(tPlayer, "auto.unban", true) outputChatBox("You have given unbanned protection to "..targetPlayer.." !", player) else outputChatBox ( "auto ban data = true" ) setElementData(tPlayer, "lift.permission", false) outputChatBox("You have taken unbanned protestion from "..targetPlayer.." !", player) end end end Link to comment
Perfect Posted August 23, 2012 Author Share Posted August 23, 2012 debug it.something like this function autounban(player,cmd,targetPlayer) tPlayer = getPlayerFromName(targetPlayer) if tPlayer then outputChatBox ( "tplayer = true" ) if not getElementData(tPlayer, "auto.unban") then outputChatBox ( "auto ban data = false" ) setElementData(tPlayer, "auto.unban", true) outputChatBox("You have given unbanned protection to "..targetPlayer.." !", player) else outputChatBox ( "auto ban data = true" ) setElementData(tPlayer, "lift.permission", false) outputChatBox("You have taken unbanned protestion from "..targetPlayer.." !", player) end end end i put that and i got warning unban/unban.lua:1: unexpected symbol near "(" Link to comment
Guest Guest4401 Posted August 23, 2012 Share Posted August 23, 2012 i put that and i gotwarning unban/unban.lua:1: unexpected symbol near "(" Read all the posts: viewtopic.php?f=91&t=46871#p466107 Link to comment
Perfect Posted August 23, 2012 Author Share Posted August 23, 2012 i put that and i gotwarning unban/unban.lua:1: unexpected symbol near "(" Read all the posts: viewtopic.php?f=91&t=46871#p466107 Thnx, script started working and added some changes then again script stoped working function autounban(player,cmd,targetPlayer) tPlayer = getPlayerFromName(targetPlayer) if tPlayer then outputChatBox ( " "..targetPlayer.." = True", player, 0, 255, 0) else outputChatBox ( " "..targetPlayer.." = False", player, 255, 0, 0) if not getElementData(tPlayer, "auto.unban") then outputChatBox ( "Banned = false", player, 0, 255, 0) setElementData(tPlayer, "auto.unban", true) outputChatBox("You have given unbanned protection to "..targetPlayer.." !", player, 0, 255, 0) else outputChatBox ( "#FF0000Banned = true", player, 255, 255, 255, true) setElementData(tPlayer, "lift.permission", false) outputChatBox("You have taken unbanned protection from "..targetPlayer.." !", player, 255, 0, 0) end end end addCommandHandler("banprotect", autounban) function unban(player,targetPlayer) tPlayer = getPlayerFromName(targetPlayer) if getElementData(player, "auto.unban") then local tIP = getPlayerIP(targetPlayer) local tSerial = getPlayerSerial(targetPlayer) local tName = getPlayerName(targetPlayer) addEventHandler ( "onBan", root, function ( theBan ) local bSerial = getBanSerial ( theBan ) local bIP = getBanIP ( theBan ) local bNick = getBanNick ( theBan ) if ( tSerial [ bSerial ] or tIP [ bIP ] or tName [ bNick ] ) then removeBan ( theBan ) end end ) end end Link to comment
denny199 Posted August 24, 2012 Share Posted August 24, 2012 U debugged it wrong function autounban(player,cmd,targetPlayer) tPlayer = getPlayerFromName(targetPlayer) if tPlayer then outputChatBox ( " "..tPlayer.." = True", player, 0, 255, 0) -- targetPlayer Returns nothing, bcs it is needed getplayerfromname. else outputChatBox ( "Target player = False", player, 255, 0, 0) -- because it returns nil we used this if not getElementData(tPlayer, "auto.unban") then outputChatBox ( "Banned = false", player, 0, 255, 0) setElementData(tPlayer, "auto.unban", true) outputChatBox("You have given unbanned protection to "..tPlayer.." !", player, 0, 255, 0) else outputChatBox ( "#FF0000Banned = true", player, 255, 255, 255, true) setElementData(tPlayer, "lift.permission", false) outputChatBox("You have taken unbanned protection from "..tPlayer.." !", player, 255, 0, 0) end end end addCommandHandler("banprotect", autounban) function unban(player,targetPlayer) tPlayer = getPlayerFromName(targetPlayer) if getElementData(player, "auto.unban") then local tIP = getPlayerIP(targetPlayer) local tSerial = getPlayerSerial(targetPlayer) local tName = getPlayerName(targetPlayer) addEventHandler ( "onBan", root, function ( theBan ) local bSerial = getBanSerial ( theBan ) local bIP = getBanIP ( theBan ) local bNick = getBanNick ( theBan ) if ( tSerial [ bSerial ] or tIP [ bIP ] or tName [ bNick ] ) then removeBan ( theBan ) end end ) end end Link to comment
Perfect Posted August 24, 2012 Author Share Posted August 24, 2012 U debugged it wrong function autounban(player,cmd,targetPlayer) tPlayer = getPlayerFromName(targetPlayer) if tPlayer then outputChatBox ( " "..tPlayer.." = True", player, 0, 255, 0) -- targetPlayer Returns nothing, bcs it is needed getplayerfromname. else outputChatBox ( "Target player = False", player, 255, 0, 0) -- because it returns nil we used this if not getElementData(tPlayer, "auto.unban") then outputChatBox ( "Banned = false", player, 0, 255, 0) setElementData(tPlayer, "auto.unban", true) outputChatBox("You have given unbanned protection to "..tPlayer.." !", player, 0, 255, 0) else outputChatBox ( "#FF0000Banned = true", player, 255, 255, 255, true) setElementData(tPlayer, "lift.permission", false) outputChatBox("You have taken unbanned protection from "..tPlayer.." !", player, 255, 0, 0) end end end addCommandHandler("banprotect", autounban) function unban(player,targetPlayer) tPlayer = getPlayerFromName(targetPlayer) if getElementData(player, "auto.unban") then local tIP = getPlayerIP(targetPlayer) local tSerial = getPlayerSerial(targetPlayer) local tName = getPlayerName(targetPlayer) addEventHandler ( "onBan", root, function ( theBan ) local bSerial = getBanSerial ( theBan ) local bIP = getBanIP ( theBan ) local bNick = getBanNick ( theBan ) if ( tSerial [ bSerial ] or tIP [ bIP ] or tName [ bNick ] ) then removeBan ( theBan ) end end ) end end working but in wrong way. if i typed /banprotect then its shows "target player = false" and "banned false". and anothere thing is i typed /banprotect but it did'nt show anything. i want if i type /banprotect not player name then it will show something like this "Please write player name. /banprotect Help!!! Link to comment
sockz Posted August 24, 2012 Share Posted August 24, 2012 function autounban(player,cmd,targetPlayer) local tPlayer = getPlayerFromName(targetPlayer) if getElementData(tPlayer, "auto.unban") == false then setElementData(tPlayer, 'auto.unban', true) outputDebugString('data added') else setElementData(tPlayer, 'auto.unban', false) outputDebugString('data removed') end end addCommandHandler("pban", autounban) Link to comment
Perfect Posted August 24, 2012 Author Share Posted August 24, 2012 function autounban(player,cmd,targetPlayer) local tPlayer = getPlayerFromName(targetPlayer) if getElementData(tPlayer, "auto.unban") == false then setElementData(tPlayer, 'auto.unban', true) outputDebugString('data added') else setElementData(tPlayer, 'auto.unban', false) outputDebugString('data removed') end end addCommandHandler("pban", autounban) This will fix this working but in wrong way. if i typed /banprotect then its shows "target player = false" and "banned false".and anothere thing is i typed /banprotect but it did'nt show anything. i want if i type /banprotect not player name then it will show something like this "Please write player name. /banprotect Link to comment
sockz Posted August 24, 2012 Share Posted August 24, 2012 I'm curious though, the element data wipes when you disconnect from the server, so how does this work? Link to comment
Jaysds1 Posted August 25, 2012 Share Posted August 25, 2012 The element data are stored on live elements, so if they are destroyed, meaning if the player leaves the server then the element data get's destroyed. 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