Remote Exec - An alternative to Streams

Started by habi, Jul 18, 2023, 02:48 PM

Previous topic - Next topic

habi2

#30
RemoteExec v1.1.4
  • Blob instances can be send and received
  • Fixed "Invalid ChunkID" on 64-bit windows server (and possibily corresponding Linux server) when using split-streams.
  • Limited amount of chunks send to not more than 5 per ServerFrame



Downloads



You can get the updated source here.

VirusTotal scan report of binaries- 1/63 link


Example Usage
//Written from memory of recent testing
local f=file("image.bmp", "rb");
local c=f.readblob(f.len()); // c is a blob
f.close();
RemoteExec(GetRemoteValue("DrawBitMap")(c), FindPlayer(0)); //calling DrawBitMap( c  ) - a client side function in player with ID 0 's space
For information about DrawBitMap, see this topic.

PSL

Hi Habi.
This plugin works well, I've been using it, I'm having some problems right now.
shop <- null;

class Shop {
a = null;
b = null;
constructor(a,b){
}
}

The client has a slot A and a Shop class
I want to implement a = Shop(a,b); But it failed.

My code:
local userData = ::SetRemoteValue( ::GetRemoteValue("shop"), ::CallRemoteFunc( ::GetRemoteValue("Shop"), name, cargo ) );
 ::RemoteExec(userData, player);

habi2

Hi PSL,
I am glad to know that plugin is working fine.

Your code change to this and try:
local userData = ::SetRemoteValue( "shop", ::CallRemoteFunc( ::GetRemoteValue("Shop"), name, cargo ) );
 ::RemoteExec(userData, player);

PSL

Thank you. The code you provided worked

habi2

Remote Exec v1.1.6 Released

We are pleased to announce the release of Remote Exec v1.1.6 for VC:MP servers. This version includes improvements and fixes along with the necessary client-side script files for proper functionality.

Changelog:

v1.1.6 (includes v1.1.5 changes, which was not released) 
  • Fixed client errors when an empty table is passed. 
  • If the player instance parameter is null in RemoteExec: 
    Code (Squirrel) Select
    RemoteExec(SetRemoteValue("a", 1000), null)  It will execute on all connected clients in one go
  • Clients can now send valid Squirrel data types (string, integer, float, blob, etc.) to the server with an identifier. 
    Code (Squirrel) Select
    PassDataToServer(identifier, data) to send data.  The server-side callback
    Code (Squirrel) Select
    onClientData(player, identifier, data) (identifier can be numbered 1,2,3,...) will be executed.
  • New function RemoteOpen to 'dofile' a nut file in client-side. This has limitations..
    Code (Squirrel) Select
    RemoteOpen("path/to/nut", player) transfers a NUT script file as a string and compiles it on the client.  However, this does not affect class functions like GUI::KeyPressed, which still only call the old callback. 
  • Clients can now execute server functions using new client-side function 'Exec'. eg.
    Code (Squirrel) Select
    Exec(GetRemoteValue("print")("Have a nice day"))will print text on server console

Download: 

  (410.75 KB) (mediafire)

Virus-total scan of 7zip: (1/63)

Source-code: here (153.23 KB, mediafire)

For installation and usage details, refer to the provided documentation. 

Thank you for your interest in remote-exec.

PSL

I can't wait to use it. Well done, Habi bro!

habi2


PSL

Hello, Hibi.
An error occurred with GetRemoteValue("print")("abc") on the client, typeof( GetRemoteValue("print")("abc") ) This returns type null.
When I use Exec(GetRemoteValue("print")("Have a nice day")) the client throws an error PeerExec: superblob expected but got null

    local userData = CallRemoteFunc( GetRemoteValue("print"),"123");
    Exec( userData );  //This is effective

habi2

#38
Hi PSL,
There was a problem with _call metamethod of superblob, that it will fail if the 'this' parameter is not table(eg.roottable). I have fixed the problem, now GetRemoteValue("")() can be used anywhere( table, class or instance) :
Player::PlayerDeath, Player::PlayerShoot, all events of Player ( this = Player, a class )
Like Player, it is available across places where 'this' is class like GUI, KeyBind, Script or Server.

This is updated in the following file:
Download PeerExec.nut

I hope this will solve the problem

PSL

After my testing, this problem has been solved

habi2


PSL

Hi Habi,How to send the last data to the server using client-side scripts when a player quits, such as after entering /q?

I tried to perform a remote call to return data during the player exit event, but there was no response

habi2

Hi PSL,
Which data are you referring to.

You can perhaps use ScriptUnload event client side to detect player quitting:
Script::ScriptUnload()
Return type: void.
Called before scripts are unloaded, on disconnect.

PSL

The player's client has a table that stores the state of the GUI. I hope that when the player quits, this table can be sent to the server and stored on the server, so that when the player logs in again, the table can be transmitted to restore the previous GUI state.

PSL

PassDataToServer

I can use the this function to send this table, but using this function in script uninstallation events is invalid。

What I can think of now is to use a client timer to implement it