[Plugin] YSF – IS4's version
#1

YSF 2.2.1
Latest versionSources
This is my fork of kurta999's YSF version bringing multitudes of useful functions to Pawn. My intention is to update the plugin for new SA-MP versions and add more features.

Update: As kurta is now back in action and the functions from this fork were merged into his code, this is now obsolete. Thanks for all your support! kurta999's thread

Changelog
0.3.7-R2

2.2.1
• Fixed crash on incoming RCON connections.

2.2
• Added ResetPlayerMarkerForPlayer (by ziggi).
• Fixed memory leak for OnServerQueryInfo.
• Added GetNPCCommandLine for requesting the parameters NPC was created with. Needs to be enabled first with YSF_ToggleNPCTracking. Don't call right in OnPlayerConnect.

Example return from GetNPCCommandLine:
Code:
"path_to\samp-npc.exe" -h 127.0.0.1 -p 7777 -n npc_name -m npc_script
2.1.1
• Removed GetVehicleAngularVelocity (it didn't work).
• Correct Float tags for OnPlayerClientGameInit's parameters globalchatradius and nametagdistance in Pawn.

2.1
• Fixed IsBanned for Linux via a memory edit, may not work for bans with a timeout.
• Added callback OnOutcomeScmEvent to control synchronization of vehicle components (useful for desyncing car mods for people with modified models). SendClientCheck
• Added callback OnServerQueryInfo allowing to customize query texts returned by the server, like hostname, gamemode, and language, for a specific IP address.

Example for OnServerQueryInfo:
Code:
public OnServerQueryInfo(addr[], hostname[51], gameMode[31], language[31])
{
    if(IsBanned(addr))
    {
        hostname = "You are banned from this server.";
        return 1; //Copy the arguments back and do not proceed to other scripts.
    }
    return -1; //Ignore the arguments; return 0 would copy them back and proceed to other scripts.
}
Example for OnOutcomeScmEvent:
Code:
public OnOutcomeScmEvent(playerid, issuerid, E_SCM_EVENT_TYPE:eventid, vehicleid, arg1, arg2)
{
    if(eventid == SCM_EVENT_MOD && GetPVarInt(playerid, "nocarmods")) //change the PVar to disable vehicle mods
    {
        switch(arg1) //the component id
        {
            case 1008,1009,1010,1087: return true; //nitro and hydraulics, safe to mod
            default: return false; //block all other car mods
        }
    }
    return true;
}
2.0 (R18)
Incoming RCON connections erase the banlist due to bugged IsBanned function on Linux.
• Return value of GetVehiclePaintjob matches the parameter of ChangeVehiclePaintjob. Update your code to reflect it!
• Fixed an assertion crash related to RakNet vector values out of bounds.
• Added a couple of vehicle functions, mainly ToggleVehicleSirenEnabled and IsVehicleSirenEnabled. It reflects the "addsiren" parameter of CreateVehicle. You have to re-sync the vehicle if you change its siren state like for SetVehicleNumberPlate, or respawn with SetVehicleToRespawn. Other functions include GetVehicleAngularVelocity, which probably returns radians, GetVehicleMatrix returning the internal vehicle rotation matrix, which can also be converted to a quaternion returned by GetVehicleRotationQuat. The last three parameters are observed to be 0 if an unoccupied vehicle is updated (invalidating the quaternion). SetVehicleMatrix doesn't seem to work at all, but maybe you'll find some use.
• Added new natives:
Code:
native GetSyncBounds(&Float:hmin, &Float:hmax, &Float:vmin, &Float:vmax);
native SetSyncBounds(Float:hmin, Float:hmax, Float:vmin, Float:vmax);
They address this issue. These functions control the bounds where the player position and shots are synced with other players. You can quite easily set them to infinity:
Code:
#define FLOAT_INFINITY (Float:0x7F800000)
SetSyncBounds(-FLOAT_INFINITY, FLOAT_INFINITY, -FLOAT_INFINITY, FLOAT_INFINITY);
Default bounds are "-20000, 20000, -1000, 200000". The first two parameters control the bounds for X and Y coordinates, while the second two for the Z coordinate, i.e. height.
• RCON connections are allowed again.
• GetObjectAttachedData and GetObjectAttachedOffset return correct values if attached on a player.

R17 – latest version by kurta
• Added OnPlayerClientGameInit*
• Added compatibility with SKY, now both plugin can be loaded without crash
• Added GetActorAnimation
• Added (Set/Get)RecordingDirectory
• Added GetVehicleModelCount, GetVehicleModelsUsed
• Added YSF_SetExtendedNetStatsEnabled, YSF_IsExtendedNetStatsEnabled (by default disabled)
• Added YSF_(Set/Get)AFKAccuracy to adjust AFK accuracy, in ms - default 1500
• TogglePlayerOnPlayerList renamed to TogglePlayerInServerQuery
• Fixed GangZoneShowForAll would call OnPlayerLeaveGangZone
• Fixed crash with AttachObjectToPlayer
• Fixed crash with AttachPlayerObjectToPlayer
• Fixed GetObjectAttachedData -> 'attachedplayerid'
• Other minor bugfixes & improvements

* This callback will be called immendiately after player connects to a server. You can change the inital settings here for the player, like cjwalk, onfoot_rate, etc.

Download: GitHub

Examples
The most useful functions:
SetPlayerGravity – change the gravity only for one player.
Code:
SetPlayerGravity(playerid, 0.001);
TextDrawSetPos – you can change an existing textdraw position only with ONE line. After you change the TD pos, you need to re-show it for every player.
Code:
TextDrawSetPos(myTextdraw, 320.0, 240.0);
TextDrawShowForAll(myTextdraw);
GetVehicleRespawnTick – get time since vehicle spawned and occupied, in milliseconds.
Code:
new respawn = GetTickCount() - GetVehicleRespawnTick(vehicleid);
new occupied = GetTickCount() - GetVehicleOccupiedTick(vehicleid);
Installation
1) Download the latest release, extract every file from .zip to your server directory. If you are downloading separate files, download the .dll or .so file to the "plugins" directory, and YSF.inc to "pawno\includes".

2) Add YSF to your server.cfg:

For Windows, "plugins YSF.dll";
For Linux, "plugins YSF.so".

3) Add YSF.inc to your mode and recompile, for beginers:
Put this into top of your mode:

Code:
#include <YSF>
4) Start server!

Natives and callbacks
See the latest include or the original post. Some functions are also documented on the GitHub wiki.

Compiling
In case you wanted to compile this project yourselves, you'll need Visual Studio 2010 or better on Windows. On Linux, it should be as easy as running "make" in the project directory.

Credits
kurta999 for maintaining this plugin for a long time and writing a tutorial on updating memory hacking plugins without which I would not be able to update this,
******,
OrMisicL,
0x688,
Riddick94,
Whitetiger,
iFarbod,
P3ti,
Mellnik,
Zeex,
Incognito,
balika011,
Gamer_Z
Reply
#2

Great work
Reply
#3

Thanks, good job!
Reply
#4

Thanks for maintaining the plugin as it is used a lot to most of the scripts I have and a new release would ruin everything.

Might as well take a look on this: http://forum.sa-mp.com/showpost.php?...postcount=1345
I know it's not much of an issue but it would be more convenient for everyone if the paintjob IDs match those listed to samp wiki.
Reply
#5

Good decision, personally this plugin is very good.
You can check this?
Only happens in Windows ...
Reply
#6

Good job m8! I'm testing it right now!
Reply
#7

Quote:
Originally Posted by Konstantinos
View Post
The paintjob number was simply offset by 1, I have changed it now to subtract 1 every time. Expect the change next release.

Quote:
Originally Posted by hydewhyd
View Post
You can check this?
Only happens in Windows ...
I don't understand the problem. Could you describe it better, please?
Reply
#8

Quote:
Originally Posted by sprtik
View Post
I don't understand the problem. Could you describe it better, please?
In Windows when I put a map with CreateObject and RemoveBuildingForPlayer going well but i write "gmx" and I enter again in the server it only load the RemoveBuild but no the objects.

Proof: this screenshot after restart with gmx...

If you can revise it and fix it I'd appreciate it!
Reply
#9

Are the objects still there on the server, or are they completely deleted? Does this effect persist after reconnect?
Reply
#10

Quote:
Originally Posted by sprtik
Посмотреть сообщение
Are the objects still there on the server, or are they completely deleted? Does this effect persist after reconnect?
I think it has removed, this problem persist too after reconnect.
Reply
#11

Here we go again!
Reply
#12

Thanks for maintaining the plugin :P
Reply
#13

Please dont take me wrong, but the reason nobody decided to maintain these plugin is because of the way it works, that is Memory Hacking. I have nothing against memory hacking and i felt free to use YSI by Kurta for simple reason, he reverse engineered the hell out of it and i knew he had skills to crack,reverse and update it in a few days when he got a time. Are you sure that you have skills to update these plugin when the time comes? That is when new samp update comes. And i dont mean only base addresses i mean additional info and sync structures, and anything that could be added in feature by sa-mp itself. I know Kye said these is probably last version but we have to be prepared.

You see updating NetGame structure base address is one thing, but when some variable/pointer (not to mention array) is added in the middle that is a problem, you would need to know where it is and if not what it is, at least how big it is to fix offset. Not to mention when sync structure is changed/extended, it may seem like easiest job to catch packet and fix few small var's, but it could be a big wall if there is compression/encryption. If you are able to cope with all that, then thank you for continuing project, but if you are not dont mislead people to use these plugin as its fully supported for newer versions of samp.
Reply
#14

Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
Please dont take me wrong, but the reason nobody decided to maintain these plugin is because of the way it works, that is Memory Hacking. I have nothing against memory hacking and i felt free to use YSI by Kurta for simple reason, he reverse engineered the hell out of it and i knew he had skills to crack,reverse and update it in a few days when he got a time. Are you sure that you have skills to update these plugin when the time comes? That is when new samp update comes. And i dont mean only base addresses i mean additional info and sync structures, and anything that could be added in feature by sa-mp itself. I know Kye said these is probably last version but we have to be prepared.

You see updating NetGame structure base address is one thing, but when some variable/pointer (not to mention array) is added in the middle that is a problem, you would need to know where it is and if not what it is, at least how big it is to fix offset. Not to mention when sync structure is changed/extended, it may seem like easiest job to catch packet and fix few small var's, but it could be a big wall if there is compression/encryption. If you are able to cope with all that, then thank you for continuing project, but if you are not dont mislead people to use these plugin as its fully supported for newer versions of samp.
That's why it's a github project and people should contribute.
Reply
#15

Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
Please dont take me wrong, but the reason nobody decided to maintain these plugin is because of the way it works, that is Memory Hacking. I have nothing against memory hacking and i felt free to use YSI by Kurta for simple reason, he reverse engineered the hell out of it and i knew he had skills to crack,reverse and update it in a few days when he got a time. Are you sure that you have skills to update these plugin when the time comes? That is when new samp update comes. And i dont mean only base addresses i mean additional info and sync structures, and anything that could be added in feature by sa-mp itself. I know Kye said these is probably last version but we have to be prepared.

You see updating NetGame structure base address is one thing, but when some variable/pointer (not to mention array) is added in the middle that is a problem, you would need to know where it is and if not what it is, at least how big it is to fix offset. Not to mention when sync structure is changed/extended, it may seem like easiest job to catch packet and fix few small var's, but it could be a big wall if there is compression/encryption. If you are able to cope with all that, then thank you for continuing project, but if you are not dont mislead people to use these plugin as its fully supported for newer versions of samp.
I understand your concerns, and neither I am sure if I will be able to update this for the new version. However, I've already installed Ida Pro and learnt to use it (thanks to kurta's tutorial), and thus I can find the offsets for mostly anything quite well. Then it just needs lots of testing, if something hard to notice hasn't changed.
Reply
#16

Can you set git tags for new versions? Issue section? Copy and update wiki? It will be very useful.
Reply
#17

Quote:
Originally Posted by ZiGGi
Посмотреть сообщение
Can you set git tags for new versions? Issue section? Copy and update wiki? It will be very useful.
Done! Hadn't thought it would be that easy.
Reply
#18

Quote:
Originally Posted by sprtik
Посмотреть сообщение
Done! Hadn't thought it would be that easy.
What about git tags? It necessary for download version from releases page.
Reply
#19

Thanks so much for picking up where kurta left off. Here are some workflow suggestions:

Use semantic versioning
God, I hate these R1, R2, etc. release numbers. Please use semantic versioning: semver.org. TL; DR:


Use GitHub releases
Create releases here: https://github.com/IllidanS4/YSF/releases
As tag and name, use the version number. As description, shortly describe the focus of the update (optional) followed by a list of changes, e.g.:

- Added X
- Added Y
- Changed Z
- Removed M
- Fixed W

Add a .gitignore file
I think you removed it? Add a .gitignore file, which you can download an example .gitignore file here: https://github.com/github/gitignore/...udio.gitignore

Do NOT commit your binaries!
Binaries change every time you compile your code, which makes your repository grow immensely. By adding the .gitignore file mentioned above, you'll block Git from adding any DLL files. Instead, attach the compiled binaries to the releases mentioned above.


If you need help with anything I mentioned above or additional explanations don't hesitate to ask!

Thanks again!
Reply
#20

Thanks for maintaining this plugin hope that you will make more optimised too
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)