SAPE ERROR: Не могу подключиться к серверу: dispenser-01.saperu.net/code.php?user=836f97673aa6aa25a35b5029263ee232&host=amxxmodx.ru&charset=windows-1251&format=serialize, type: file_get_contents

SAPE ERROR: Не могу подключиться к серверу: dispenser-02.saperu.net/code.php?user=836f97673aa6aa25a35b5029263ee232&host=amxxmodx.ru&charset=windows-1251&format=serialize, type: file_get_contents

SQL_Rewind » AmxModX
| |
 RSS
  • OnLine

    : 7
    : 6
    : -
    : crawl Bot

    ?

    • AMX Mod X
    • up.org.ua


  • : Admin : 30-10-2012, 22:57 : 2005

    SQL_Rewind

    SQL_Rewind, .

    sql.inc:
    /**
    * Rewinds a result set to the first row.
    */
    native SQL_Rewind(Handle:query);


    :
    SQL_Rewind(Handle:query)

    • Handle:query -


    :
    Native

    :
    /* Plugin generated by AMXX-Studio */

    #include <amxmodx>
    #include <amxmisc>
    #include <sqlx>

    #define PLUGIN "[http://amxxmodx.ru] SQL_Rewind"
    #define VERSION "1.0"
    #define AUTHOR "Admin"

    new Handle:SQL_Tuple
    new Handle:SQL_Connection

    public plugin_init() {
        
        register_plugin(PLUGIN, VERSION, AUTHOR)
        register_cvar("SQLx_host","127.0.0.1")
        register_cvar("SQLx_db","amxxmodx")
        register_cvar("SQLx_user","admin")
        register_cvar("SQLx_password","pass")
        
        register_concmd("select_sql","sqlx_select")
    }
    public plugin_cfg(){
        new host[33],dbase[33],user[33],pass[33]
        get_cvar_string("SQLx_host",host,30)
        get_cvar_string("SQLx_db",dbase,30)
        get_cvar_string("SQLx_user",user,30)
        get_cvar_string("SQLx_password",pass,30)
        SQL_Tuple = SQL_MakeDbTuple(host,user,pass,dbase) //
        new err, error[256]
        SQL_Connection = SQL_Connect(SQL_Tuple, err, error, charsmax(error)) //
        
        if(SQL_Connection != Empty_Handle)
        {
            log_amx("[SQLx connect ok]") //
            }else{
            log_amx("[SQLX sql error] %s ",error) // ()
            pause("a")
        }
        
    }
    public sqlx_select(id){
        
        //
        new Handle:query = SQL_PrepareQuery(SQL_Connection,"SELECT * FROM `dle_files`")
        //
        SQL_Execute (query)
        
        new Rewind,i
        
        while(SQL_MoreResults(query)){
            i++
            
            new id = SQL_ReadResult(query, 0)
            new str[32]
            SQL_ReadResult(query, 1, str, 31)
            new name[32]
            SQL_ReadResult(query, 2, name, 31)
            
            server_print("SQL Select Result: %d %s %s",id,str,name)
            
            
            if(i == 5 && Rewind == 0){//
                Rewind =1
                server_print("^nK Ha4aly^n")
                SQL_Rewind(query)//
            }
            
            SQL_NextRow(query)
            
            
        }
    }
    public plugin_end(){
        
        SQL_FreeHandle(SQL_Connection)
        
    }


    :
    SQL_NextRow SQL_ReadResult 2. ., .
    :
            if(i == 5 && Rewind == 0){//  
                Rewind =1
                server_print("^nK Ha4aly^n")
                SQL_Rewind(query)//
            }

    ( , .
    , .
    , .
    .
    SQL_Rewind