Advertisement
Guest User

Spikes

a guest
Apr 6th, 2010
623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.30 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. #define FILTERSCRIPT
  4.  
  5. new Float:x, Float:y, Float:z;
  6. new Float:rz;
  7. new spike;
  8. new Spikes;
  9.  
  10. #include <a_samp>
  11.  
  12. #if defined FILTERSCRIPT
  13.  
  14. public OnFilterScriptInit()
  15. {
  16.     return 1;
  17. }
  18.  
  19. public OnFilterScriptExit()
  20. {
  21.     DestroyObject(spike);
  22.     return 1;
  23. }
  24. #endif
  25.  
  26. public OnPlayerCommandText(playerid, cmdtext[])
  27. {
  28.     if (!strcmp("/spike", cmdtext))
  29.     {
  30.         if(Spikes == 0)
  31.         {
  32.         GetPlayerPos(playerid,x,y,z);
  33.         GetPlayerFacingAngle(playerid, rz);
  34.         spike = CreateObject(2892, x, y, z-0.8, 0, 0, rz+90);
  35.         SendClientMessage(playerid, 0xFFFFFFFF, "Spike Strip Set!");
  36.         Spikes = 1;
  37.         }
  38.         else
  39.         {
  40.         SendClientMessage(playerid, 0xFFFFFFFF, "There Is Already A Spike Strip Set!");
  41.         }
  42.         return 1;
  43.     }
  44.     return 0;
  45. }
  46.  
  47. encode_tires(tire1, tire2, tire3, tire4) {
  48.  
  49.     return tire1 | (tire2 << 1) | (tire3 << 2) | (tire4 << 3);
  50. }
  51.  
  52. public OnPlayerUpdate(playerid)
  53. {
  54.     if(IsPlayerInAnyVehicle(playerid))
  55.     {
  56.     if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z))
  57.     {
  58.     UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid), 0, 0, 0, encode_tires(1, 1, 1, 1));
  59.     DestroyObject(spike);
  60.     Spikes = 0;
  61.     }
  62.     }
  63.     return 1;
  64.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement