Comments (5)
"Why you aren't releasing this on SA:MP forums ?"
It was and it has been removed, I remember clearly for that.
from pawn.raknet.
- Returning 0 in callback would drop the packet, so kick is not necessary. (or even better, you can overwrite the invalid value with a valid one)
- I think you didn't understand quite well how those callbacks work.
OnServerSendPacket/RPC is called right before server sends a packet or RPC to client(s).
OnPlayerReceivedPacket/RPC is called right before server processes a packet or RPC received from a client.
How can I actually get the playerid this packet is coming from ?
Packets and RPCs are not sent from client to client. Here is a brief explanation of how communication works:
- client sends a packet to the server;
- server receives it;
- server validates some data and then updates its internal structures acording to the packet received;
And after a while, when current tick = update tick, server broadcasts data read from memory to clients.
This broadcasted packet might or might not contain invalid data.
- You could check when the last update was received from that player. If time difference between last update and current time is greater than 2000ms, then the player is either experiencing heavy lag, either he crashed.
from pawn.raknet.
-
@kurta999 I don't see any reason why they would remove something like this. It is only allowing us to handle all packets/RPCs.
-
@spmn Well, that wasn't what I asked, but you explained me this at the point 3. Anyway, I didn't know that returning 0 in those "Received" callbacks would drop the packet/RPC, thanks. I saw it now.
-
So:
- a client sends a packet/RPC to the server;
- the server receives it and calls OnPlayerReceivedPacket/RPC with sender's player_id;
- server is sending that BitStream to other clients and it calls OnServerSendPacket/RPC, but callback's player_id parameter will have the value of receiver's player ID, right ? I don't think you understood my question exactly or I didn't understand mostly of what you said (well, I think I did). So, in OnServerSendPacket/RPC player_id will have the value of the RECEIVER, but how I can also get the player_id of the SENDER (the guy that initially sent the packet/RPC to server) ? I think that it is possible, as the receiver client knows to which character to apply that BitStream received from the server (this is what I can't understand about this, the receiver client knows from the server what character/player sent him that information, and the receiver client will apply that information to the sender character/player). Is the sender_id actually placed somewhere in every packet/RPC, so we need to know the structure of each packet/RPC to get the initial sender in OnServerSendPacket/RPC ? This is needed to track those received packets/RPC by clients, from point 4.
- This idea is pretty fine I guess, unless there are lots of packets/RPCs sent/received, which I think they are.
About that naming, I think that something like OnServerReceivedPacket/RPC( sender_id, ... )
instead of OnPlayerReceivedPacket
would be better now that I think I understood mostly of what spmn explained. Also, OnServerSendPacket/RPC
should also contain the sender_id, if possible, see the questions above, at point 3.
This thing needs some proper documentation, it can be really useful if more things would be explained.
from pawn.raknet.
@IstuntmanI
2. It also works at send callbacks.
3. Almost all SA-MP server->client update packets have the following structure: 1BYTE=packetid + 1WORD=playerid to apply the data to(most likely the initial sender of the packet) + x BYTES=update itself
So, the 'sender_id' has to be read from bitstream.
Indeed, the callback naming is a bit confusing.
OnServerSendPacket/RPC
can't have a sender_id, because the sender, as the callback name implies, is ALWAYS the server. However, some sent packets (update ones) contain data received from other clients.
About documentation, I think it is not the case here. This plugin just enables scripters access to a few raknet functions, and these functions are documented very well on raknet website.
For more information about the actual packet structure, you can take a look at RakSAMP, sobeit, YSF, SKY, SA-MP 0.2.5/x leak and VC-MP 0.1. (all these projects got their code available on the internet)
from pawn.raknet.
Aw, so it is like I thought: the sender_id is in bitstream (well, when the case needs it).
OnServerSendPacket/RPC can't have a sender_id, because the sender, as the callback name implies, is ALWAYS the server.
I know, I understood that, sender_id should be the initial packet/RPC sender, which sent it to the server. So the callback can't have that parameter because packets/RPCs don't always contain the sender_id.
I know where I can see things about it, but it is pretty complex, I need to check lots of files only for one of those projects, I tried to check YSF to get some ideas about it, but I didn't understand too much (I remember that I saw something about the sender id written in some packets).
Yeah, you are right, if a documentation would be made, it would need to explain the whole RakNet.
Thanks, @spmn !
from pawn.raknet.
Related Issues (20)
- Intercept Incoming Raw Packet not working on OpenMP version HOT 1
- I get errors after using pawn.raknet plugin
- Insane flood in server_log.txt
- How can i detect fake SendClientCheck? HOT 1
- crash server HOT 1
- Pawn.Raknet's giving too many errors
- Pawn.RakNet crashing with sampvoice HOT 1
- someone please help me HOT 1
- edit
- open.mp build 11 update
- Exception At Address: 0x7084DE82 Module: (pawnraknet.DLL) HOT 1
- Server crashed due to an unknown error HOT 1
- [1.5.1-omp] Long callback execution
- Question about OPacket HOT 1
- About IRawPacket HOT 2
- Пакеты не приходят HOT 6
- Crash
- Run time error 19: "File or function is not found
- Attempted to read/write array element at negative index -1 on OnIncomingRPC
- La vida real versión all Countries HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pawn.raknet.