Thread: Death Note
View Single Post
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-11-2016 , 12:25   Re: Death Note
Reply With Quote #5

For approval:
  • Not every function needs to be "public". You would use it for functions that can be called from outside of your plugin, like a task, menu handler, registered command, forward. Your readCvars function should be private, so remove "public". Same reasoning applies to LoadData and SaveData
  • I would advice you to do LoadData in client_putinserver, not client_connect
  • In SaveData:
    • szVaultKey and szVaultData are not needed, work directly with szAuthId and g_szNote[id].
    • FYI generally you should use formatex, not format. The only case in which you need to use format is when you format in the same buffer from where you get values. Example:
      Code:
      format(Buffer, charsmax(Buffer), "some_%s", Buffer)
    • Moreover, when you want to copy a string into another, you would use copy native, not formatex.
    • Returning something does not make sense here.
  • Now, do the same thing for LoadData function. Use directly szAuthId and g_szNote[id] in nvault_get. Returning something does not make sense here.
  • In cmdSay, as I told you before, use copy, not formatex(
    Code:
    formatex(g_szNote[id], charsmax(g_szNote[]), "%s", szSay)
    ). Same for eventPlayerKilled
  • In clearNote: to clear a string, simply do g_szNote[id][0] = EOS. EOS is the null terminator. If the first cell of a string is EOS you can be sure that this string is empty.
  • In is_blank, instead of equal(szMessage, "") do if(szMessage[0] == EOS).
  • In ColorChat, use charsmax() as you do in the rest of the code.
  • Cache get_user_msgid("SayText"), get_user_msgid("TeamInfo") and get_maxplayers() in plugin_init. This are constant values and won't change during run time.
  • Remove stock keyword from your functions. stock is useful in include files where not all functions will be used, but everything you have in your code should be used.
__________________

Last edited by HamletEagle; 04-11-2016 at 12:50.
HamletEagle is offline