I am making a warning system, so far, so good.
The only problem is that I cant get it to run ASS_BanPlayer
Because I am using ASS_BanPlayer(ply, ply:UniqueID(), 1440, "Warnings Exceeded: 1 day")
it thinks the player is trying to ban him/herself
How can I specify console? BTW, Using CONSOLE instead of ply at the first argument didnt work either.
isnt assmod broke?
Use Player:Ban.
Don't use RunConsoleCommand, cause that will be run on the client. :>
[QUOTE=mikeym;32914855]Use Player:Ban.
Don't use RunConsoleCommand, cause that will be run on the client. :>[/QUOTE]
he doesn't want to use Source's shitty ban system
[lua]function ASS_ConsoleBanPlayer( UNIQUEID, TIME, REASON )
TIME = tonumber(TIME) or 0
if (#REASON == 0) then REASON = "Banned" end
local TO_BAN = ASS_FindPlayer(UNIQUEID)
if (!TO_BAN) then
print("Player not found!")
return
end
TO_BAN:SetUnBanTime( nil )
if (TIME > 0) then
TO_BAN:SetUnBanTime( timeAdd( TIME ) )
ASS_LogAction( "Console", ASS_ACL_BAN_KICK, "banned " .. ASS_FullNick(TO_BAN) .. " for " .. TIME .. " minutes" )
else
ASS_LogAction( "Console", ASS_ACL_BAN_KICK, "banned " .. ASS_FullNick(TO_BAN) .. " permanently" )
end
TO_BAN:SetLevel(ASS_LVL_BANNED)
ASS_SaveRankings()
if (!ASS_IsLan()) then
asscmd.ConsoleCommand("banid " .. TIME .. " " .. TO_BAN:UserID() .. "\n")
asscmd.ConsoleCommand("writeid\n")
else
asscmd.ConsoleCommand("addip " .. TIME .. " " .. TO_BAN:IPAddress() .. "\n")
asscmd.ConsoleCommand("writeip\n")
end
asscmd.ConsoleCommand("kickid " .. TO_BAN:UserID() .. " \"" .. REASON .. "\"\n")
end[/lua]
The function I just made should work, please tell me if there's an error, because I just edited it on the fly.
[QUOTE=camcole1;32914691]isnt assmod broke?[/QUOTE]
Fixed with my l33t epic haxars skills
[QUOTE=mikeym;32914855]Use Player:Ban.[/QUOTE]
Player.Ban sucks asshole, plus, I made a forum linking addon that uses warnings for players MingeDMing
And players getting warnings from bans
5 warnings = perma
Works using SMF's database, And is epic so far.
[QUOTE=Fleamonji;32915132]he doesn't want to use Source's shitty ban system[/QUOTE]
Correct, Source's ban system fails, when a player connects to see if he is banned it only says
YOU ARE BANNED, HURR, NOT DISPLAYING TIEM :D
And non-perma bans don't save correctly/get removed on server crash
[QUOTE=TheDivinity;32915221]The function I just made should work, please tell me if there's an error, because I just edited it on the fly.[/QUOTE]
Thanks for that, trying now.
Also, try and use lua tags instead of code tags
Doesn't work
[QUOTE=ServerLogs]L 10/24/2011 - 12:19:47: Lua Error: Hook 'WarningsCheck' Failed: [@addons\assmod\lua\ass_server.lua:180] bad key to string index (number expected, got string)[/QUOTE]
OH, And I wanted to use ASS_BanPlayer because BanPlayer is overwritten by easyban, so.
I looked at the latest revision of Assmod, and I don't see any hook called "WarningsCheck"
[QUOTE=TheDivinity;32921140]I looked at the latest revision of Assmod, and I don't see any hook called "WarningsCheck"[/QUOTE]
Shit sorry, I meant when my plugin calls the ASS_ConsoleBanPlayer thing, on that hook, it comes up as if assmod has that hook.
I just want something that will work with the original ASSMod, i.e:
ASS_BanPlayer
No mods..
Assmod works just fine without any edits last I checked which wasn't to long ago. It was just the one from garrysmod.org so its not like it was new or anything.
I have a modified assmod so idk if its due to a recent update.
[lua]function ASS_ConsoleBanPlayer( UNIQUEID, TIME, REASON )
local msg
TIME = tonumber(TIME) or 0
if (#REASON == 0) then REASON = "Banned" end
local TO_BAN = ASS_FindPlayer(UNIQUEID)
if (!TO_BAN) then
print("Player not found!")
return
end
TO_BAN:SetUnBanTime( nil )
if (TIME > 0) then
TO_BAN:SetUnBanTime( timeAdd( TIME ) )
msg = "Console banned " .. ASS_FullNick(TO_BAN) .. " for " .. TIME .. " minutes."
else
msg = "Console banned " .. ASS_FullNick(TO_BAN) .. " permanently!"
end
for k,v in pairs(player.GetAll()) do
if v:IsAdmin() then
v:PrintMessage(HUD_PRINTTALK, msg)
end
end
TO_BAN:SetLevel(ASS_LVL_BANNED)
ASS_SaveRankings()
if (!ASS_IsLan()) then
asscmd.ConsoleCommand("banid " .. TIME .. " " .. TO_BAN:UserID() .. "\n")
asscmd.ConsoleCommand("writeid\n")
else
asscmd.ConsoleCommand("addip " .. TIME .. " " .. TO_BAN:IPAddress() .. "\n")
asscmd.ConsoleCommand("writeip\n")
end
asscmd.ConsoleCommand("kickid " .. TO_BAN:UserID() .. " \"" .. REASON .. "\"\n")
end[/lua]
Found out what the problem was, I don't know any alternative to this, if you don't want an edited function.
Could someone just give me a way to use the default BanPlayer and use CONSOLE as the ply argument?
bumpadump.
Get an admin mod that isnt 4 years old and not in active development, theres your fix.
Sorry, you need to Log In to post a reply to this thread.