Advertisement
JeffryUGP

[FS]Ramping (Not Seeable for others)

May 5th, 2013
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.21 KB | None | 0 0
  1. /*=========================================================================
  2. This Ramping Filterscript is made by Jeffry
  3.  
  4.  
  5. Made in January 2010.
  6.  
  7. Your Rights:
  8.  
  9. -You are allowed to modify this Filterscript, aslong as you DO NOT remove credits or re-upload it.
  10.  
  11. -You are NOT allowed to re-upload this Filterscript.
  12. -You are NOT allowed to claim this as your own.
  13. -You are NOT allowed to remove any credits.
  14.  
  15. Thank you.
  16. Have fun. I would be happy if you give me /credits.  :D
  17.  
  18. ===========================================================================*/
  19.  
  20.  
  21. #include <a_samp>
  22.  
  23. new bool:CreatedRamp[MAX_PLAYERS];
  24.  
  25. new Enabled[MAX_PLAYERS];
  26. new Ramp;
  27. new Pers[MAX_PLAYERS];
  28.  
  29. public OnFilterScriptInit()
  30. {
  31.     print("\n----------------------------------");
  32.     print(" [FS] Ramping by Jeffry - Loaded -");
  33.     print("----------------------------------\n");
  34.     return 1;
  35. }
  36.  
  37. public OnFilterScriptExit()
  38. {
  39.     new i = 0;
  40.     while(i < MAX_PLAYERS)
  41.     {
  42.         CreatedRamp[i] = false;
  43.         DestroyPlayerObject(i, Ramp);
  44.         i++;
  45.     }
  46.     return 1;
  47. }
  48.  
  49. public OnPlayerDisconnect(playerid)
  50. {
  51.     if(CreatedRamp[playerid] == true) DestroyPlayerObject(playerid, Ramp), CreatedRamp[playerid] = false;
  52.     CreatedRamp[playerid] = false;
  53.     Enabled[playerid]=0;
  54.     Pers[playerid]=0;
  55.     return 1;
  56. }
  57.  
  58. public OnPlayerConnect(playerid)
  59. {
  60.     Enabled[playerid]=0;
  61.     Pers[playerid]=0;
  62.     return 1;
  63. }
  64.  
  65. public OnPlayerCommandText(playerid, cmdtext[])
  66. {
  67.     if (strcmp("/ramping", cmdtext, true, 10) == 0)
  68.     {
  69.     if(Enabled[playerid] == 1)
  70.     {SendClientMessage(playerid, 0xFFFF00FF, "Ramping disabled!");
  71.      Enabled[playerid]=0;
  72.      Pers[playerid]=0;
  73.      return 1;
  74.     }
  75.     if(Enabled[playerid] == 0)
  76.     {
  77.         SendClientMessage(playerid, 0xFFFF00FF, "Ramping enabled!");
  78.         SendClientMessage(playerid, 0xFFFF00FF, "Press the Special Action Key ( Strg or Alt Gr ) to create a ramp!");
  79.         Enabled[playerid]=1;
  80.         Pers[playerid]=1655;
  81.         return 1;
  82.     }
  83.   }
  84.  
  85.     if (strcmp("/my ramp 1", cmdtext, true, 10) == 0)
  86.     {
  87.     if(Enabled[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "You have to enable ramping first! (/ramping)!");
  88.     SendClientMessage(playerid, 0xFFFF00FF, "Ramp changed to Type 1!");
  89.     Pers[playerid]=1655;
  90.     return 1;
  91.     }
  92.  
  93.     if (strcmp("/my ramp 2", cmdtext, true, 10) == 0)
  94.     {
  95.     if(Enabled[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "You have to enable ramping first! (/ramping)!");
  96.     SendClientMessage(playerid, 0xFFFF00FF, "Ramp changed to Type 2!");
  97.     Pers[playerid]=1632;
  98.     return 1;
  99.     }
  100.  
  101.     if (strcmp("/my ramp 3", cmdtext, true, 10) == 0)
  102.     {
  103.     if(Enabled[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "You have to enable ramping first! (/ramping)!");
  104.     SendClientMessage(playerid, 0xFFFF00FF, "Ramp changed to Type 3!");
  105.     Pers[playerid]=1631;
  106.     return 1;
  107.     }
  108.  
  109.    
  110.     if (strcmp("/my ramp 4", cmdtext, true, 10) == 0)
  111.     {
  112.     if(Enabled[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "You have to enable ramping first! (/ramping)!");
  113.     SendClientMessage(playerid, 0xFFFF00FF, "Ramp changed to Type 4!");
  114.     Pers[playerid]=8302;
  115.     return 1;
  116.     }
  117.  
  118.    
  119.     if (strcmp("/my ramp 5", cmdtext, true, 10) == 0)
  120.     {
  121.     if(Enabled[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "You have to enable ramping first! (/ramping)!");
  122.     SendClientMessage(playerid, 0xFFFF00FF, "Ramp changed to Type 5!");
  123.     Pers[playerid]=1503;
  124.     return 1;
  125.     }
  126.  
  127.     if (strcmp("/my ramp", cmdtext, true, 10) == 0)
  128.     {
  129.     SendClientMessage(playerid, 0xFF0000FF, "Usage:  /my ramp [1-5]!");
  130.     return 1;
  131.     }
  132.  
  133.     if (strcmp("/ramphelp", cmdtext, true, 10) == 0)
  134.     {
  135.     SendClientMessage(playerid, 0xFF0000FF, "Welcome to the Ramping-Info!");
  136.     SendClientMessage(playerid, 0xFFFFFFFF, "• Use /ramping to enable ramping.");
  137.     SendClientMessage(playerid, 0xFFFFFFFF, "• Use /my ramp [1-5] to change the type of your ramp.");
  138.     SendClientMessage(playerid, 0xFFFFFFFF, "• To create a ramp use Special Action Key ( ''Strg'' or ''Alt Gr'' )");
  139.     SendClientMessage(playerid, 0xFFFFFFFF, "• To disable ramping type /ramping again.");
  140.     SendClientMessage(playerid, 0xFFFF00FF, "This Filterscript was made by [WsR]RyDeR and Jeffry.");
  141.     return 1;
  142.     }
  143.  
  144.  
  145.    
  146.     return 0;
  147. }
  148.  
  149.  
  150. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  151. {
  152.   if(Enabled[playerid] == 1)
  153.    {
  154.     if (IsPlayerInAnyVehicle(playerid))
  155.     {
  156.         if((newkeys & KEY_ACTION) && !(oldkeys & KEY_ANALOG_UP))
  157.         {
  158.        
  159.  
  160.             switch(GetVehicleModel( GetPlayerVehicleID(playerid) )) {
  161.             case 592,577,511,512,593,520,553,476,519,460,513,487,488,548,425,417,497,563,447,469:
  162.             return 1;
  163.             }
  164.             if(CreatedRamp[playerid] == true) DestroyPlayerObject(playerid, Ramp), CreatedRamp[playerid] = false;
  165.             new Float:pX,Float:pY,Float:pZ,Float:vA, Arabam = GetPlayerVehicleID(playerid);
  166.             GetVehiclePos(Arabam, pX, pY, pZ);
  167.             GetVehicleZAngle(Arabam, vA);
  168.             Ramp = CreatePlayerObject(playerid, Pers[playerid], pX + (20.0 * floatsin(-vA, degrees)), pY + (20.0 * floatcos(-vA, degrees)), pZ, 0, 0, vA);
  169.             CreatedRamp[playerid] = true;
  170.             SetTimerEx("destroy", 4000,0,"d",playerid);
  171.         }
  172.       }
  173.     }
  174.   return 1;
  175. }
  176.  
  177.  
  178. forward destroy(playerid);
  179. public destroy(playerid)
  180. {
  181. if(CreatedRamp[playerid]==true) {
  182.         return DestroyPlayerObject(playerid, Ramp), CreatedRamp[playerid] = false;
  183. }else return 0;
  184. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement