[Include] samp-compat: Backwards and forward compatibility libraries between server-client (Old IsClient03DL)
#1

Please use samp-compat from now on, thanks!

Old post:






samp-compat libraries



Allow connections from clients with clients that differ from the server's version, allowing them to play alongside other clients without any additional software.

Installation

Simply install to your project depending on the version you wish to allow (0.3.7 servers should grab samp-dl-compat, and 0.3.DL servers should use samp-037-compat):

Code:
sampctl package install AGraber/samp-dl-compat
OR
sampctl package install AGraber/samp-037-compat
Include in your code:

Code:
#include <dl-compat>
OR
#include <037-compat>
Usage

Just include it to your script, nothing else to do. If you want to detect clients that use another version, you can use the original SA-MP function GetPlayerVersion, or use IsClient03DL(playerid) or IsClient037(playerid) (depending on the version you choose). This is not required for the include to work though.


Testing

A testing gamemode is included, this test showcases the capabilities of the include, by using functions that would rather be incompatible with clients if the RPCs contents weren't patched.

To test, simply run the package:
Code:
sampctl package run
Disclaimer
samp-037-compat lacks the inability to change virtual worlds for old clients, leaving them unsynced for the rest of their session. I wouldn't recommend it for actually playing, but rather sending a nice message telling the client to update their cliente version.

Custom objects and skins are not going to work with old clients. Custom skins will fallback to their base IDs, while objects are going to spawn as a `?` object that SA-MP falls back to when it tries to create an invalid object.

Please check the include if you're going to modify RPC contents, since some RPCs are modified, you must know what kind of changes or reads are you going do, otherwise you will recieve inconsistent data. You can use the functions provided by the include to know what to expect.

Credits

Thanks for using![/s]
Reply
#2

Wow this is really nice man, a lot of people will appreciate this. I'm in shock!

Is it possible to replace every 0.3.7DL object with a specific model, if it is not found? (Being the question mark object model)

I hope this gets the approval by SA-MP moderators/Kalcor too

Edit: maybe im confused, can a 0.3.7.DL server take in 0.3.7 players?
Reply
#3

Quote:

(one in the works is one for 0.3.7 connections to 0.3.DL)

Would be dope,

Good job once again.
Reply
#4

this is useful man, i hope a lot of servers use this to avoid me switching versions all the time.

one suggestion would be add the link to download https://github.com/AGraber/samp-dl-compat in case some people don't use sampctl

Quote:
Originally Posted by Lorenc_
View Post
Edit: maybe im confused, can a 0.3.7.DL server take in 0.3.7 players?
As of right now, his include allows 0.3.DL connections to join a 0.3.7 server.

but later on, as stated, if requested there will be "one in the works is one for 0.3.7 connections to 0.3.DL."
Reply
#5

How about the models though? Will it also be shown to users on 0.3.7, since AFAIK only 0.3.DL have this kind of function in it. What will be shown to 0.3.7?
Reply
#6

Quote:
Originally Posted by JesterlJoker
View Post
How about the models though? Will it also be shown to users on 0.3.7, since AFAIK only 0.3.DL have this kind of function in it. What will be shown to 0.3.7?
the models can be replaced with a 0.3.7 compatible object. the skins too
Reply
#7

Quote:
Originally Posted by std
View Post
the models can be replaced with a 0.3.7 compatible object. the skins too
If somehow they can take the baseid that would make much sense.

Although @Joker this include (for now) allows 0.3DL to connect to 0.3.7 which means the custom objects for now shouldnt matter.
Reply
#8

Quote:
Originally Posted by Lorenc_
View Post
Wow this is really nice man, a lot of people will appreciate this. I'm in shock!

Is it possible to replace every 0.3.7DL object with a specific model, if it is not found? (Being the question mark object model)

I hope this gets the approval by SA-MP moderators/Kalcor too

Edit: maybe im confused, can a 0.3.7.DL server take in 0.3.7 players?
For the moment, this include makes the server take in 0.3.DL players in 0.3.7 servers (old server), but I've just started working on one that would do what you say (0.3.7 players into 0.3.DL server).

The thing is that, with that version I would have to trust the developer to not send downloadable models to old clients. This can be actually useful when, for example, it's just an interior with custom models (you can deny entrance to this interior for old clients. Or even big maps that only change the virtual world, making a Vice City map totally optional, just to name two examples), or if you're just adding skins then, base ID would be shown instead.

For normal (non-skin) models, I'm not sure if sending the base ID is a good idea, since the base ID is mostly used for IDE flags. The model can be totally unrelated, but that really depends on the server. I think best thing would be to let server owners to place a pair of defines to make things a bit configurable, so that you could change the behaviour of what would happen if this happens.

Thanks for the feedback to all!
Reply
#9

Once you released the 0.3.7 to 0.3DL,I will be using 0.3DL. I suggest to let the server owners decide what the original model is through coding,for example;
PHP Code:
BaseModel(customobjectid,baseobjectid); 
If that code is not assigned,use the baseid in artconfig instead.
Good job tho!
Reply
#10

It's working perfectly, all server owners should include this to their servers to have a full access to 0.3.7 servers from 0.3.DL client
Reply
#11

I just finished the 0.3.7 version (for 0.3.DL servers) and updated the thread to make it generic for both versions.

https://github.com/AGraber/samp-037-compat

Enjoy!
Reply
#12

Great job tho! but how about custom objects? what happens when add model RPC is sent and what happens to custom objects in RPC_CreateObject?


EDIT : You must spread some Reputation around before giving it to AdrianGraber again.
Reply
#13

Quote:
Originally Posted by iAmir
Посмотреть сообщение
Great job tho! but how about custom objects? what happens when add model RPC is sent and what happens to custom objects in RPC_CreateObject?


EDIT : You must spread some Reputation around before giving it to AdrianGraber again.
All the new RPCs are ignored by the client (fortunately), so they don't require any patching. But now that I think about it, it should be better to drop them to at least save some bandwidth since it can get big.

Custom objects spawn with the ? model, as SA-MP already handles invalid model IDs that way. I'm thinking of adding support to use base IDs for them, but it would require some checking for every AddModel RPC which may impact performance, as SA-MP doesn't have any methods of retrieving the base ID (unless it gets retrieved with some plugin), and hooking AddSimpleModel the PAWN way wouldn't work with filterscripts or models added through the .txt file.
Reply
#14

How do I install the package? I'm confused.
Reply
#15

Just going to say this seems like a lot of work for a feature that could be useless tomorrow although that probably won't happen! Just think if there is updates to lagcomp for instance or vehicle surfing code which could result in significant differences between clients.

Edit - I should have mentioned that if there is a critical server exploit found that runs rampant all your efforts could be quashed in a blink of an eye until you update.
Reply
#16

You may want to add the link to your git repos in the main thread,as not all people here is using sampctl
Reply
#17

sampctl is a great tool for package management in PAWN

http://sampctl.com/
Reply
#18

Correct the error that occurs with interiors and virtual worlds for the version of samp-037-compat
Reply
#19

This sounds good.

As for you guys that are having issues, you need to EXPLAIN what your issue is, as otherwise, you're not telling anyone anything, and chances are, it's YOUR code, not this.


And even if it is this, saying "Oh there's something wrong" and not saying about what it actually is or what's it's doing, is like saying there'as a needle in the hayfield... when you mean it's in the haystack.

Please report issues appropriately.
Reply
#20

good job!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)