Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Uses s-art plugin to render frames of a video
- #include <a_samp>
- #include <s-art>
- #define ART_POS 0.0, 0.0, 20.0
- #define ART_ROT 0.0, 0.0, 0.0
- #define PNG_PATH "C:\\PNG\\%d.png"
- #define TARGET_FPS 30
- new CurrentFrame = 0, MovieTimer = -1, CurrentArt = -1;
- public OnFilterScriptExit()
- {
- if(MovieTimer != -1)
- {
- KillTimer(MovieTimer);
- DestroyArt(CurrentArt);
- }
- return 1;
- }
- forward MovieTimerCallback();
- public MovieTimerCallback()
- {
- new fname[50];
- format(fname, sizeof(fname), PNG_PATH, CurrentFrame);
- if(CurrentArt != -1) DestroyArt(CurrentArt);
- CurrentArt = CreateArt(fname, 0, ART_POS, ART_ROT, 700.0);
- if(CurrentArt == 10) // Plugin returns 10 on error for some weird reason
- {
- KillTimer(MovieTimer);
- MovieTimer = -1;
- CurrentFrame = 0;
- CurrentArt = -1;
- return;
- }
- CurrentFrame ++;
- return;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(strcmp(cmdtext, "/movie", true) == 0)
- {
- if(MovieTimer != -1) KillTimer(MovieTimer);
- if(CurrentArt != -1) DestroyArt(CurrentArt);
- MovieTimer = SetTimer("MovieTimerCallback", 1000/TARGET_FPS, 1);
- CurrentFrame = 0;
- CurrentArt = -1;
- return 1;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment