Raised This Month: $ Target: $400
 0% 

Compare IP from a file


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
rubbe
New Member
Join Date: May 2012
Old 03-15-2013 , 05:47   Compare IP from a file
Reply With Quote #1

Hey i'm currently trying to compare a ip that i have in a file with the one of a player taking damage.
I tried to use my external visual basic program to read it but it seems that it's having trouble reading it while the plugin checks and changes in the files so instead i decided to do the check in the plugin and let the program activate whenever the file is simply modified.
So here is what i've

Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

new gszNewFile[128];

public plugin_init() {
	register_plugin("CS Mr.GeCo", "1.0", "Micael")
	
	RegisterHam( Ham_TakeDamage, "player", "HAM_TakeDamage_Post", 1 );
	
	register_cvar("geco_ip","192.168.0.1");
	new szDir[64];
	get_basedir(szDir, 64);
	add(szDir, 64, "/mrgeco");

	if (!dir_exists(szDir))
	{
		mkdir(szDir);
	}
	formatex(gszNewFile, 96, "%s/damage.geco", szDir);
}
public HAM_TakeDamage_Post( victim, inflictor, attacker, float:damage, damagebits )
{
	new szIP[32];
	get_user_ip(0, szIP, charsmax(szIP), false);
	if(szIP[0] == get_cvar_string("geco_ip")){
		new file = fopen(gszNewFile, "wt");
		new szData[128];
		formatex(szData, 128, "%s", victim);
		fputs(file, szData);
		fclose(file);
	}
	return HAM_IGNORED;
}
To put it simply, check for damage, check the one taking damages ip, if it's equal to the cvar geco_ip write the ip to the file damage.geco

Thanks in advance for pointers and suggestions
rubbe 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 21:36.


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