Raised This Month: $ Target: $400
 0% 

[HELP] Ini Check Player Exists


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-19-2017 , 19:12   Re: [HELP] Ini Check Player Exists
Reply With Quote #6

There are many thing wrong with this code:
  1. The file path for your file will never change while the server is running. Because of this, the file path should only be obtained once in plugin_init() and then stored globally.
  2. ReporterName is a string and should never be index with id (or anything else unless you are trying to reference single characters.
  3. To check if the player is or isn't the player executing the command you should use the entity index. In your case, you would check "id == Player" or "id != Player" where Player is the result of cmd_target().
  4. You should avoid getting any names, or doing anything really, until after you know that you are absolutely going to use them. That means that you should do the "self" check and the immunity check first. The only code that should exist before these is the code that these checks require. Nothing more. Basically, do the simplest checks first.
  5. You should always use SteamID when you want to unique identify a player because they can change their name to their hearts content and flood this plugin.
  6. To be able to do what you originally asked, you need to store the information in a way that it can be easily processed. Storing it as a sentence will not work reliable or efficiently. So, you should store the data in a structured format. For example, I would probably store it using tab delimiting (tabs because it's unlikely that a tab character will exist in the data normally).

P.S. Nothing on the internet is temporary. Also, there is no need to hide a plugin like this. The concept and code are both trivial. I've attached the original plugin so that people looking at this thread in the future will have a reference for my comments.
Attached Files
File Type: sma Get Plugin or Get Source (plugin.sma - 608 views - 2.6 KB)
__________________
fysiks is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:02.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode