Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- new playerWheelchair[MAX_PLAYERS];
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp(cmdtext, "/sit", true))
- {
- ApplyAnimation(playerid, "PED", "SEAT_IDLE", 4.1, 0, 0, 0, 1, 0, 1);
- SetPlayerAttachedObject(playerid,0,1369,1,-0.276000,0.089999,-0.011999,178.699661,92.599975,3.100000,0.876001,0.734000,0.779000);
- playerWheelchair[playerid]=1;
- return 1;
- }
- if(!strcmp(cmdtext, "/off", true))
- {
- ApplyAnimation(playerid, "PED", "SEAT_UP", 4.0, 0, 0, 0, 0, 0, 1);
- RemovePlayerAttachedObject(playerid , 0);
- playerWheelchair[playerid]=0;
- return 1;
- }
- return 0;
- }
- stock SetPlayerForwardVelocity(playerid, Float:Velocity, Float:Z)
- {
- if(!IsPlayerConnected(playerid)) return 0;
- new Float:Angle;
- new Float:SpeedX, Float:SpeedY;
- GetPlayerFacingAngle(playerid, Angle);
- SpeedX = floatsin(-Angle, degrees);
- SpeedY = floatcos(-Angle, degrees);
- SetPlayerVelocity(playerid, floatmul(Velocity, SpeedX), floatmul(Velocity, SpeedY), Z);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- playerWheelchair[playerid]=0;
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- if(playerWheelchair[playerid] == 1)
- {
- new Float:a;
- new Keys,ud,lr;
- GetPlayerKeys(playerid,Keys,ud,lr);
- if(ud < 0)
- {
- SetPlayerForwardVelocity(playerid, 0.16, -0.03);
- }
- if(ud > 0)
- {
- SetPlayerForwardVelocity(playerid, -0.16, -0.03);
- }
- if(lr > 0)
- {
- GetPlayerFacingAngle(playerid, a);
- SetPlayerFacingAngle(playerid, a-10);
- }
- if(lr < 0)
- {
- GetPlayerFacingAngle(playerid, a);
- SetPlayerFacingAngle(playerid, a+10);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement