From 25d4b6aea3cd290fa373d55a35784b8eb9ad3dba Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 10 May 2006 10:42:49 +0000 Subject: [PATCH] added these include files k --- plugins/include/cstrike.inc | 9 +- plugins/include/csx.inc | 13 ++- plugins/include/dbi.inc | 10 +- plugins/include/dodfun.inc | 10 +- plugins/include/dodx.inc | 9 +- plugins/include/engine.inc | 9 +- plugins/include/fakemeta.inc | 9 +- plugins/include/fun.inc | 9 +- plugins/include/geoip.inc | 9 +- plugins/include/ns.inc | 9 +- plugins/include/nvault.inc | 9 +- plugins/include/regex.inc | 9 +- plugins/include/sockets.inc | 9 +- plugins/include/sqlx.inc | 174 +++++++++++++++++++++++++++++++++++ plugins/include/tfcx.inc | 9 +- plugins/include/tsfun.inc | 9 +- plugins/include/tsx.inc | 9 +- 17 files changed, 305 insertions(+), 19 deletions(-) create mode 100644 plugins/include/sqlx.inc diff --git a/plugins/include/cstrike.inc b/plugins/include/cstrike.inc index 42bec38b..4fcba883 100755 --- a/plugins/include/cstrike.inc +++ b/plugins/include/cstrike.inc @@ -10,7 +10,14 @@ #endif #define _cstrike_included -#pragma library cstrike +#if AMXX_VERSION_NUM >= 175 + #pragma reqlib cstrike + #if !defined AMXMODX_NOAUTOLOAD + #pragma loadlib cstrike + #endif +#else + #pragma library cstrike +#endif /* Returns player deaths. */ diff --git a/plugins/include/csx.inc b/plugins/include/csx.inc index 101836b7..b3746bcd 100755 --- a/plugins/include/csx.inc +++ b/plugins/include/csx.inc @@ -11,11 +11,18 @@ #include -#pragma library csx +#if AMXX_VERSION_NUM >= 175 + #pragma reqclass xstats + #if !defined AMXMODX_NOAUTOLOAD + #pragma defclasslib xstats csx + #endif +#else + #pragma library csx +#endif /* -* Forwards -*/ + * Forwards + */ /* Function is called after player to player attacks , * if players were damaged by teammate TA is set to 1 */ diff --git a/plugins/include/dbi.inc b/plugins/include/dbi.inc index 2159f5bb..5e3bffae 100755 --- a/plugins/include/dbi.inc +++ b/plugins/include/dbi.inc @@ -17,7 +17,15 @@ #endif #define _dbi_included -#pragma library dbi +// You can't include SQLX first! +// there's really no reason to anyway. +#assert !defined _sqlx_included + +#if AMXX_VERSION_NUM >= 175 + #pragma reqclass dbi +#else + #pragma library dbi +#endif enum Sql { diff --git a/plugins/include/dodfun.inc b/plugins/include/dodfun.inc index 709a3764..03ca8760 100755 --- a/plugins/include/dodfun.inc +++ b/plugins/include/dodfun.inc @@ -11,8 +11,14 @@ #include -#pragma library dodfun - +#if AMXX_VERSION_NUM >= 175 + #pragma reqlib dodfun + #if !defined AMXMODX_NOAUTOLOAD + #pragma loadlib dodfun + #endif +#else + #pragma library dodfun +#endif /* Function is called after grenade throw */ forward grenade_throw(index,greindex,wId); diff --git a/plugins/include/dodx.inc b/plugins/include/dodx.inc index cd6e427e..8e223e30 100755 --- a/plugins/include/dodx.inc +++ b/plugins/include/dodx.inc @@ -12,7 +12,14 @@ #include #include -#pragma library dodx +#if AMXX_VERSION_NUM >= 175 + #pragma reqclass xstats + #if !defined AMXMODX_NOAUTOLOAD + #pragma defclasslib xstats dodx + #endif +#else + #pragma library dodx +#endif /************* Shared Natives Start ********************************/ diff --git a/plugins/include/engine.inc b/plugins/include/engine.inc index 7c52fa71..e584c774 100755 --- a/plugins/include/engine.inc +++ b/plugins/include/engine.inc @@ -13,7 +13,14 @@ #include -#pragma library engine +#if AMXX_VERSION_NUM >= 175 + #pragma reqlib engine + #if !defined AMXMODX_NOAUTOLOAD + #pragma loadlib engine + #endif +#else + #pragma library engine +#endif native traceresult(type,{Float,Sql,Result,_}:...); diff --git a/plugins/include/fakemeta.inc b/plugins/include/fakemeta.inc index 3760823f..a482a11c 100755 --- a/plugins/include/fakemeta.inc +++ b/plugins/include/fakemeta.inc @@ -9,7 +9,14 @@ #include -#pragma library fakemeta +#if AMXX_VERSION_NUM >= 175 + #pragma reqlib fakemeta + #if !defined AMXMODX_NOAUTOLOAD + #pragma loadlib fakemeta + #endif +#else + #pragma library fakemeta +#endif /* Returns entvar data from an entity Use the pev_* enum to specify which form of data you want returned. */ native pev(_index,_value,{Float,Sql,Result,_}:...); diff --git a/plugins/include/fun.inc b/plugins/include/fun.inc index 11d07482..7bf447dc 100755 --- a/plugins/include/fun.inc +++ b/plugins/include/fun.inc @@ -10,7 +10,14 @@ #endif #define _fun_included -#pragma library fun +#if AMXX_VERSION_NUM >= 175 + #pragma reqlib fun + #if !defined AMXMODX_NOAUTOLOAD + #pragma loadlib fun + #endif +#else + #pragma library fun +#endif /* Returns 1 if receiver hears sender via voice communication. */ native get_client_listen(receiver, sender); diff --git a/plugins/include/geoip.inc b/plugins/include/geoip.inc index 48a7a2b4..f454e32a 100755 --- a/plugins/include/geoip.inc +++ b/plugins/include/geoip.inc @@ -8,7 +8,14 @@ #endif #define _geoip_included -#pragma library geoip +#if AMXX_VERSION_NUM >= 175 + #pragma reqlib geoip + #if !defined AMXMODX_NOAUTOLOAD + #pragma loadlib geoip + #endif +#else + #pragma library geoip +#endif //IP address can contain ports, the ports will be stripped out diff --git a/plugins/include/ns.inc b/plugins/include/ns.inc index 51027dbc..319b1b30 100755 --- a/plugins/include/ns.inc +++ b/plugins/include/ns.inc @@ -9,7 +9,14 @@ #endif #define NS_INC -#pragma library ns +#if AMXX_VERSION_NUM >= 175 + #pragma reqlib ns + #if !defined AMXMODX_NOAUTOLOAD + #pragma loadlib ns + #endif +#else + #pragma library ns +#endif #include diff --git a/plugins/include/nvault.inc b/plugins/include/nvault.inc index 699e303b..fbe2f07b 100755 --- a/plugins/include/nvault.inc +++ b/plugins/include/nvault.inc @@ -10,7 +10,14 @@ #endif #define _nvault_included -#pragma library nvault +#if AMXX_VERSION_NUM >= 175 + #pragma reqlib nvault + #if !defined AMXMODX_NOAUTOLOAD + #pragma loadlib nvault + #endif +#else + #pragma library nvault +#endif //Opens a vault by name (such as "myvault") //Returns a vault id, INVALID_HANDLE otherwise (-1) diff --git a/plugins/include/regex.inc b/plugins/include/regex.inc index b5f4635e..9d9546b0 100755 --- a/plugins/include/regex.inc +++ b/plugins/include/regex.inc @@ -9,7 +9,14 @@ #endif #define _regex_included -#pragma library regex +#if AMXX_VERSION_NUM >= 175 + #pragma reqlib regex + #if !defined AMXMODX_NOAUTOLOAD + #pragma loadlib regex + #endif +#else + #pragma library regex +#endif enum Regex { diff --git a/plugins/include/sockets.inc b/plugins/include/sockets.inc index fc58662e..dc8370a4 100755 --- a/plugins/include/sockets.inc +++ b/plugins/include/sockets.inc @@ -13,7 +13,14 @@ #endif #define _socket_included -#pragma library socket +#if AMXX_VERSION_NUM >= 175 + #pragma reqlib sockets + #if !defined AMXMODX_NOAUTOLOAD + #pragma loadlib sockets + #endif +#else + #pragma library socket +#endif // Use SOCKET_TCP for TCP Socket connections diff --git a/plugins/include/sqlx.inc b/plugins/include/sqlx.inc new file mode 100644 index 00000000..c1f51711 --- /dev/null +++ b/plugins/include/sqlx.inc @@ -0,0 +1,174 @@ +/** + * SQLX - Newer version of SQL stuff + */ + +#if defined _sqlx_included + #endinput +#endif +#define _sqlx_included + +#if AMXX_VERSION_NUM >= 175 + #pragma reqclass sqlx + #if !defined AMXMODX_NOAUTOLOAD + #pragma defclasslib sqlx mysqlx + #endif //!defined AMXMODX_NOAUTOLOAD +#endif //AMXX_VERSION_NUM + +enum Handle +{ + Empty_Handle +}; + +/** + * Creates a connection tuple. + * This tuple must be passed into connection routines. + * Freeing the tuple is not necessary, but is a good idea if you + * create many of them. You can cache these handles globally. + */ +native Handle:SQL_MakeDbTuple(const host[], const user[], const pass[], const db[]); + + +/** + * Frees an SQL handle. + * The handle can be to anything (tuple, connection, query, results, etc). + * If you free a database connection, it closes the connection as well. + */ +native SQL_FreeHandle(Handle:h); + + +/** + * Opens a database connection. + * Returns an SQL handle, which must be freed. + * Returns Empty_Handle on failure. + */ +native Handle:SQL_Connect(Handle:cn_tuple, &errcode, error[], maxlength); + + +/** + * Prepares a query. + * The query must always be freed. + * This does not actually do the query! + */ +native Handle:SQL_PrepareQuery(Handle:db, const fmt[], {Float,_}:...); + + +#define TQUERY_CONNECT_FAILED -2 +#define TQUERY_QUERY_FAILED -1 +#define TQUERY_SUCCESS 0 +/** + * Prepares and executes a threaded query. + * This will not interrupt gameplay in the event of a poor/lossed + * connection, however, the interface is more complicated and + * asynchronous. Furthermore, a new connection/disconnection is + * made each time. + * The handler should look like: + * + * @param failstate - One of the three TQUERY_ defines. + * @param query - Handle to the query, do not free it. + * @param error - An error message, if any. + * @param errnum - An error code, if any. + * @param data - Data array you passed in. + * @param size - Size of the data array you passed in. + * + * public QueryHandler(failstate, Handle:query, error[], errnum, data[], size) + * + * Note! The handle does not need to be freed. + * Also note: This function is not guaranteed to be in another thread + * (in fact - it's not). You're seeing data "after the fact", + * and as such to execute another query you should run + * SQL_ThreadQuery again. + * + */ +native SQL_ThreadQuery(Handle:cn_tuple, const handler[], const query[], const data[]="", dataSize=0); + + +/** + * Executes a query. + * Returns 1 if the query succeeded. + * Returns 0 if the query failed. + * NOTE: You can call this multiple times as long as its parent + * connection is kept open. Each time the result set will be freed + * from the previous call. + */ +native SQL_Execute(Handle:query); + +/** + * Gets information about a failed query error. + * Returns the errorcode. + */ +native SQL_QueryError(Handle:query, error[], maxlength); + + +/** + * Returns 1 if there are more results to be read, + * 0 otherwise. + */ +native SQL_MoreResults(Handle:query); + + +/** + * Tells whether a specific column in the current row + * is NULL or not. + */ +native SQL_IsNull(Handle:query, column); + +/** + * Retrieves the current result. + * A successful query starts at the first result, + * so you should not call SQL_NextRow() first. + * Passing no extra params - return int + * Passing one extra param - return float in 1st extra arg + * Passing two extra params - return string in 1st arg, max length in 2nd + * Example: + * new num = SQL_ReadResult(query, 0) + * new Float:num2 + * new str[32] + * SQL_ReadResult(query, 1, num2) + * SQL_ReadResult(query, 2, str, 31) + */ +native SQL_ReadResult(Handle:query, column, ...); + + +/** + * Advances to the next result (return value should be ignored). + */ +native SQL_NextRow(Handle:query); + + +/** + * Returns the number of affected rows. + */ +native SQL_AffectedRows(Handle:query); + + +/** + * Returns the number of rows total. + */ +native SQL_NumResults(Handle:query); + + +/** + * Returns the number of columns total. + */ +native SQL_NumColumns(Handle:query); + + +/** + * Returns the name of a column. + * Errors on a bad field number. + */ +native SQL_FieldNumToName(Handle:query, num, name[], maxlength); + + +/** + * Returns the number of a named column, or -1 if not found. + */ +native SQL_FieldNameToNum(Handle:query, const name[]); + + +/** + * Sets driver affinity (NOT IMPLEMENTED). + */ +// native SQL_SetAffinity(Handle:connection, const driver[]); + + diff --git a/plugins/include/tfcx.inc b/plugins/include/tfcx.inc index 9f784eb5..15836d63 100755 --- a/plugins/include/tfcx.inc +++ b/plugins/include/tfcx.inc @@ -12,7 +12,14 @@ #include #include -#pragma library tfcx +#if AMXX_VERSION_NUM >= 175 + #pragma reqclass xstats + #if !defined AMXMODX_NOAUTOLOAD + #pragma defclasslib xstats tfcx + #endif +#else + #pragma library tfcx +#endif /************* Shared Natives Start ********************************/ diff --git a/plugins/include/tsfun.inc b/plugins/include/tsfun.inc index 4c9a4f4f..5cb9ded8 100755 --- a/plugins/include/tsfun.inc +++ b/plugins/include/tsfun.inc @@ -20,7 +20,14 @@ enum { XMF_DEATH, } -#pragma library tsfun +#if AMXX_VERSION_NUM >= 175 + #pragma reqlib tsfun + #if !defined AMXMODX_NOAUTOLOAD + #pragma loadlib tsfun + #endif +#else + #pragma library tsfun +#endif /************* Shared Natives End ********************************/ diff --git a/plugins/include/tsx.inc b/plugins/include/tsx.inc index 882d87bc..119c17c6 100755 --- a/plugins/include/tsx.inc +++ b/plugins/include/tsx.inc @@ -11,7 +11,14 @@ #include -#pragma library tsx +#if AMXX_VERSION_NUM >= 175 + #pragma reqclass xstats + #if !defined AMXMODX_NOAUTOLOAD + #pragma defclasslib xstats tsx + #endif +#else + #pragma library tsx +#endif /************* Shared Natives Start ********************************/