pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

C++ pastebin - collaborative debugging tool View Help


Posted by Anonymous on Sun 6 Apr 22:49
report abuse | View followups from xxxxx | download | new post

  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 off bike v2.5 loaded ");
  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 off bike is now ~g~on", 5000, 5);
  71.                 return 1;
  72.         }
  73.         if (strcmp("/afoff", cmdtext, true) == 0)
  74.         {
  75.                 GameTextForPlayer(playerid, "~w~Anti fall off bike is now ~r~off", 5000, 5);
  76.                 Act[playerid] = 0;
  77.                 return 1;
  78.         }
  79.         return 0;
  80. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post