Guest User

Untitled

a guest
Mar 18th, 2012
111
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Index: mods/deathmatch/logic/CClientGame.cpp
  2. ===================================================================
  3. --- mods/deathmatch/logic/CClientGame.cpp (revision 3916)
  4. +++ mods/deathmatch/logic/CClientGame.cpp (working copy)
  5. @@ -2602,6 +2602,8 @@
  6. m_Events.AddEvent ( "onClientPlayerVoiceStop", "", NULL, false );
  7. m_Events.AddEvent ( "onClientPlayerStealthKill", "target", NULL, false );
  8. m_Events.AddEvent ( "onClientPlayerHitByWaterCannon", "vehicle", NULL, false );
  9. + m_Events.AddEvent ( "onClientPlayerPickupHit", "pickup, matchingDimension", NULL, false );
  10. + m_Events.AddEvent ( "onClientPlayerPickupLeave", "pickup, matchingDimension", NULL, false );
  11.  
  12. // Ped events
  13. m_Events.AddEvent ( "onClientPedDamage", "attacker, weapon, bodypart", NULL, false );
  14. Index: mods/shared_logic/CClientPickup.cpp
  15. ===================================================================
  16. --- mods/shared_logic/CClientPickup.cpp (revision 3916)
  17. +++ mods/shared_logic/CClientPickup.cpp (working copy)
  18. @@ -21,7 +21,7 @@
  19. // Initialize
  20. m_pManager = pManager;
  21. m_pPickupManager = pManager->GetPickupManager ();
  22. - m_usModel = usModel;
  23. + m_usModel = usModel;
  24. m_bVisible = true;
  25. m_pPickup = NULL;
  26. m_pObject = NULL;
  27. @@ -188,11 +188,19 @@
  28. {
  29. if ( IS_PLAYER ( &Entity ) )
  30. {
  31. - // Call the pickup hit event
  32. + bool bMatchingDimensions = (GetDimension () == Entity.GetDimension ()); // Matching dimensions?
  33. +
  34. + // Call the pickup hit event (source = pickup that was hit)
  35. CLuaArguments Arguments;
  36. - Arguments.PushElement ( &Entity ); // player that hit it
  37. - Arguments.PushBoolean ( ( GetDimension () == Entity.GetDimension () ) ); // matching dimension?
  38. + Arguments.PushElement ( &Entity ); // The element that hit the pickup
  39. + Arguments.PushBoolean ( bMatchingDimensions );
  40. CallEvent ( "onClientPickupHit", Arguments, true );
  41. +
  42. + // Call the player pickup hit (source = player that hit the pickup)
  43. + CLuaArguments Arguments2;
  44. + Arguments2.PushElement ( this ); // The pickup that was hit
  45. + Arguments2.PushBoolean ( bMatchingDimensions );
  46. + Entity.CallEvent ( "onClientPlayerPickupHit", Arguments2, true );
  47. }
  48. }
  49.  
  50. @@ -201,10 +209,18 @@
  51. {
  52. if ( IS_PLAYER ( &Entity ) )
  53. {
  54. - // Call the pickup leave event
  55. + bool bMatchingDimensions = (GetDimension () == Entity.GetDimension ()); // Matching dimensions?
  56. +
  57. + // Call the pickup leave event (source = the pickup that was left)
  58. CLuaArguments Arguments;
  59. - Arguments.PushElement ( &Entity ); // player that hit it
  60. - Arguments.PushBoolean ( ( GetDimension () == Entity.GetDimension () ) ); // matching dimension?
  61. - CallEvent ( "onClientPickupLeave", Arguments, true );
  62. + Arguments.PushElement ( &Entity ); // The element that left the pickup
  63. + Arguments.PushBoolean ( bMatchingDimensions );
  64. + CallEvent ( "onClientPickupLeave", Arguments, true);
  65. +
  66. + // Call the player pickup leave event (source = the player that left the pickup)
  67. + CLuaArguments Arguments2;
  68. + Arguments2.PushElement ( this ); // The pickup that was left (this)
  69. + Arguments2.PushBoolean ( bMatchingDimensions );
  70. + Entity.CallEvent ( "onClientPlayerPickupLeave", Arguments2, true );
  71. }
  72. }
RAW Paste Data