codeluaeveryday Posted October 9, 2011 Share Posted October 9, 2011 Hey guys, you can notice what i am doing down there. When Serial.Here1, ect... it then unban's then automatically. But this doesnt work, i started it, and i banned myself, and it didnt unban my lan ip. Does anyone see a problem with this script, and please let me know. I have hidden the serials and ip's just in case. function autounban() local serial = getBanSerial(source) if serial == "Serial.Here1" then removeBan("Serial.Here1", getRootElement()) removeBan("123.211.166.320 ", getRootElement()) end if serial == "Serial.Here2" then removeBan("Serial.Here2", getRootElement()) removeBan("180.216.166.250", getRootElement()) end if serial == "Serial.Here3" then removeBan("Serial.Here3", getRootElement()) removeBan("125.215.166.490", getRootElement()) end if serial == "Serial.Here4" then removeBan("Serial.Here5", getRootElement()) removeBan("7.21.203.46", getRootElement()) end end addEventHandler("onPlayerBan",getRootElement(),autounban) Link to comment
Castillo Posted October 9, 2011 Share Posted October 9, 2011 Because, you are trying to get the ban serial of the player, not the ban pointer. function autounban(banPointer) local serial = getBanSerial(banPointer) for index, ban in pairs(getBans()) do if getBanSerial(ban) == serial then removeBan ( ban, getRootElement() ) end end end addEventHandler("onPlayerBan",getRootElement(),autounban) You can't unban from a IP/serial If i'm right, you need to remove the ban himself. Link to comment
codeluaeveryday Posted October 9, 2011 Author Share Posted October 9, 2011 Because, you are trying to get the ban serial of the player, not the ban pointer. function autounban(banPointer) local serial = getBanSerial(banPointer) for index, ban in pairs(getBans()) do if getBanSerial(ban) == serial then removeBan ( ban, getRootElement() ) end end end addEventHandler("onPlayerBan",getRootElement(),autounban) You can't unban from a IP/serial If i'm right, you need to remove the ban himself. I dont quite understand, it doesnt work , could you explain more? Link to comment
Castillo Posted October 9, 2011 Share Posted October 9, 2011 What exactly doesn't work? do you get any error? P.S: Is this script added in acl.xml group "Admin"? Link to comment
codeluaeveryday Posted October 9, 2011 Author Share Posted October 9, 2011 What exactly doesn't work? do you get any error?P.S: Is this script added in acl.xml group "Admin"? Yeah, it says line 5 bad argument. And yes its in the ACL. Link to comment
Castillo Posted October 9, 2011 Share Posted October 9, 2011 Well, here works perfectly, are you sure you are banning by serial? I get no bad argument and in console says: "UNBAN: A ban was removed by Console" P.S: I've added to check IP too, function autounban(banPointer) local serial = getBanSerial(banPointer) local ip = getBanIP(banPointer) for index, ban in pairs(getBans()) do if getBanSerial(ban) == serial or getBanIP(ban) == ip then removeBan ( ban, getRootElement() ) end end end addEventHandler("onPlayerBan",getRootElement(),autounban) Link to comment
codeluaeveryday Posted October 9, 2011 Author Share Posted October 9, 2011 Well, here works perfectly, are you sure you are banning by serial? I get no bad argument and in console says: "UNBAN: A ban was removed by Console"P.S: I've added to check IP too, function autounban(banPointer) local serial = getBanSerial(banPointer) local ip = getBanIP(banPointer) for index, ban in pairs(getBans()) do if getBanSerial(ban) == serial or getBanIP(ban) == ip then removeBan ( ban, getRootElement() ) end end end addEventHandler("onPlayerBan",getRootElement(),autounban) Ok, well im doing it wrong? So i cant put in my serial? because will this unban everyone? we need it so it unbans our serials, if someone abuses admin. Link to comment
Castillo Posted October 9, 2011 Share Posted October 9, 2011 Do this, make a list of serials in a table, then when someone get's banned, compare their serials. Link to comment
codeluaeveryday Posted October 9, 2011 Author Share Posted October 9, 2011 Do this, make a list of serials in a table, then when someone get's banned, compare their serials. Ok, i have never worked with tables: but here is my dumb attempt, and how do i compare? Im really sorry, but i have no idea, and if you help at least i learn that way : serial1={CE99D8528E47A68C3BEAC89638D7A344} function autounban(banPointer) local serial = getBanSerial(banPointer) for index, ban in pairs(getBans()) do if getBanSerial(ban) == serial then removeBan ( ban, getRootElement() ) end end end addEventHandler("onPlayerBan",getRootElement(),autounban) Link to comment
Castillo Posted October 9, 2011 Share Posted October 9, 2011 That's wrong, use this: local serials = { ["CE99D8528E47A68C3BEAC89638D7A344"] = true, } function autounban(banPointer) local serial = getBanSerial(banPointer) local ip = getBanIP(banPointer) for index, ban in pairs(getBans()) do if serials[serial] and getBanSerial(ban) == serial or getBanIP(ban) == ip then removeBan ( ban, getRootElement() ) end end end addEventHandler("onPlayerBan",getRootElement(),autounban) Link to comment
Cadu12 Posted October 10, 2011 Share Posted October 10, 2011 https://wiki.multitheftauto.com/wiki/OnBan https://wiki.multitheftauto.com/wiki/CancelEvent Link to comment
codeluaeveryday Posted October 10, 2011 Author Share Posted October 10, 2011 That's wrong, use this: local serials = { ["CE99D8528E47A68C3BEAC89638D7A344"] = true, } function autounban(banPointer) local serial = getBanSerial(banPointer) local ip = getBanIP(banPointer) for index, ban in pairs(getBans()) do if serials[serial] and getBanSerial(ban) == serial or getBanIP(ban) == ip then removeBan ( ban, getRootElement() ) end end end addEventHandler("onPlayerBan",getRootElement(),autounban) Thank you SolidSnake, it took me awhile to figure out how to add more tables, i understand now, thank you alot 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