Advertisement
ToGoRo

Horse System

Jul 12th, 2020
2,213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.41 KB | None | 0 0
  1. /*[U][B][I]John Doe = Scripting, keystroke functions.[/I][/B][/U]
  2. [U][B][I]John Stark = Ideas, Attachment, Animation.[/I][/B][/U]*/
  3. public OnPlayerUpdate(playerid)
  4. {
  5.     new keys, ud, lr;
  6.     GetPlayerKeys(playerid, keys, ud, lr);
  7.     if((keys & (KEY_WALK)) == (KEY_WALK))
  8.     {
  9.         new Float:x, Float:y, Float:z, Float:angle;
  10.         TogglePlayerControllable(playerid, false); // If you want, you can remove the function.
  11.         GetPlayerPos(playerid, x, y, z);
  12.         GetPlayerFacingAngle(playerid, angle);
  13.         x += (0.1 * floatsin(-angle, degrees));
  14.         y += (0.1 * floatcos(-angle, degrees));
  15.         SetPlayerPos(playerid, x, y, z);
  16.         ApplyAnimation(playerid, "BIKED", "BIKED_RIDE", 4.1, 1, 1, 1, 1, 0, 1);
  17.     }
  18.     if((keys & (KEY_SPRINT)) == (KEY_SPRINT) || (keys & (KEY_JUMP)) == (KEY_JUMP))
  19.     {
  20.         new Float:angle;
  21.         GetPlayerFacingAngle(playerid, angle);
  22.         if(keys == KEY_WALK) SetPlayerFacingAngle(playerid, angle-0.1);
  23.         else SetPlayerFacingAngle(playerid, angle+0.1);
  24.         ApplyAnimation(playerid, "BIKED", "BIKED_RIDE", 4.1, 1, 1, 1, 1, 0, 1);
  25.     }
  26.     return 1;
  27. }
  28.  
  29. CMD:horse(playerid,params[])
  30. {
  31.     SetPlayerAttachedObject(playerid, 5, 11733, 5, -0.627999, 1.480000, -0.126000, 93.399879, 1.999998, 77.299987, 1.103000, 1.112997, 1.014999);
  32.     ApplyAnimation(playerid, "BIKED", "BIKED_RIDE", 4.1, 1, 1, 1, 1, 0, 1);
  33. }
  34.  
  35. /*[U][B][I]John Doe = Scripting, keystroke functions.[/I][/B][/U]
  36. [U][B][I]John Stark = Ideas, Attachment, Animation.[/I][/B][/U]*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement