Results 1 to 6 of 6

Thread: working with exec_async

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    ... connecting
    Join Date
    May 2019
    Posts
    8
    Thanks
    7
    Thanked 4 Times in 4 Posts

    working with exec_async

    I have a couple questions about the async methods.
    I tried to implement them as best as I could, an example
    PHP Code:
    dosomething_async(killer killd)
    {
        
    exec_async_create("./save.sh " killer " " +  killd, ::dosomething_result_async);
        
    check_async();
    }

    dosomething_result_async(result)
    {
        
    level notify("stop_async");
        
    entity GetEntByNumint(result[0]));
        if(
    result[1]=="OK"){
            
    entity iprintln("OK");
        }
        else{
            
    entity iprintln("ERROR"result[1]);
        }
        
    }

    check_async()
    {
        
    level endon("stop_async");
        for(;;)
        {
            
    wait 0.05;
            
    exec_async_checkdone();
        }    
    }

    killed(eInflictoreAttacker)
    {
        
    killer eAttacker GetEntityNumber();
        
    killd self GetEntityNumber();

        if(
    killd!=killer)
        {
            
    dosomething_async(killer killd);
        }

    i get error
    PHP Code:
    ******* script compile error *******
    return 
    value of developer command can not be accessed if not in a /# ... #/ comment: (file 'maps/mp/gametypes/_kill.gsc', line 10)
     
    entity GetEntByNum(int(result[0])); 
    do you have any ideas?

    My goal is to iprintln on client only after correctly using save.sh

    Second question if two events are launched (kill events in this case) and then the first one terminates and notifies "stop_async" do both check_async terminates? or only the first one?

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

    kung foo man (29th May 2019)

Posting Permissions

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