Hey!
4 example i need to use:
webrequest.EnqueueGet(url, (code, response) => Work(response, code, 1, ip), this);
How can i thn get variables of string Work() (results of string Work())??
4 example in Work i return "Clear" or .. "Error"
Something like.. that, yeah.
Plz help ^)
Getting vars from WebRequest .. => func
Discussion in 'Rust Development' started by Iv Misticos, Oct 13, 2017.
-
Wulf Community Admin
Not sure what you're asking for exactly, but here's another web request example:
Code:webrequest.Enqueue(url, (code, response) => { var work = Work(); if (work == "whatever") Puts("Hello!"); Puts(response); }, this);
-
Code:object CanClientLogin(Network.Connection conn) { // Bla bla bla webrequest.EnqueueGet(url, (code, response) => Work(response, code, 1, ip), this); // How 2 get HERE what returned Work ? } string Work(string response, int code, int urlID, string ip) { if (code != 200 || string.IsNullOrEmpty(response)) { PrintError(GetMsg("Connection: Error"), 1); return "Retry"; } // Bla bla other code return "Dont know"; }
-
Wulf Community Admin
-
i just want a response that i have in some ms and to work with this response(
-
Wulf Community Admin
-
or OnPlayerConnected calls when player clicks Connect? No? If no, when?Last edited by a moderator: Oct 13, 2017 -
Wulf Community Admin
-
[DOUBLEPOST=1507912114][/DOUBLEPOST]So i neeed to type void OnPlayerConnected .. and just kick player if i need?
[DOUBLEPOST=1507912295][/DOUBLEPOST]and so, u didnt answer. How to get all what string Work() returns if i call this using webrequest.EnqueueGet(url, .. blabla.. => Work(blabla), this); ? -
Wulf Community Admin
-
Code:
{ // Bla bla bla webrequest.EnqueueGet(url, (code, response) => Work(response, code, 1, ip), this); // How 2 get HERE what returned Work ? } string Work(string response, int code, int urlID, string ip) { if (code != 200 || string.IsNullOrEmpty(response)) { PrintError(GetMsg("Connection: Error"), 1); return "Retry"; } // Bla bla other code return "Dont know"; }
-
Wulf Community Admin
-
Code:
void OnPlayerConnected(Network.Message packet) { // blablabla if (webUse1) { webrequest.EnqueueGet(url, (code, response) => { var work = Work(response, code, 1, ip); while (work == "Retry") { Thread.Sleep(5000); } }, this); } }
-
-
And you don't need to do it.
All you need to do - it's just check him with webrequest and kick him if you need it. -
-
webrequest means, that you will request some server. Request can be canceled, of course. -
[DOUBLEPOST=1508082097][/DOUBLEPOST]Sorr 4 bad english(webrequest.EnqueueGet - I use that)
-
2. Coroutine via MonoBehaviour
3. QueueWorkerThread -