1. With the latest update, my plugin crash :(
    [​IMG]

    Code:
      RequestDataMySQL : function(prmt){
         var SystemNet = importNamespace("System.Net");
         var WebClient =  new SystemNet.WebClient();
         UrlR = this.Config.Options["URL"]+"key="+this.Config.Options["MySQLKEY"]+"&"+prmt;
         SrvResponse = System.WebClient.DownloadString(UrlR);
         return SrvResponse;
       }
    
    PS: Javascript
     
  2. Wulf

    Wulf Community Admin

    I'm not sure that System.Net is accessible due to the whitelist. I'll have to verify though.
     
  3. If possible, it would be interesting to add him in the whitelist :)

    EDIT: Ignore this, did not know there was a api about it :oops:
    [DOUBLEPOST=1422566451][/DOUBLEPOST]I'm testing the WebRequests using the API providing by oxide, but I have some problems T_T

    Lua work fine! :D
    Code:
    function PLUGIN:cmdtestR()
    local enlace = "http://localhost/rust/rust2/request.php"
    local datos = "?key=test"
    webrequests.EnqueueGet(enlace..datos, function(code, response) print(code) end, self.Object)
    end
    
    But in Javascript not work :(
    Code:
    ReqWeb : function(){
    enlace = "http://localhost/rust/rust2/request.php";
    datos = "?key=test";
    webrequests.EnqueueGet(URL, data, function(code, response){print(code+"|----|"+response);},  this.Object);
    },
    
    [​IMG]

    Another way in Javascript but again not work :(

    Code:
      ReqWeb : function(){
         enlaced = "http://localhost/rust/rust2/request.php";
         datos = "?key=test";
         function test(par, par2){
           print(par);
           print(par2);
         };
         webrequests.EnqueueGet(enlaced+datos, test(code, response), this.Object);
       },
    
    [​IMG]

    Any ideas? Thanks
     
  4. Try defining the callback as a variable (sorry I can't test this at the moment):

    Code:
      ReqWeb: function(){
         enlaced = "http://localhost/rust/rust2/request.php";
         datos = "?key=test";
         testCb = function(code, response) {
           print(code);
           print(response);
         };
         webrequests.EnqueueGet(enlaced+datos, testCb, this.Object);
       },
    
     
  5. Thanks for the reply but does not work :(
    [​IMG]
     
  6. Sorry re-read the error... can you try passing "this" as the last parameter to EnqueueGet?
     
  7. Not working :S
    [DOUBLEPOST=1422632968,1422571659][/DOUBLEPOST]Solved, Solution Here:

    Code:
    var jstest = {
        Title : "Javascript Test",
        Author : "Nogrod",
        Version : V(1, 0, 0),
        HasConfig : true,
        OnServerInitialized : function () {
            webrequests.EnqueueGetHook("http://loripsum.net/generate.php?p=1&l=short", "RequestResult",  this.Plugin);
        },
        RequestResult : function (code, response) {
            print(code+"|----|"+response);
        }
    }
    
    Link:
    http://oxidemod.org/threads/declaring-global-variables-with-javascript.6608/#post-62931

    Thanks to Nogrod :):D:)