Guest User

trampoline.pwn

a guest
Dec 20th, 2010
617
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.31 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;
  9.  
  10. public OnFilterScriptInit()
  11. {
  12.     SetTimer("Bounce", 750, true);
  13.     return 1;
  14. }
  15.  
  16. forward Float:GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance);
  17. stock Float:GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  18. {
  19.     new Float:a;
  20.     GetPlayerPos(playerid, x, y, a);
  21.     if (IsPlayerInAnyVehicle(playerid))
  22.     GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  23.     else GetPlayerFacingAngle(playerid, a);
  24.     x += (distance * floatsin(-a, degrees));
  25.     y += (distance * floatcos(-a, degrees));
  26.     return a;
  27. }
  28.  
  29. forward Bounce();
  30. public Bounce()
  31. {
  32.     new Float:x, Float:y, Float:z;
  33.     GetObjectPos(trampoline, x, y, z);
  34.     for(new i; i < MAX_PLAYERS; i++)
  35.     {
  36.         if(IsPlayerInRangeOfPoint(i, 2.25, x, y, z+2.0))
  37.         {
  38.         SetPlayerVelocity(i, 0.0, 0.0, 0.5);
  39.         }
  40.     }
  41. }
  42.  
  43. public OnPlayerCommandText(playerid, cmdtext[])
  44. {
  45.     if (strcmp("/trampoline", cmdtext, true, 10) == 0)
  46.     {
  47.         new Float:x, Float:y, Float:z;
  48.         GetPlayerPos(playerid, x, y, z);
  49.         GetXYInFrontOfPlayer(playerid, x, y, 5.0);
  50.         trampoline = CreateObject(14449, x, y, z, 0.0, 0.0, 0.0);
  51.         return 1;
  52.     }
  53.     return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment