Results 1 to 9 of 9

Thread: Script documentation

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    And here are the async mysql helper functions:
    PHP Code:

    init_async_mysql
    ()
    {
        
    host getcvar("mysql_host");
        
    user getcvar("mysql_user");
        
    port getcvarint("mysql_port");
        
    pass getcvar("mysql_password");
        
    db getcvar("mysql_database");
        
    mysql_async_initializer(hostuserpassdbport4);
        
    level.mysql_async = [];
        while(
    true)
        {
            list = 
    mysql_async_getdone_list();
            for(
    0< list.sizei++)
            {
                
    result mysql_async_getresult_and_free(list[i]);
                if(!
    isdefined(result))
                    continue;
                if(
    result == 0)
                    
    result undefined;
                
    level.mysql_async["" + list[i]];
                if(
    isdefined(f))
                {
                    if(
    isdefined(f.function))
                        
    thread [[f.function]](resultf.args);
                    else if(
    isdefined(result))
                        
    mysql_free_result(result);
                    
    undefined;
                }
                
    level.mysql_async["" + list[i]] = undefined;
            }
            
    wait .05;
        }
    }

    add_async_query_nosave(q, function, args)
    {
        if(
    getcvarint("show_mysql") == 1)
            
    printf("mysql_query async nosave:" "\n");
        
    id mysql_async_create_query_nosave(q);
        
    spawnstruct();
        
    f.query q;
        
    f.function = function;
        
    f.args args;
        
    level.mysql_async["" id] = f;
    }

    add_async_query(q, function, args)
    {
        if(
    getcvarint("show_mysql") == 1)
            
    printf("mysql_query async:" "\n");
        
    id mysql_async_create_query(q);
        
    spawnstruct();
        
    f.query q;
        
    f.function = function;
        
    f.args args;
        
    level.mysql_async["" id] = f;

    Yes, it is stored as a string-indexed array as i had trouble with high-int indexed arrays in cod2 in the past.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  2. The Following User Says Thank You to IzNoGoD For This Useful Post:

    Mitch (30th December 2014)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •