Advertisement
Guest User

skateboard

a guest
Dec 8th, 2022
517
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. /**
  2. TODO:
  3. */
  4.  
  5. #include <ysilib\YSI_Coding\y_hooks>
  6.  
  7. #define INDEX_SKATE (0)
  8.  
  9. enum skate
  10. {
  11. bool:sActive,
  12. sSkate,
  13. };
  14.  
  15. new InfoSkate[MAX_PLAYERS][skate];
  16.  
  17. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  18. {
  19. if(InfoSkate[playerid][sActive] && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
  20. {
  21. static bool:act;
  22. SetPlayerArmedWeapon(playerid,0);
  23.  
  24. if(newkeys & KEY_HANDBRAKE)
  25. {
  26. ApplyAnimation(playerid, "SKATE","skate_run",4.1,1,1,1,1,1,1);
  27.  
  28. if(!act)
  29. {
  30. act = true;
  31. RemovePlayerAttachedObject(playerid,INDEX_SKATE);
  32. DestroyObject(InfoSkate[playerid][sSkate]);
  33. InfoSkate[playerid][sSkate] = CreateObject(19878,0,0,0,0,0,0);
  34. AttachObjectToPlayer(InfoSkate[playerid][sSkate],playerid, -0.2,0,-0.9,0,0,90);
  35. }
  36. }
  37.  
  38. if(oldkeys & KEY_HANDBRAKE)
  39. {
  40. ApplyAnimation(playerid, "CARRY","crry_prtial",4.0,0,0,0,0,0);
  41. if(act)
  42. {
  43. act = false;
  44. DestroyObject(InfoSkate[playerid][sSkate]);
  45. RemovePlayerAttachedObject(playerid,INDEX_SKATE);
  46.  
  47. SetPlayerAttachedObject(playerid,INDEX_SKATE,19878,6,-0.055999,0.013000,0.000000,-84.099983,0.000000,-106.099998,1.000000,1.000000,1.000000);
  48. }
  49. }
  50. }
  51. return true;
  52. }
  53.  
  54. YCMD:skate(playerid,params[], help)
  55. {
  56. if(!IsPlayerInAnyVehicle(playerid))
  57. {
  58. ApplyAnimation(playerid, "CARRY","null",0,0,0,0,0,0,0);
  59. ApplyAnimation(playerid, "SKATE","null",0,0,0,0,0,0,0);
  60. ApplyAnimation(playerid, "CARRY","crry_prtial",4.0,0,0,0,0,0);
  61. SetPlayerArmedWeapon(playerid,0);
  62.  
  63. if(!InfoSkate[playerid][sActive])
  64. {
  65. InfoSkate[playerid][sActive] = true;
  66. DestroyObject(InfoSkate[playerid][sSkate]);
  67. RemovePlayerAttachedObject(playerid,INDEX_SKATE);
  68. SetPlayerAttachedObject(playerid,INDEX_SKATE,19878,6,-0.055999,0.013000,0.000000,-84.099983,0.000000,-106.099998,1.000000,1.000000,1.000000);
  69. PlayerPlaySound(playerid,21000,0,0,0);
  70. }
  71. else
  72. {
  73. InfoSkate[playerid][sActive] = false;
  74. DestroyObject(InfoSkate[playerid][sSkate]);
  75. RemovePlayerAttachedObject(playerid,INDEX_SKATE);
  76. PlayerPlaySound(playerid,21000,0,0,0);
  77. }
  78. }
  79.  
  80. return true;
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement