Guest User

Untitled

a guest
Dec 19th, 2010
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.48 KB | None | 0 0
  1. /* ////////////////////// TRAMPOLINE FILTERSCRIPT BY VonKnox. /////////////////////////////
  2. Usage: Use "/trampoline" to spawn a trampoline infront of you.
  3. Get on it and have fun!
  4. */
  5.  
  6. #include <a_samp>
  7.  
  8. new trampoline[MAX_PLAYERS]={-1,...};
  9.  
  10. public OnFilterScriptInit()
  11. {
  12.     return 1;
  13. }
  14. public OnPlayerConnect(playerid)
  15. {
  16.     trampoline[playerid]=(-1);
  17.     return 1;
  18. }
  19. forward Float:GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance);
  20. stock Float:GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  21. {
  22.     new Float:a;
  23.     GetPlayerPos(playerid, x, y, a);
  24.     if (IsPlayerInAnyVehicle(playerid))
  25.     GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  26.     else GetPlayerFacingAngle(playerid, a);
  27.     x += (distance * floatsin(-a, degrees));
  28.     y += (distance * floatcos(-a, degrees));
  29.     return a;
  30. }
  31.  
  32. public OnPlayerCommandText(playerid, cmdtext[])
  33. {
  34.     if (strcmp("/trampoline", cmdtext, true) == 0)
  35.     {
  36.         new Float:x, Float:y, Float:z;
  37.         GetPlayerPos(playerid, x, y, z);
  38.         GetXYInFrontOfPlayer(playerid, x, y, 5.0);
  39.         trampoline[playerid] = CreateObject(14449, x, y, z, 0.0, 0.0, 0.0);
  40.         return 1;
  41.     }
  42.     return 0;
  43. }
  44. public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
  45. {
  46.     if(newkeys & KEY_JUMP)
  47.     {
  48.         if(trampoline[playerid]==(-1))return 1;
  49.         new Float:Pos[3];
  50.         GetObjectPos(trampoline[playerid],Pos[0],Pos[1],Pos[2]);
  51.         if(IsPlayerInRangeOfPoint(playerid, 2.25, Pos[0],Pos[1],Pos[2]+2.0))
  52.         {
  53.             SetPlayerVelocity(playerid, 0.0, 0.0, 0.5);
  54.         }
  55.     }
  56.     return 1;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment