multitheftauto / amx

MTA AMX compatibility layer.
zlib License
31 stars 8 forks source link

New RPC functions #43

Open Disinterpreter opened 4 years ago

Disinterpreter commented 4 years ago

Is your feature request related to a problem? Please describe. If you check out my #41 you can see, I use triggers, because the current RPC system is really weird.

Describe the solution you'd like I'd like to suggest make a new RPC system it will better, simple and it will contains documentation.

Additional context

Current realization: https://github.com/multitheftauto/amx/blob/dd50399cee2736ebdbd20ea3b1705fb6e7434d6d/amx/server/util.lua#L44-L50

https://github.com/multitheftauto/amx/blob/dd50399cee2736ebdbd20ea3b1705fb6e7434d6d/amx/client/util.lua#L55-L63

qaisjp commented 4 years ago

What's the actual problem with the RPC system? This issue isn't really clear about what the problem is.

Disinterpreter commented 4 years ago

What's the actual problem with the RPC system? This issue isn't really clear about what the problem is.

When I tried to use it. I had got a weird function behavior. For me server. did not make a call from a server (maybe I made it incorrectly). And about clientCall can we make something which can return data from client from the function? Or we will got a problem with asynchronous operations?

qaisjp commented 4 years ago

Server RPC I think you need to do server:setPlayerName(localPlayer, "test") with the :. Did that not work?

Client RPC clientCall -- we could implement something by incorporating coroutines. The caller would also have to specifically opt into it, as usually we don't care about the return value. We can call it client.async:stuff. But it might be a wee bit complicated as it would freeze the entire AMX virtual machine. Ideally we add stuff to mtasa-blue to expose other properties that are synced (e.g. reloading), or do the syncing ourselves.

Client RPC: doing the syncing ourselves Since amx is statically compiled, perhaps we could do some pre-analysis to check what functions are called (if possible), so we don't sync extra information unnecessarily.

Disinterpreter commented 4 years ago

Server RPC I think you need to do server:setPlayerName(localPlayer, "test") with the :. Did that not work?

About Server RPC. I'll check it out later. Maybe it was a problem of my code.

Ideally we add stuff to mtasa-blue to expose About Client RPC

I hope it will be important for mtasa-blue. There are few features which we must add to mtasa-blue I suppose. I can set up a label for issues which contains this depension from mtasa-blue and I'll be create issues there.