Agneese-Saini / SA-MP

Apache License 2.0
67 stars 119 forks source link

[SUGGESTION] YSF optional dependency for attachments.inc #5

Closed IstuntmanI closed 6 years ago

IstuntmanI commented 6 years ago

For https://github.com/Agneese-Saini/SA-MP-Files/blob/master/pawno/include/attachments.inc:

As you may know, @kurta999 tried to add player attachment functions per-player:

native SetPlayerAttachedObjForPlayer(forplayerid, attachtoplayerid, index, modelid, bone, Float:fOffsetX = 0.0, Float:OffsetY = 0.0, Float:fOffsetZ = 0.0, Float:fRotX = 0.0, Float:fRotY = 0.0, Float:fRotZ = 0.0, Float:fScaleX = 1.0, Float:fScaleY = 1.0, Float:fScaleZ = 1.0, materialcolor1 = 0, materialcolor2 = 0);
native GetPlayerAttachedObjForPlayer(forplayerid, attachtoplayerid, index, &modelid, &bone, &Float:fX, &Float:fY, &Float:fZ, &Float:fRotX, &Float:fRotY, &Float:fRotZ, &Float:fSacleX, &Float:fScaleY, &Float:fScaleZ, &materialcolor1, &materialcolor2);
native RemPlayerAttachedObjForPlayer(forplayerid, removefromplayerid, index);
native IsPlayerAttachedObjForPlayer(forplayerid, attachtoplayerid, index);

but he said that for now that code is crashing in YSF.

In the future, when he will manage to fix it, you could add the optional dependency for YSF in this plugin or you could do that now and server owners could benefit of this immediately after YSF adds those functions. (anyway, I'm pretty sure kurta999 will manage to solve that problem and add them officially) You could have a check like #if defined SetPlayerAttachedObjForPlayer where needed.

This would benefit servers because it would be automatically converted at compile time to use YSF and because other players won't see the attached objects disappearing, only the player who is aiming.

Agneese-Saini commented 6 years ago

Thats a nice idea and I'll do this when YSF will have a stable version with the following functions you wrote.