Page 1 of 1

Gal matot? :D

Posted: 2011 Jun 29 20:49
by psychical

Code: Select all

public adminSql(id){    new table[32], error[128], type[12], errno        new Handle:info = SQL_MakeDbTuple("dasdas","dasda","dasda","dasdas")    new Handle:sql = SQL_Connect(info, errno, error, 127)        get_cvar_string("amx_sms_table", table, 31)        SQL_GetAffinity(type, 11)        if (sql == Empty_Handle)    {        server_print("[AMXX] %L", LANG_SERVER, "SQL_CANT_CON", error)                //backup to users.ini        new configsDir[64]                get_configsdir(configsDir, 63)        format(configsDir, 63, "%s/users.ini", configsDir)        loadSettings(configsDir) // Load admins accounts         return PLUGIN_HANDLED    }     new Handle:query    query = SQL_PrepareQuery(sql,"SELECT `fullnick`,`password`,`privileges`,`flags` FROM `%s` WHERE `activated`='1' and `nickbanned`='0'", table)        if (!SQL_Execute(query))    {        SQL_QueryError(query, error, 127)        server_print("[AMXX] %L", LANG_SERVER, "SQL_CANT_LOAD_ADMINS", error)    } else if (!SQL_NumResults(query)) {        server_print("[AMXX] %L", LANG_SERVER, "NO_ADMINS")    } else {                AdminCount = 0                /** do this incase people change the query order and forget to modify below */        new qcolAuth = SQL_FieldNameToNum(query, "fullnick")        new qcolPass = SQL_FieldNameToNum(query, "password")        new qcolAccess = SQL_FieldNameToNum(query, "privileges")        new qcolFlags = SQL_FieldNameToNum(query, "flags")        new IP[35]        get_user_ip(id, IP, 29, 1)                SQL_PrepareQuery(sql,"UPDATE %s SET `last_game_ip` = `%s` WHERE `fullnick`='%s'", table, IP, qcolAuth)                new AuthData[44];        new Password[44];        new Access[32];        new Flags[32];                while (SQL_MoreResults(query))        {            SQL_ReadResult(query, qcolAuth, AuthData, sizeof(AuthData)-1);            SQL_ReadResult(query, qcolPass, Password, sizeof(Password)-1);            SQL_ReadResult(query, qcolAccess, Access, sizeof(Access)-1);            SQL_ReadResult(query, qcolFlags, Flags, sizeof(Flags)-1);                admins_push(AuthData,Password,read_flags(Access),read_flags(Flags));                        ++AdminCount;            SQL_NextRow(query)        }            if (AdminCount == 1)        {            server_print("[AMXX] %L", LANG_SERVER, "SQL_LOADED_ADMIN")        }        else        {            server_print("[AMXX] %L", LANG_SERVER, "SQL_LOADED_ADMINS", AdminCount)        }                SQL_FreeHandle(query)        SQL_FreeHandle(sql)        SQL_FreeHandle(info)    }        return PLUGIN_HANDLED}
Gal matot klaida, del kurios neiraso last_game_ip i mysql?

Re: Gal matot? :D

Posted: 2011 Jun 30 07:02
by aaarnas
SQL_ReadResult(query, qcolAuth, AuthData, sizeof(AuthData)-1)

46 eilutėje įdėk ir po to qcolAuth -> AuthData

Re: Gal matot? :D

Posted: 2011 Jul 02 22:59
by psychical
Truputi nesupratau :D Jeigu as ta SQLRead iterpsiu po qcolAuth tai jis man mes error...

Re: Gal matot? :D

Posted: 2011 Jul 03 17:36
by aaarnas
qcolAuth kintamajame pas tave yra fullnick lentelės numeris duomenų bazėje, ta šioje eilutėje:

Code: Select all

SQL_PrepareQuery(sql,"UPDATE %s SET `last_game_ip` = `%s` WHERE `fullnick`='%s'", table, IP, qcolAuth)
jis visai ne į temą. Nelabai ir aišku ką tu nori su šią eilute padaryti.

Re: Gal matot? :D

Posted: 2011 Jul 03 23:00
by psychical
Nežinau, rakink/trink tema, peržiūrėjau visą kodą, pastebėjau, jog norint kad įrašytų žaidimo IP, reikia vienam public prirašyti mysql prisijungima...