Guest User

Anti-Fall System bY Teddy

a guest
Aug 25th, 2014
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define FILTERSCRIPT
  4. #if defined FILTERSCRIPT
  5.  
  6. #define Driver 0
  7. #define Passanger 2
  8.  
  9. new Act[MAX_PLAYERS];
  10. new InCar[MAX_PLAYERS];
  11. new WhatCar[MAX_PLAYERS];
  12.  
  13. public OnFilterScriptInit()
  14. {
  15. print("--------------------------------");
  16. print(" Anti fall of bike bY Teddy ");
  17. print("--------------------------------");
  18. return 1;
  19. }
  20.  
  21. #endif
  22.  
  23. public OnPlayerExitVehicle(playerid, vehicleid)
  24. {
  25. InCar[playerid] = 0;
  26. return 1;
  27. }
  28.  
  29. public OnPlayerStateChange(playerid, newstate, oldstate)
  30. {
  31. if(Act[playerid] == 1)
  32. {
  33. if(oldstate == PLAYER_STATE_DRIVER)
  34. {
  35. if(newstate == PLAYER_STATE_ONFOOT)
  36. {
  37. if(InCar[playerid] == 1)
  38. {
  39. PutPlayerInVehicle(playerid, WhatCar[playerid], Driver);
  40. }
  41. }
  42. }
  43. if(oldstate == PLAYER_STATE_PASSENGER)
  44. {
  45. if(newstate == PLAYER_STATE_ONFOOT)
  46. {
  47. if(InCar[playerid] == 1)
  48. {
  49. PutPlayerInVehicle(playerid, WhatCar[playerid], Passanger);
  50. }
  51. }
  52. }
  53. if(oldstate == PLAYER_STATE_ONFOOT)
  54. {
  55. if(newstate == PLAYER_STATE_DRIVER || PLAYER_STATE_PASSENGER)
  56. {
  57. InCar[playerid] = 1;
  58. WhatCar[playerid] = GetPlayerVehicleID(playerid);
  59. }
  60. }
  61. }
  62. return 1;
  63. }
  64.  
  65. public OnPlayerCommandText(playerid, cmdtext[])
  66. {
  67. if (strcmp("/afon", cmdtext, true) == 0)
  68. {
  69. Act[playerid] = 1;
  70. GameTextForPlayer(playerid, "~w~Anti fall ~g~activated", 5000, 5);
  71. return 1;
  72. }
  73. if (strcmp("/afoff", cmdtext, true) == 0)
  74. {
  75. GameTextForPlayer(playerid, "~w~Anti fall ~r~dezactivated", 5000, 5);
  76. Act[playerid] = 0;
  77. return 1;
  78. }
  79. return 0;
  80. }
Advertisement
Add Comment
Please, Sign In to add comment