AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   FileExist or in Mysql number exist (https://forums.alliedmods.net/showthread.php?t=26146)

BloodyNuker 03-27-2006 16:14

FileExist or in Mysql number exist
 
I donīt know how i can do to show if a file exist in the pc of the player (in folder cstrike), please help!

If i canīt do this...

i can read a table mysql and show if a number (for example: 777) exist?

Tnkz! :D

Xanimos 03-27-2006 17:33

You cant read if a file exists on a client. I don't understand what you want with MySQL you can see if a value exists for example
SELECT * FROM `myTable` WHERE `myColumn` = '777'

Twilight Suzuka 03-27-2006 17:45

You CAN tell if a file exists on a client or not:

Use the native to force a client to have a file.
Catch the forward for when players have inconsistant files, and HANDLE it.

Then, you know if a client has a file, depending on whether or not they get inconstant run on them or not ^^

BloodyNuker 03-27-2006 21:55

I create a anti cheat(Client program equaly Cheatin death) and i need the plugin show if the client executed

__________________________

The a player run the client, this insert in a database mysql the ip of the player.

When enter in the server....
The plugin show if in mysql exist the ip...

If the ip exist, because the player execute the client
If the ip donīt exist, because the player donīt execute the client

I need how i can do the plugin show if the IP of the player registered in the mysql


Tnkz!!!!!! :P

BloodyNuker 03-28-2006 10:02

I create this.. but i donīt know if correct, can you tell me if this need another comand or if I have got errors? (Sorry my bad english :P )

Code:

// MYSQL Show the number of the IP exist in a database XX
#include <amxmodx>
#include <amxmisc>
#include <dbi>

new Plugin_Author[] = "Jajaja";
new Plugin_Version[] = "0.1";
new Plugin_Name[] = "ShowIPindatabase"
new Sql:dbc
new Result:result

#define client_models_password "gordon"

public plugin_init()
{

register_plugin(Plugin_Name,Plugin_Version,Plugin_Author);

register_concmd("amx_aca","client_info",ADMIN_ALL,"ACA Server-Side Plugin");

}

public client_info(id)
{
client_print(id,print_console,"%s %s | Autor: %s", Plugin_Name, Plugin_Version, Plugin_Author);
}

public client_putinserver(id)
{
set_task(10.0, "client_connect", id, "b")
set_task(15.0, "client_verification1", id, "b")

}

public client_connect()  {
new host[64], username[32], password[32], dbname[32], error[32]
get_cvar_string("amx_sql_host",host,64)
get_cvar_string("amx_sql_user",username,32)
get_cvar_string("amx_sql_pass",password,32)
get_cvar_string("amx_sql_db",dbname,32)

dbc = dbi_connect(host,username,password,dbname,error,32)

if (dbc == SQL_FAILED)
{
log_amx("SQL Connection Failed")
dbi_close(dbc)
return
}

}



public client_verification1(id)
{
new authid[32]
get_user_ip(id, player_ip, 50, 1)
result = dbi_query(dbc,"SELECT * FROM `myTable` WHERE `myColumn` = 'player_ip', player_ip")
if(equal(player_ip,"result"))
{
client_print(id,print_chat,"The IP are registered in DATA BASE")
}
else {
client_print(id,print_chat,"The IP are not registered in DATA BASE")
}
dbi_free_result(result)

return PLUGIN_CONTINUE
}


Xanimos 03-28-2006 12:07

use this
Code:
dbi_query(dbc,"SELECT * FROM `myTable` WHERE `myColumn` = '%s'", player_ip) if(result >= RESULT_OK) { client_print(id,print_chat,"The IP are registered in DATA BASE") } else { client_print(id,print_chat,"The IP are not registered in DATA BASE") }

And you should only connect to the database once. Not everytime someone connects.

Also "client_connect" is already a function you shouldn't use what you are doing.

BloodyNuker 03-28-2006 12:30

I have this when i compile :(

/home/users/amxmodx/tmp3/textAS0JHb.sma(34) : error 017: undefined symbol "player_ip"
/home/users/amxmodx/tmp3/textAS0JHb.sma(34 -- 35) : error 088: number of arguments does not match definition
/home/users/amxmodx/tmp3/textAS0JHb.sma(35) : error 017: undefined symbol "result"
/home/users/amxmodx/tmp3/textAS0JHb.sma(35) : fatal error 107: too many error messages on one line


Code:

#include <amxmodx>
#include <dbi>


new Sql:dbc

// Start of plugin
public plugin_init() {
register_plugin("IP player registered?","1.0","ACA")
register_cvar("amx_aca_host","host")
register_cvar("amx_aca_user","username")
register_cvar("amx_aca_pass","password")
register_cvar("amx_aca_db","dbname")
set_task(1.0,"start_sql")
}


//Create a connection
public start_sql()
{
new host[32], username[32], password[32], dbname[32], error[32]
get_cvar_string("amx_aca_host",host,32)
get_cvar_string("amx_aca_user",username,32)
get_cvar_string("amx_aca_pass",password,32)
get_cvar_string("amx_aca_db",dbname,32)
dbc = dbi_connect(host,username,password,dbname,error,32)
if (dbc == SQL_FAILED)
{
server_print("[ACA] Disconnected")
}
else
{
server_print("[ACA] Connected")
dbi_query(dbc,"SELECT * FROM `myTable` WHERE `myColumn` = '%s'", player_ip)
if(result >= RESULT_OK)
{
client_print(id,print_chat,"The IP are registered in DATA BASE")
}
else {
client_print(id,print_chat,"The IP are not registered in DATA BASE")
}

}


Xanimos 03-28-2006 12:34

Stop making a new connection on client connect! it is a waste of connections (especially since you aren't closing them).

you forgot new Result:result at the top and you forgot new player_ip[36] and you forgot get_user_ip()

Also your indentation sucks.

BloodyNuker 03-28-2006 16:20

I donīt know what can you say whit wasted conections.. :(
mmm i put the plugin and compile perfect...
but when put in the server...

Code:

unknown            unknown  unknown          juaz.amxx        bad load
this is the plugin....
Code:
#include <amxmodx> #include <dbi> new Sql:dbc // Start of plugin public plugin_init() { register_plugin("IP player registered?","1.0","ACA") register_cvar("amx_aca_host","host") register_cvar("amx_aca_user","username") register_cvar("amx_aca_pass","password") register_cvar("amx_aca_db","dbname") set_task(1.0,"start_sql") } //Create a connection public start_sql(id) { new host[32], username[32], password[32], dbname[32], error[32] get_cvar_string("amx_aca_host",host,32) get_cvar_string("amx_aca_user",username,32) get_cvar_string("amx_aca_pass",password,32) get_cvar_string("amx_aca_db",dbname,32) dbc = dbi_connect(host,username,password,dbname,error,32) if (dbc == SQL_FAILED) { server_print("[ACA] Disconnected") } else { server_print("[ACA] Connected") new Result:result new player_ip[36] get_user_ip(id, player_ip, 35) dbi_query(dbc,"SELECT * FROM aca_anticheat WHERE player_ip = '%s'", player_ip) if(result >= RESULT_OK) { client_print(id,print_chat,"The IP are registered in DATA BASE") } else { client_print(id,print_chat,"The IP are not registered in DATA BASE") } } }

Tnkz! :P

:D

BloodyNuker 03-28-2006 17:40

Sorry! Tnkz! for all y go to create the mysql to test if connect correctly, the plugin are runing !

Code:

IP player registe  1.0      ACA              juaz.amxx        running
:D

What, How, when and where must I put to close coneection? :lol:
Quote:

(especially since you aren't closing them).
Tnkz! :P wiii!!


All times are GMT -4. The time now is 16:42.

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