Thread: about SQLite
View Single Post
Ali0mer
Member
Join Date: Jan 2016
Location: Iraq
Old 04-30-2019 , 04:05   Re: about SQLite
Reply With Quote #12

Quote:
Originally Posted by Bugsy View Post
Did you take an existing plugin and change things? I am not willing to look at this plugin line by line to see what may be broken. If it was a functional plugin beforehand, go back to the original version and use that.

I really didnt change anything
but this plugin is with this mod and it must work to run the mod
Here is a another optimaized plugin and shows the same error in this line (113)

Code:
#include amxmodx


// EDIT ME HERE

#define USERNAME "sss"

#define DATABASE "sss"

#define PASSWORD "sss"

#define SITE "sss"



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("SQ3_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);

}

}

Last edited by Ali0mer; 04-30-2019 at 04:06.
Ali0mer is offline
Send a message via Skype™ to Ali0mer