Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- animfix
- kvann 2015, no rights reserved at all.
- */
- #include <a_samp>
- #if defined _animfix_included
- #endinput
- #endif
- #define _animfix_included
- stock GetAnimationIndex(const anim_lib[], const anim_name[])
- {
- new animlib[32], animname[32];
- for (new i = 1; i < 1812; i++)
- {
- GetAnimationName(i, animlib, sizeof(animlib), animname, sizeof(animname));
- if (!strcmp(animlib, anim_lib, true) && !strcmp(animname, anim_name, true)) return i;
- }
- return 0;
- }
- forward SetPlayerAnimationIndex(playerid, index, Float:fDelta, loop, lockx, locky, freeze, time, forcesync);
- public SetPlayerAnimationIndex(playerid, index, Float:fDelta, loop, lockx, locky, freeze, time, forcesync)
- {
- if (!(0 < index < 1812)) return 0;
- new animlib[32], animname[32];
- GetAnimationName(index, animlib, sizeof(animlib), animname, sizeof(animname));
- ApplyAnimation(playerid, animlib, animname, fDelta, loop, lockx, locky, freeze, time, forcesync);
- return 1;
- }
- stock ApplyAnimationEx(playerid, const animlib[], const animname[], Float:fDelta, loop, lockx, locky, freeze, time, forcesync = 1)
- {
- new index = GetAnimationIndex(animlib, animname);
- if (index) SetTimerEx("SetPlayerAnimationIndex", 100, false, "iifiiiiii", playerid, index, fDelta, loop, lockx, locky, freeze, time, forcesync);
- return ApplyAnimation(playerid, animlib, animname, fDelta, loop, lockx, locky, freeze, time, forcesync);
- }
- #if defined _ALS_ApplyAnimation
- #undef ApplyAnimation
- #else
- #define _ALS_ApplyAnimation
- #endif
- #define ApplyAnimation ApplyAnimationEx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement