Advertisement
Guest User

OnPlayerDriveBy

a guest
Sep 18th, 2011
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.66 KB | None | 0 0
  1. /*
  2.  *
  3.  * KoczkaHUN's OnPlayerDriveBy for SA:MP 0.3d R2 (and newer)
  4.  *
  5.  */
  6.  
  7. #if defined _KOPDB_included
  8.     #endinput
  9. #endif
  10. #define _KOPDB_included
  11.  
  12. // --------------------------------------[Defines]---------------------------------------------
  13.  
  14. forward OnPlayerDriveBy(playerid, victimid, iskill);
  15.  
  16. #define KOPDB_CallOPTD() \
  17.     CallLocalFunction("KOPDB_OnPlayerTakeDamage", "ddfd", playerid, issuerid, amount, weaponid)
  18.  
  19. #define KOPDB_CallOPD() \
  20.     CallLocalFunction("KOPDB_OnPlayerDeath", "ddd", playerid, killerid, reason)
  21.  
  22. // ---------------------------------[Coding from here]-----------------------------------------
  23.  
  24. new KOPDB_hasOPDB = 0,
  25.     KOPDB_hasOPTD = 0,
  26.     KOPDB_hasOPD = 0;
  27.  
  28. public OnFilterScriptInit()
  29. {
  30.     KOPDB_hasOPDB = (funcidx("OnPlayerDriveBy") != -1);
  31.     KOPDB_hasOPTD = (funcidx("KOPDB_OnPlayerTakeDamage") != -1);
  32.     KOPDB_hasOPD = (funcidx("KOPDB_OnPlayerDeath") != -1);
  33.  
  34.     if (funcidx("KOPDB_OnFilterScriptInit") != -1)
  35.         CallLocalFunction("KOPDB_OnFilterScriptInit", "");
  36. }
  37.  
  38. public OnGameModeInit()
  39. {
  40.     KOPDB_hasOPDB = (funcidx("OnPlayerDriveBy") != -1);
  41.     KOPDB_hasOPTD = (funcidx("KOPDB_OnPlayerTakeDamage") != -1);
  42.     KOPDB_hasOPD = (funcidx("KOPDB_OnPlayerDeath") != -1);
  43.  
  44.     if (funcidx("KOPDB_OnGameModeInit") != -1)
  45.         CallLocalFunction("KOPDB_OnGameModeInit", "");
  46. }
  47.  
  48. public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
  49. {
  50.     if (issuerid != INVALID_PLAYER_ID && weaponid == WEAPON_VEHICLE && KOPDB_hasOPDB)
  51.         CallLocalFunction("OnPlayerDriveBy", "ddd", issuerid, playerid, 0);
  52.  
  53.     return (KOPDB_hasOPTD) ? KOPDB_CallOPTD() : 0;
  54. }
  55.  
  56. public OnPlayerDeath(playerid, killerid, reason)
  57. {
  58.     if (killerid != INVALID_PLAYER_ID && reason == WEAPON_VEHICLE && KOPDB_hasOPDB)
  59.         CallLocalFunction("OnPlayerDriveBy", "ddd", killerid, playerid, 1);
  60.        
  61.     return (KOPDB_hasOPD) ? KOPDB_CallOPD() : 0;
  62. }
  63.  
  64. #if defined _ALS_OnPlayerTakeDamage
  65.     #undef OnPlayerTakeDamage
  66. #else
  67.     #define _ALS_OnPlayerTakeDamage
  68. #endif
  69. #define OnPlayerTakeDamage KOPDB_OnPlayerTakeDamage
  70.  
  71. #if defined _ALS_OnFilterScriptInit
  72.     #undef OnFilterScriptInit
  73. #else
  74.     #define _ALS_OnFilterScriptInit
  75. #endif
  76. #define OnFilterScriptInit KOPDB_OnFilterScriptInit
  77.  
  78. #if defined _ALS_OnGameModeInit
  79.     #undef OnGameModeInit
  80. #else
  81.     #define _ALS_OnGameModeInit
  82. #endif
  83. #define OnGameModeInit KOPDB_OnGameModeInit
  84.  
  85. #if defined _ALS_OnPlayerDeath
  86.     #undef OnPlayerDeath
  87. #else
  88.     #define _ALS_OnPlayerDeath
  89. #endif
  90. #define OnPlayerDeath KOPDB_OnPlayerDeath
  91.  
  92. forward KOPDB_OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid);
  93. forward KOPDB_OnFilterScriptInit();
  94. forward KOPDB_OnGameModeInit();
  95. forward KOPDB_OnPlayerDeath(playerid, killerid, reason);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement