Hi Allied modders,
Im a bit new to amxx scripting and im wondering if someone could help me:
Code:
new error[128], errno
new i = 0
new Handle:info = SQL_MakeStdTuple()
new Handle:sql = SQL_Connect(info, errno, error, 127)
new Handle:query = SQL_PrepareQuery(sql, "SELECT * FROM `%s` ", 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 {
new long = SQL_NumResults (sql, "SELECT * FROM `%s` ", table))
new irc_hosts[long]
new irc_names[long]
new irc_flags[long]
new irc_steamids[long]
new qircauth = SQL_FieldNameToNum(query, "ircauth")
new qnickname = SQL_FieldNameToNum(query, "nickname")
new qaccess = SQL_FieldNameToNum(query, "access")
new qsteamid = SQL_FieldNameToNum(query, "steamid")
i = 0
while (SQL_MoreResults(query))
{
SQL_ReadResult(query, qircauth , qircauth[i], 31)
SQL_ReadResult(query, qircauth , qnickname[i], 31)
SQL_ReadResult(query, qircauth , qaccess[i], 31)
SQL_ReadResult(query, qircauth , qsteamid[i], 31)
irc_hosts[i] = qircauth[i]
irc_names[i] = qnickname[i]
irc_flags[i] = qaccess[i]
irc_steamids[i] = qsteamid[i]
++i
SQL_NextRow(query)
}
}
if (i == 1)
server_print("[AMXX] %L", LANG_SERVER, "SQL_LOADED_ADMIN")
else
server_print("[AMXX] %L", LANG_SERVER, "SQL_LOADED_ADMINS", i)
SQL_FreeHandle(query)
SQL_FreeHandle(sql)
SQL_FreeHandle(info)
}
}
i need to get the information from the mysql database into an array like this:
Code:
new irc_hosts[][] = "host1","host2" etc..
Who can push me a bit in the right way?