Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- jRUN by ES.^ a.k.a Johurt, 2016/01/06
- Special for Semikola
- */
- #include <a_samp>
- #define HOLDING(%0,%1) ((%0 & (%1)) == (%1))
- #define RUN_ANIM_STYLE 8
- #define RUN_SPEED 4.1
- new bool:pRun[MAX_PLAYERS];
- enum a
- {
- run_animlib[9],
- run_animname[16]
- };
- new run_i[][a] =
- {
- {"FAT", "FatRun"},
- {"MUSCULAR", "MuscleRun"},
- {"PED", "run_civi"},
- {"PED", "run_fat"},
- {"PED", "run_fatold"},
- {"PED", "run_gang1"},
- {"PED", "run_old"},
- {"PED", "run_player"},
- {"PED", "swat_run"},
- {"PED", "woman_run"},
- {"PED", "WOMAN_runbusy"},
- {"PED", "WOMAN_runfatold"},
- {"PED", "woman_runpanic"},
- {"PED", "WOMAN_runsexy"},
- {"SKATE", "skate_run"}
- };
- public OnPlayerConnect(playerid)
- {
- pRun[playerid] = false;
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- ApplyAnimation(playerid, run_i[RUN_ANIM_STYLE][run_animlib], "null", 0.0, 0, 0, 0, 0, 0);
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- new k[3], Float:cPos[6];
- GetPlayerKeys(playerid, k[0], k[1], k[2]);
- GetPlayerVelocity(playerid, cPos[0], cPos[1], cPos[2]);
- if(HOLDING(k[0], KEY_SPRINT) && k[1] == KEY_UP && cPos[2] == 0)
- {
- if(!pRun[playerid])
- {
- pRun[playerid] = true;
- ApplyAnimation(playerid, run_i[RUN_ANIM_STYLE][run_animlib], run_i[RUN_ANIM_STYLE][run_animname], RUN_SPEED, 1, 1, 1, 0, 0, 1);
- }
- GetPlayerCameraPos(playerid, cPos[0], cPos[1], cPos[2]);
- GetPlayerCameraFrontVector(playerid, cPos[3], cPos[4], cPos[5]);
- /* Turn by frog163 */
- cPos[0] += floatmul(cPos[3], 15.0);
- cPos[1] += floatmul(cPos[4], 15.0);
- GetPlayerPos(playerid, cPos[3], cPos[4], cPos[5]);
- SetPlayerFacingAngle(playerid, 180.0-atan2(cPos[3] - cPos[0], cPos[4] - cPos[1]));
- }
- else
- {
- if(pRun[playerid])
- {
- ClearAnimations(playerid);
- pRun[playerid] = false;
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement