View Single Post
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 01-28-2013 , 23:53   Re: [TF2] Official SteamRep Checker
Reply With Quote #58

Hi! I was looking through the source and I noticed a few problems.
  • new maxplayers = GetConVarInt(FindConVar("sv_visiblemaxplayers "));
    • Line 50
    • You should cache the result of FindConVar("sv_visiblemaxplayers") in a global variable, as FindConVar is very expensive
  • RegConsoleCmd("say", Command_Say);
    • Lines 82-83
    • AddCommandListener should be used instead of RegConsoleCmd to hook existing commands
    • Additionally, OnConfigsExecuted is called once per map, you are hooking say and say_team once every mapchange
  • decl String:ip[17]="";
    • Line 100
    • The point of decl is to avoid initalization. If you want to initialize the String to null, you should use new.
  • In ProcessMessage, you are suppressing the original chat message and using CPrintToChat*Ex to print a new message. For chat processing like this, Simple Chat Processor (Redux) should be used, otherwise it can cause issues with other plugins.
  • Non-callbacks don't need to be public
  • StartsWithScammer is unnecessary, just check if StrContains(str, "[SCAMMER]") == 0.
  • ServerCommand("sm_ban . . .
    • Lines 163, 168, and 169
    • ServerCommand is evil and should be avoided whenever possible. SourceBans has a native that can be used.

Also, something that concerned me is that every client's IP address is being sent to steamrep.com (unless the cvar is set to 0). To protect users' privacy, I would recommend only sending SteamRep the IP address if the client is marked as a scammer. (By the way, what exactly does SteamRep do with these IP addresses?)
__________________

Last edited by Dr. McKay; 01-28-2013 at 23:53.
Dr. McKay is offline