0 Members and 1 Guest are viewing this topic.
stmt := SociCreateStatement(database);sql := 'SELECT kills, deaths FROM stats WHERE name = :name';SociUseString(stmt, 'name');name := IDToName(ID);SociSetUseString(stmt, 'name', name);SociIntoInt(stmt);SociIntoInt(stmt);SociPrepare(stmt, sql);if SociExecute(stmt, 1) <> SOCI_OK then begin WriteConsole(0, name + ' has no kills or deaths yet.', console_message_color); SociDestroyStatement(stmt); exit;end;kills := SociGetIntoInt(stmt, 0);deaths := SociGetIntoInt(stmt, 1);SociDestroyStatement(stmt);if deaths = 0 then begin WriteConsole(0, name + ' has ' + IntToStr(kills) + ' kills and did not die - yet.', console_message_color); exit;end;ratio := Double(kills) / Double(deaths);WriteConsole(0, name + '''s K/D ratio is ' + Round2(ratio) + ' (' + IntToStr(kills) + '/' + IntToStr(deaths) + ')', console_message_color);
cd /tmp && wget https://dl.dropbox.com/u/8261396/dev/soldat/soldatsoci-linux32.tar.gz && cd /opt && sudo tar xf /tmp/soldatsoci-linux32.tar.gz
LD_LIBRARY_PATH=/opt/soldatsoci SOCI_BACKENDS_PATH=/opt/soldatsoci ./soldatserver -safe 0
( cd /tmp && rm -rf soldatsoci-build && if [ $(uname -m) = 'x86_64' ]; then sudo apt-get -y install git unzip cmake build-essential patch gcc-multilib g++-multilib ia32-libs && cd /tmp && mkdir -p soldatsoci-build && cd soldatsoci-build && echo -e "set(CMAKE_SYSTEM_NAME Linux)\nset(CMAKE_C_COMPILER gcc -m32)\nset(CMAKE_CXX_COMPILER g++ -m32)" > toolchain-linux32.cmake && TOOLCHAIN_CMAKE_OPTIONS=-DCMAKE_TOOLCHAIN_FILE=$PWD/toolchain-linux32.cmake && TOOLCHAIN_GCC_OPTIONS=-m32; else sudo apt-get -y install git unzip cmake build-essential patch; fi && cd /tmp && mkdir -p soldatsoci-build/downloads && mkdir -p soldatsoci-build/sqlite3-src && cd soldatsoci-build/downloads && wget http://sqlite.org/sqlite-amalgamation-3071401.zip && unzip -j sqlite-amalgamation-3071401.zip -d ../sqlite3-src && cd ../sqlite3-src && gcc $TOOLCHAIN_GCC_OPTIONS -O2 -c -fpic sqlite3.c && gcc $TOOLCHAIN_GCC_OPTIONS -shared -o libsqlite3.so sqlite3.o && rm sqlite3.o && mkdir -p ../sqlite3 && mkdir -p ../sqlite3/include && mkdir -p ../sqlite3/lib && mv libsqlite3.so ../sqlite3/lib/ && cp *.h ../sqlite3/include/ && cd /tmp && cd soldatsoci-build && wget -O downloads/mysql-connector-c-6.0.2.tar.gz https://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-6.0.2.tar.gz/from/http://cdn.mysql.com/ && mkdir -p mysql-connector-src && cd mysql-connector-src && tar --strip-components=1 -xvf ../downloads/mysql-connector-c-6.0.2.tar.gz && wget https://dl.dropbox.com/u/8261396/dev/mysql-connector-c-6.0.2-cmake.patch && patch -p1 < mysql-connector-c-6.0.2-cmake.patch && cd .. && mkdir -p mysql-connector-build && cd mysql-connector-build && cmake $TOOLCHAIN_CMAKE_OPTIONS -DCMAKE_INSTALL_PREFIX=$PWD/../mysql-connector -DHAVE_RINT=ON ../mysql-connector-src/ && cp include/* ../mysql-connector-src/include/ && make && make install && cd /tmp && cd soldatsoci-build && git clone git://git.code.sf.net/p/soci/code-0 soci-src && mkdir -p soci-build && cd soci-build && cmake $TOOLCHAIN_CMAKE_OPTIONS -DCMAKE_INSTALL_PREFIX=$PWD/../soci -DMYSQL_INCLUDE_DIR=$PWD/../mysql-connector/include -DMYSQL_LIBRARIES=$PWD/../mysql-connector/lib/libmysql.so -DSQLITE3_INCLUDE_DIR=$PWD/../sqlite3/include -DSQLITE3_LIBRARY=$PWD/../sqlite3/lib/libsqlite3.so -DSOCI_EMPTY=OFF -DWITH_BOOST=OFF -DSOCI_TESTS=OFF ../soci-src/src/ && make && make install && cd /tmp && cd soldatsoci-build && mkdir soldatsoci && cp -a sqlite3/lib/* soldatsoci && cp -a mysql-connector/lib/libmysql.* soldatsoci && cp -a soci/lib/libsoci_*.so* soldatsoci && chmod +x soldatsoci/* && sudo rm -rf /opt/soldatsoci && sudo cp -a soldatsoci /opt && echo 'Done!' )
ubuntu@ubuntu:~$ ls /opt/soldatsocilibmysql.so libsoci_core.so libsoci_mysql.so libsoci_sqlite3.so libsqlite3.solibmysql.so.16 libsoci_core.so.3.1 libsoci_mysql.so.3.1 libsoci_sqlite3.so.3.1libmysql.so.16.0.0 libsoci_core.so.3.1.0 libsoci_mysql.so.3.1.0 libsoci_sqlite3.so.3.1.0
rm -rf /tmp/soldatsoci-build
Good job! Looking forward to new scripts
This is a script to access databases via Soldat's script core, not an anti-cheat. Don't ask.
Quote from: Mr on December 01, 2012, 10:44:24 amThis is a script to access databases via Soldat's script core, not an anti-cheat. Don't ask.
root@vps47446:~/soldatsoci-build/soci-build# make[ 23%] Built target soci_core[ 47%] Built target soci_core-static[ 60%] Built target soci_sqlite3[ 73%] Built target soci_sqlite3-static[ 75%] Building CXX object backends/mysql/CMakeFiles/soci_mysql.dir/vector-use-type.cpp.oIn file included from /root/soldatsoci-build/soci-src/src/backends/mysql/vector-use-type.cpp:10:/root/soldatsoci-build/soci-src/src/backends/mysql/soci-mysql.h:31:35: error: mysql.h: No such file or directoryIn file included from /root/soldatsoci-build/soci-src/src/backends/mysql/vector-use-type.cpp:10:/root/soldatsoci-build/soci-src/src/backends/mysql/soci-mysql.h:170: error: ISO C++ forbids declaration of 'MYSQL_RES' with no type/root/soldatsoci-build/soci-src/src/backends/mysql/soci-mysql.h:170: error: expected ';' before '*' token/root/soldatsoci-build/soci-src/src/backends/mysql/soci-mysql.h:188: error: 'MYSQL_ROW_OFFSET' was not declared in this scope/root/soldatsoci-build/soci-src/src/backends/mysql/soci-mysql.h:188: error: template argument 1 is invalid/root/soldatsoci-build/soci-src/src/backends/mysql/soci-mysql.h:188: error: template argument 2 is invalid/root/soldatsoci-build/soci-src/src/backends/mysql/soci-mysql.h:247: error: ISO C++ forbids declaration of 'MYSQL' with no type/root/soldatsoci-build/soci-src/src/backends/mysql/soci-mysql.h:247: error: expected ';' before '*' tokenIn file included from /root/soldatsoci-build/soci-src/src/backends/mysql/vector-use-type.cpp:11:/root/soldatsoci-build/soci-src/src/backends/mysql/common.h:42: error: 'MYSQL' was not declared in this scope/root/soldatsoci-build/soci-src/src/backends/mysql/common.h:42: error: 'conn' was not declared in this scope/root/soldatsoci-build/soci-src/src/backends/mysql/common.h:42: error: expected primary-expression before 'const'/root/soldatsoci-build/soci-src/src/backends/mysql/common.h:42: error: expected primary-expression before 'int'/root/soldatsoci-build/soci-src/src/backends/mysql/common.h:42: error: initializer expression list treated as compound expression/root/soldatsoci-build/soci-src/src/backends/mysql/vector-use-type.cpp: In member function 'virtual void soci::mysql_vector_use_type_backend::pre_use(const soci::indicator*)':/root/soldatsoci-build/soci-src/src/backends/mysql/vector-use-type.cpp:74: error: 'struct soci::mysql_session_backend' has no member named 'conn_'/root/soldatsoci-build/soci-src/src/backends/mysql/vector-use-type.cpp:74: error: 'soci::details::mysql::quote' cannot be used as a function/root/soldatsoci-build/soci-src/src/backends/mysql/vector-use-type.cpp:83: error: 'struct soci::mysql_session_backend' has no member named 'conn_'/root/soldatsoci-build/soci-src/src/backends/mysql/vector-use-type.cpp:84: error: 'soci::details::mysql::quote' cannot be used as a functionmake[2]: *** [backends/mysql/CMakeFiles/soci_mysql.dir/vector-use-type.cpp.o] Error 1make[1]: *** [backends/mysql/CMakeFiles/soci_mysql.dir/all] Error 2make: *** [all] Error 2
-- Configuring SOCI:-- SOCI_VERSION = 3.1.0 -- SOCI_ABI_VERSION = 3.1 -- SOCI_PLATFORM_NAME = x86 -- SOCI_COMPILER_NAME = gcc-4.4.5 -- SOCI_TESTS = OFF -- Looking for SOCI dependencies:[0m -- Boost:disabled, since WITH_BOOST=OFF-- MySQL:-- Found MySQL: /root/soldatsoci-build/mysql-connector/include, /root/soldatsoci-build/mysql-connector/lib/libmysql.so-- MySQL Embedded not found.-- MYSQL_INCLUDE_DIR = /root/soldatsoci-build/mysql-connector/include -- MYSQL_LIBRARIES = /root/soldatsoci-build/mysql-connector/lib/libmysql.so -- ODBC:-- WARNING:-- ODBC not found, some libraries or features will be disabled.-- See the documentation for ODBC or manually set these variables:-- ODBC_INCLUDE_DIRECTORIES = ODBC_INCLUDE_DIRECTORIES-NOTFOUND -- ODBC_LIBRARIES = ODBC_LIBRARY-NOTFOUND -- Oracle:-- WARNING:-- Oracle not found, some libraries or features will be disabled.-- See the documentation for Oracle or manually set these variables:-- ORACLE_INCLUDE_DIR = -- ORACLE_LIBRARIES = -- PostgreSQL:-- WARNING: -- PostgreSQL not found, some libraries or features will be disabled.-- See the documentation for PostgreSQL or manually set these variables:-- POSTGRESQL_INCLUDE_DIR = POSTGRESQL_INCLUDE_DIR-NOTFOUND -- POSTGRESQL_LIBRARIES = POSTGRESQL_LIBRARIES-NOTFOUND -- POSTGRESQL_VERSION = unknown -- SQLite3:-- SQLITE3_INCLUDE_DIR = /root/soldatsoci-build/sqlite3/include -- SQLITE3_LIBRARIES = /root/soldatsoci-build/sqlite3/lib/libsqlite3.so -- Configuring SOCI core library:-- SOCI_CORE_TARGET = soci_core -- SOCI_CORE_TARGET_OUTPUT_NAME = soci_core -- SOCI_CORE_DEPENDENCIES = -lpthread /usr/lib/libdl.so -- WITH_BOOST = OFF -- COMPILE_DEFINITIONS = SOCI_ABI_VERSION="3.1" HAVE_DL=1 SOCI_LIB_PREFIX="libsoci_" SOCI_LIB_SUFFIX=".so" -- Configuring SOCI database backends:-- Found MySQL: /root/soldatsoci-build/mysql-connector/include, /root/soldatsoci-build/mysql-connector/lib/libmysql.so-- MySQL Embedded not found.-- SQLite3 - SOCI backend for SQLite 3 database engine-- SOCI_SQLITE3 = ON -- SOCI_SQLITE3_TARGET = soci_sqlite3 -- SOCI_SQLITE3_TARGET_OUTPUT_NAME = soci_sqlite3 -- SOCI_SQLITE3_HEADERS = soci-sqlite3.h common.h -- COMPILE_DEFINITIONS = SOCI_ABI_VERSION="3.1" HAVE_SQLITE3=1 -- Empty - SOCI backend skeleton for development of new backends-- Empty backend disabled, since-- SOCI_EMPTY = OFF -- MySQL - SOCI backend for MySQL database engine -- SOCI_MYSQL = ON -- SOCI_MYSQL_TARGET = soci_mysql -- SOCI_MYSQL_TARGET_OUTPUT_NAME = soci_mysql -- SOCI_MYSQL_HEADERS = soci-mysql.h common.h -- COMPILE_DEFINITIONS = SOCI_ABI_VERSION="3.1" HAVE_MYSQL=1 -- -- Configuring done-- Generating done-- Build files have been written to: /root/soldatsoci-build/soci-build
cmake $TOOLCHAIN_CMAKE_OPTIONS -DCMAKE_INSTALL_PREFIX=$PWD/../soci -DSQLITE3_INCLUDE_DIR=$PWD/../sqlite3/include -DSQLITE3_LIBRARY=$PWD/../sqlite3/lib/libsqlite3.so -DSOCI_EMPTY=OFF -DWITH_BOOST=OFF -DSOCI_TESTS=OFF ../soci-src/src/
root@xxx:/opt/soldatsoci# lslibmysql.so libmysql.so.16.0.0 libsoci_mysql.a libsqlite3.solibmysql.so.16 libsoci_core.a libsoci_sqlite3.a
Either way, restarting the Soldat server using the command line from the first post should fix it.
Yeah, the funny thing is, it doesn't help. I can't start the server, each time I try it gives me... Unable to find variable
root@xxx:/opt/soldatsoci# ls -la /opt/soldatsocitotal 4540drwxr-xr-x 2 root root 4096 Dec 12 17:25 .drwxr-xr-x 3 root root 4096 Dec 12 16:56 ..lrwxrwxrwx 1 root root 14 Dec 12 16:51 libmysql.so -> libmysql.so.16lrwxrwxrwx 1 root root 18 Dec 12 16:51 libmysql.so.16 -> libmysql.so.16.0.0-rwxr-xr-x 1 root root 2405301 Dec 12 11:20 libmysql.so.16.0.0lrwxrwxrwx 1 root root 19 Dec 12 09:15 libsoci_core.so -> libsoci_core.so.3.1lrwxrwxrwx 1 root root 21 Dec 12 09:15 libsoci_core.so.3.1 -> libsoci_core.so.3.1.0-rw-r--r-- 1 root root 1111399 Dec 12 16:53 libsoci_core.so.3.1.0lrwxrwxrwx 1 root root 20 Dec 12 16:53 libsoci_mysql.so -> libsoci_mysql.so.3.1lrwxrwxrwx 1 root root 22 Dec 12 16:53 libsoci_mysql.so.3.1 -> libsoci_mysql.so.3.1.0-rw-r--r-- 1 root root 286691 Dec 12 16:53 libsoci_mysql.so.3.1.0lrwxrwxrwx 1 root root 22 Dec 12 09:15 libsoci_sqlite3.so -> libsoci_sqlite3.so.3.1lrwxrwxrwx 1 root root 24 Dec 12 09:15 libsoci_sqlite3.so.3.1 -> libsoci_sqlite3.so.3.1.0-rw-r--r-- 1 root root 259723 Dec 12 16:53 libsoci_sqlite3.so.3.1.0-rwxr-xr-x 1 root root 569089 Dec 12 11:16 libsqlite3.so