Witam,
Robie plugin sobie i natrafiłem na problem
Nie działa wyszukiwanie IP serwera w bazie. Jeśli wpiszę je na twardo to wyszuka ale jeśli dam aby samo pobierało to nie chce.
Kod dzialający (twarde wpisywanie IP):
public noc_load()
{
g_SqlTupleNoc = SQL_MakeDbTuple("stroba.pl", "baza", "haslo", "tabela");
SQL_ThreadQuery(g_SqlTupleNoc, "NocSQL", "SELECT ip, godziny FROM `noc` WHERE ip='99.999.999.99:27015'");
}
public NocSQL(FailState, Handle:Query, Error[], Errcode, Data[], DataSize)
{
//Check for errors and then process loading from table queries
if ( FailState )
{
if ( FailState == TQUERY_CONNECT_FAILED )
{
log_amx("Load - Could not connect to SQL database. [%d] %s", Errcode, Error);
}
else if ( FailState == TQUERY_QUERY_FAILED )
{
log_amx("Load Query failed. [%d] %s", Errcode, Error);
}
return;
}
if ( !SQL_NumResults(Query) ) // No more results - User not found, create them a blank entry in the table. and zero their variables
{
godziny = 0;
SQL_ThreadQuery(g_SqlTupleNoc, "QueryHandle", "INSERT INTO noc VALUES('99.999.999.99:27015','0')");
return;
}
godziny = SQL_ReadResult(Query, 0);
}
Nie działa (pobieranie IP serwera):
public noc_load()
{
get_user_ip(0, ipserwera, 32);
new ipserva[33];
copy(ipserva, charsmax(ipserva), ipserwera);
replace_all(ipserva, charsmax(ipserva), "'", "\'" );
g_SqlTupleNoc = SQL_MakeDbTuple("stroba.pl", "baza", "haslo", "tabela");
SQL_ThreadQuery(g_SqlTupleNoc, "NocSQL", "SELECT ip, godziny FROM `noc` WHERE ip='%s'", ipserva);
}
public NocSQL(FailState, Handle:Query, Error[], Errcode, Data[], DataSize)
{
//Check for errors and then process loading from table queries
if ( FailState )
{
if ( FailState == TQUERY_CONNECT_FAILED )
{
log_amx("Load - Could not connect to SQL database. [%d] %s", Errcode, Error);
}
else if ( FailState == TQUERY_QUERY_FAILED )
{
log_amx("Load Query failed. [%d] %s", Errcode, Error);
}
return;
}
if ( !SQL_NumResults(Query) ) // No more results - User not found, create them a blank entry in the table. and zero their variables
{
godziny = 0;
get_user_ip(0, ipserwera, 32);
new ipserva[33];
copy(ipserva, charsmax(ipserva), ipserwera);
replace_all(ipserva, charsmax(ipserva), "'", "\'" );
SQL_ThreadQuery(g_SqlTupleNoc, "QueryHandle", "INSERT INTO noc VALUES('%s','0')", ipserva);
return;
}
godziny = SQL_ReadResult(Query, 0);
}
Użytkownik Danny OK edytował ten post 26.02.2014 16:26


Dodatki SourceMod




Temat jest zamknięty











