View Single Post
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 08-15-2012 , 13:01   Re: [CSS] Resetscore [1.2 10/August/2012]
Reply With Quote #13

Review for Approval
Status: Pending Feature Additions / Code Correction
  • Your plugin currently does not provide any features that are not already available by existing plugins: Exvel's Save Scores and tuty's Resetscore. The former provides saving scores, saving cash, multiple games, etc, while the latter is CS:S specific that provides the core functionality with no fluff.
  • You do not need to attach random images such as a cookie for a plugin thread...
  • Now as for your coding:
    • While not required, it's usually a good idea to prefix your variables with their type. For example, you already use "g_" to signify global, and "h" for handles, albeit your usage is hit/miss. You can prefix integers with i, floats with f, b for bools, and strings with s to make your code easier to read. iResets, fTimeleft, and sResets allow you to easily see what type a variable is.
    • You declare "resets" to 64 characters, when it's an integer that is with in the single digits. resets[2] or resets[3] would be more desirable (why declare 62 other characters if they're never used?)
    • Your usage of ConVarChanged is incorrect as well as inefficient - there's no reason to update all variables when ConVarChanged only changes one convar at a time.
    • PHP Code:
      public ConVarChanged(Handle:convar, const String:oldVal[], const String:newVal[])
      {
          if(
      convar == gH_Enabled)
              
      Enabled StringToInt(newVal) ? true false;
          else if(
      convar == gH_Resets)
              
      Resets StringToInt(newVal);
          else if(
      convar == gH_ResetTime)
              
      Timeleft StringToFloat(newVal);

    • There's no need to hook your version cvar.
    • You should never pass a client index within a trigger: instead use their userid or serial and get the new value within the Timer. This ensures a new client doesn't inherit a previous client's timer. Alternatively, you can create an array of Handles per client and kill the timer when the client disconnects.
__________________

Last edited by thetwistedpanda; 08-15-2012 at 13:32.
thetwistedpanda is offline