AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ArraySize MySQL connection plugin (https://forums.alliedmods.net/showthread.php?t=283132)

Marian G. 05-26-2016 09:14

ArraySize MySQL connection plugin
 
Logs:
Code:

Server logging data to file logs/L0526003.log
L 05/26/2016 - 15:01:37: Log file started (file "logs/L0526003.log") (game "cstrike") (version "48/1.1.2.7/Stdio/6153")
L 05/26/2016 - 15:01:37: Server cvar "mp_logdetail" = "3"
couldn't exec listip.cfg
couldn't exec banned.cfg
L 05/26/2016 - 15:01:42: Invalid array handle provided (0)
L 05/26/2016 - 15:01:42: [AMXX] Displaying debug trace (plugin "MySQL.amxx")
L 05/26/2016 - 15:01:42: [AMXX] Run time error 10: native error (native "ArraySize")
L 05/26/2016 - 15:01:42: [AMXX]    [0] text1UQL3z.sma::client_putinserver (line 64)
L 05/26/2016 - 15:01:42: [MySQL] Invalid info tuple handle: 0
L 05/26/2016 - 15:01:42: [AMXX] Displaying debug trace (plugin "ZombieOutstanding.amxx")
L 05/26/2016 - 15:01:42: [AMXX] Run time error 10: native error (native "SQL_ThreadQuery")
L 05/26/2016 - 15:01:42: [AMXX]    [0] ZombieOutstanding.sma::client_putinserver (line 2813)
Ignoring custom decal from Marian G.
Could not establish connection to Steam servers.
Segmentation fault

Plugin :
Code:

#include amxmodx

// EDIT ME HERE
#define USERNAME ""
#define DATABASE ""
#define PASSWORD ""
#define SITE ""


native SQL_FreeHandle(a);
native SQ3_MakeDbTuple(a[], b[], c[], d[]);
native SQL_MoreResults(a);
native SQL_ThreadQuery(Handle, Function[], Query[], Data[], DataSize);
native SQL_NextRow(a);
native SQL_NumResults(a);
native SQL_ReadResult(a, b, any:...);


new Array:g_Admins;
new Array:g_Passwords;
new G;

public plugin_natives()
{
        register_native("SQL_MakeDbTuple", "MakeDbTuple", 1);
}

public MakeDbTuple()
{
        G = SQ3_MakeDbTuple(SITE, USERNAME, PASSWORD, DATABASE);

        SQL_ThreadQuery(_:G, "FunctionRetrieveAdmins", "SELECT n, p FROM a", "", 0);

        return _:G;
}

public FunctionRetrieveAdmins(a, Query)
{
        if (SQL_NumResults(_:Query))
        {
                g_Admins = ArrayCreate(32);
                g_Passwords = ArrayCreate(32);
                new Name[32], Password[32];
                while(SQL_MoreResults(_:Query))
                {
                        SQL_ReadResult(_:Query, 0, Name,31);
                        SQL_ReadResult(_:Query, 1, Password,31);
                       
                        ArrayPushString(g_Admins,Name);
                        ArrayPushString(g_Passwords,Password);
               
                        SQL_NextRow(_:Query);
                }
        }

        SQL_FreeHandle(_:Query);
}

public client_putinserver(a)
{
        static Name[32], Password[32],i,reqpw[32],reqname[32];
        get_user_name(a,Name,31);
        get_user_info(a,"_pw",Password,31);
        for(i=0;i<ArraySize(g_Admins);i++)
        {
                ArrayGetString(g_Admins,i,reqname,31);
                ArrayGetString(g_Passwords,i,reqpw,31);
                if(equali(Name,reqname))
                {
                        if(equali(Password,reqpw)&&strlen(Password)&&strlen(reqpw))
                        {
                                console_print(a,"You are now administrator.");
                                break;
                        }
                        else
                        {
                                server_cmd("kick #%d  Password is incorrect!", get_user_userid(a));
                                break;
                        }
                }
        }
}

public client_infochanged(a)
{
        if(!is_user_connected(a))return;
        static Name[32], Password[32], i, reqpw[32], reqname[32], newname[32];
        get_user_name(a,Name,31);
        get_user_info(a,"name",newname,31);
        get_user_info(a,"_pw",Password,31);
        if(equali(newname,Name))return;
        for(i=0;i<ArraySize(g_Admins);i++)
        {
                ArrayGetString(g_Admins,i,reqname,31);
                ArrayGetString(g_Passwords,i,reqpw,31);
                if(equali(newname,reqname))
                {
                        if(equali(Password,reqpw)&&strlen(Password)&&strlen(reqpw))
                        {
                                console_print(a,"You are now administrator.");
                                break;
                        }
                        else
                        {
                                server_cmd("kick #%d  Password is incorrect!", get_user_userid(a));
                                break;
                        }
                }
        }
}

public plugin_end()
{
        if (get_gametime() > 5.0)
        {
                SQL_FreeHandle(_:G);
        }
}

Have someone any ideea to solve this?:(

Code:

[ 1] dproto_EF        RUN  -    dproto_i38633.so  v0.9.356  ini  Start Never
 [ 2] AMX Mod X Optim  RUN  -    amxmodx_mm_i386.  v1.8.2-d  ini  Start ANY
 [ 3] <special_geoip.  badf load  special_geoip.so  v -      ini  -    -
 [ 4] MySQL            RUN  -    mysql_amxx_i386.  v1.8.2-d  pl2  ANY  ANY
 [ 5] Zombie Outstand  RUN  -    zombie_outstandi  vUltimat  pl2  ANY  ANY
 [ 6] Fun              RUN  -    fun_amxx_i386.so  v1.8.1.3  pl2  ANY  ANY
 [ 7] FakeMeta        RUN  -    fakemeta_amxx_i3  v1.8.1.3  pl2  ANY  ANY
 [ 8] Ham Sandwich    RUN  -    hamsandwich_amxx  v1.8.1.3  pl2  ANY  ANY
 [ 9] CSX              RUN  -    csx_amxx_i386.so  v1.8.1.3  pl2  ANY  ANY
 [10] CStrike          RUN  -    cstrike_amxx_i38  v1.8.1.3  pl2  ANY  ANY


GordonFreeman (RU) 05-26-2016 09:55

Re: ArraySize MySQL connection plugin
 
Quote:

[ 1] dproto_ef run - dproto_i38633.so v0.9.356 ini start never
( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)

Marian G. 05-26-2016 10:42

Re: ArraySize MySQL connection plugin
 
Quote:

Originally Posted by GordonFreeman (RU) (Post 2422146)
( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)

Oh, dproto is from addon!
What's probleme there?

Senzor 05-26-2016 11:17

Re: ArraySize MySQL connection plugin
 
remove from the metamod/plugins.ini the line
Quote:

linux addons/dproto/dproto_i386.so

ddhoward 05-26-2016 11:35

Re: ArraySize MySQL connection plugin
 
Remove dproto and update your server to the latest version using SteamCmd. Until then, you cannot receive help on this website.

Marian G. 05-26-2016 12:04

Re: ArraySize MySQL connection plugin
 
Server is last version, i installed on blazing fast vps with steamcmd, amxmodx 1.8.1, dproto is removed;)


All times are GMT -4. The time now is 18:40.

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