Advertisement
Guest User

SAMP Wheelchair riding script

a guest
Oct 16th, 2017
1,129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.94 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new playerWheelchair[MAX_PLAYERS];
  4.  
  5. public OnPlayerCommandText(playerid, cmdtext[])
  6. {
  7.     if(!strcmp(cmdtext, "/sit", true))
  8.     {
  9.         ApplyAnimation(playerid, "PED", "SEAT_IDLE", 4.1, 0, 0, 0, 1, 0, 1);
  10.         SetPlayerAttachedObject(playerid,0,1369,1,-0.276000,0.089999,-0.011999,178.699661,92.599975,3.100000,0.876001,0.734000,0.779000);
  11.         playerWheelchair[playerid]=1;
  12.         return 1;
  13.     }
  14.     if(!strcmp(cmdtext, "/off", true))
  15.     {
  16.         ApplyAnimation(playerid, "PED", "SEAT_UP", 4.0, 0, 0, 0, 0, 0, 1);
  17.         RemovePlayerAttachedObject(playerid , 0);
  18.         playerWheelchair[playerid]=0;
  19.         return 1;
  20.     }
  21.     return 0;
  22. }
  23.  
  24. stock SetPlayerForwardVelocity(playerid, Float:Velocity, Float:Z)
  25. {
  26.     if(!IsPlayerConnected(playerid)) return 0;
  27.    
  28.     new Float:Angle;
  29.     new Float:SpeedX, Float:SpeedY;
  30.     GetPlayerFacingAngle(playerid, Angle);
  31.     SpeedX = floatsin(-Angle, degrees);
  32.     SpeedY = floatcos(-Angle, degrees);
  33.     SetPlayerVelocity(playerid, floatmul(Velocity, SpeedX), floatmul(Velocity, SpeedY), Z);
  34.    
  35.     return 1;
  36. }
  37.  
  38. public OnPlayerConnect(playerid)
  39. {
  40.     playerWheelchair[playerid]=0;
  41.     return 1;
  42. }
  43.  
  44. public OnPlayerUpdate(playerid)
  45. {
  46.     if(playerWheelchair[playerid] == 1)
  47.     {
  48.  
  49.  
  50.         new Float:a;
  51.         new Keys,ud,lr;
  52.         GetPlayerKeys(playerid,Keys,ud,lr);
  53.         if(ud < 0)
  54.         {
  55.  
  56.             SetPlayerForwardVelocity(playerid, 0.16, -0.03);
  57.  
  58.         }
  59.         if(ud > 0)
  60.         {
  61.    
  62.             SetPlayerForwardVelocity(playerid, -0.16, -0.03);
  63.        
  64.         }
  65.         if(lr > 0)
  66.         {
  67.        
  68.             GetPlayerFacingAngle(playerid, a);
  69.             SetPlayerFacingAngle(playerid, a-10);
  70.            
  71.         }
  72.         if(lr < 0)
  73.         {
  74.        
  75.             GetPlayerFacingAngle(playerid, a);
  76.             SetPlayerFacingAngle(playerid, a+10);
  77.            
  78.         }
  79.     }
  80.  
  81.     return 1;
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement