Guest User

Untitled

a guest
Apr 16th, 2013
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.87 KB | None | 0 0
  1. //By CraigChrist8239
  2. //A list of perk names:
  3. /*
  4. "specialty_gpsjammer"
  5. "specialty_bulletaccuracy"
  6. "specialty_fastreload"
  7. "specialty_rof"
  8. "specialty_holdbreath"
  9. "specialty_bulletpenetration"
  10. "specialty_grenadepulldeath"
  11. "specialty_pistoldeath"
  12. "specialty_quieter"
  13. "specialty_parabolic"
  14. "specialty_longersprint"
  15. "specialty_detectexplosive"
  16. "specialty_exposeenemy"
  17. "specialty_bulletdamage"
  18. "specialty_extraammo"
  19. "specialty_twoprimaries"
  20. "specialty_armorvest"
  21. "specialty_fraggrenade"
  22. "specialty_specialgrenade"
  23. "specialty_fastmantle"
  24. "specialty_jumpdive"
  25. "specialty_explosivebullets"
  26. "specialty_scavenger"
  27. "specialty_extendedmags"
  28. "specialty_lightweight"
  29. "specialty_marathon"
  30. "specialty_quickdraw"
  31. "specialty_coldblooded"
  32. "specialty_heartbreaker"
  33. "specialty_selectivehearing"
  34. "specialty_fastsnipe"
  35. "specialty_improvedholdbreath"
  36. "specialty_spygame"
  37. "specialty_automantle"
  38. "specialty_fastsprintrecovery"
  39. "specialty_extendedmelee"
  40. */
  41.  
  42. typedef unsigned int (__cdecl * BG_GetPerkIndexForName_t)(const char *perkName);
  43. BG_GetPerkIndexForName_t BG_GetPerkIndexForName = (BG_GetPerkIndexForName_t)0x820D1700;
  44.      
  45. //"Reversed" from TU8
  46. void setPerk(int clientIndex, char * perkName, bool isCodePerk = false)
  47. {
  48.     //Code perks do not work with this...
  49.     if(!isCodePerk)
  50.     {
  51.         unsigned int perkIndex = BG_GetPerkIndexForName(perkName),
  52.             player = 0x82F03600 + (clientIndex*0x280);
  53.      
  54.         __asm
  55.         {
  56.             mr                r31, player
  57.             lwz       r11, 0x158(r31)
  58.             rlwinm    r9, perkIndex, 29,3,29
  59.             clrlwi    r8, perkIndex, 27
  60.             addi      r11, r11, 0x428
  61.             li        r7, 1
  62.             rlwinm    r10, perkIndex, 29,3,29
  63.             slw       r6, r7, r8
  64.             lwzx      r5, r9, r11
  65.             or        r4, r5, r6
  66.             stwx      r4, r9, r11
  67.             lwz       r11, 0x158(r31)
  68.             addi      r11, r11, 0x32BC
  69.             lwzx      r3, r10, r11
  70.             or        r9, r6, r3
  71.             stwx      r9, r10, r11
  72.         }
  73.     }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment