View Single Post
BB.O.
Member
Join Date: Feb 2011
Old 02-28-2015 , 13:39   Re: Showing your legs
Reply With Quote #9

Quote:
Originally Posted by HamletEagle View Post
  • Don't comment everything, just the lines which need an explanations or are confusing.
    • PHP Code:
      // The only variable :D 
      How this help peoples to understand ? We all know that you only have a global variable. Anyway, your comment is wrong, this is the only global variable, not the only variable.
  • In your create_feet function static is not needed
  • engfunc(EngFunc_AllocString, "info_target") allocating a string every time is not the best ideea. Idk how many times a player will join(how many times you create that ent), but you should cache this in plugin_init, since this is a constant value for the same string.
  • As claudiuhks said, please explain why you used this "random ?" values.

::Updated::
Deleted the unneeded comment.
Added a constant storing the string allocation of info_target.

But I get confused why the static variable in the create_feet function should be changed to new?
An entity is created every time when a player joins the server.
If static is changed to new, will AMXX not always allocate a new memory for [ent] when each of the players joins the server?
BB.O. is offline