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