Guest User

Untitled

a guest
Aug 8th, 2013
517
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <a_samp>
  2.  
  3. static armedbody_pTick[MAX_PLAYERS];
  4. public OnFilterScriptInit(){
  5. printf("=====================================================================");
  6. printf("This is a part of a OpenGTA subject, visit opengta.org for more info.");
  7. printf("FilterScript Name: Armed body");
  8. printf("Description:Attatch weapond to player's body");
  9. printf("Author:yezizhu");
  10. printf("Special thanks:Double-O-Seven, Brian.");
  11. printf("Contact author: imyezizhu@gmail.com");
  12. printf("=====================================================================");
  13. return true;
  14. }
  15. public OnFilterScriptExit() return true;
  16. public OnPlayerUpdate(playerid){
  17. if(GetTickCount() - armedbody_pTick[playerid] > 113){ //prefix check itter
  18. new
  19. weaponid[13],weaponammo[13],pArmedWeapon;
  20. pArmedWeapon = GetPlayerWeapon(playerid);
  21. GetPlayerWeaponData(playerid,1,weaponid[1],weaponammo[1]);
  22. GetPlayerWeaponData(playerid,2,weaponid[2],weaponammo[2]);
  23. GetPlayerWeaponData(playerid,4,weaponid[4],weaponammo[4]);
  24. GetPlayerWeaponData(playerid,5,weaponid[5],weaponammo[5]);
  25. GetPlayerWeaponData(playerid,7,weaponid[7],weaponammo[7]);
  26. if(weaponid[1] && weaponammo[1] > 0){
  27. if(pArmedWeapon != weaponid[1]){
  28. if(!IsPlayerAttachedObjectSlotUsed(playerid,0)){
  29. SetPlayerAttachedObject(playerid,0,GetWeaponModel(weaponid[1]),1, 0.199999, -0.139999, 0.030000, 0.500007, -115.000000, 0.000000, 1.000000, 1.000000, 1.000000);
  30. }
  31. }
  32. else {
  33. if(IsPlayerAttachedObjectSlotUsed(playerid,0)){
  34. RemovePlayerAttachedObject(playerid,0);
  35. }
  36. }
  37. }
  38. else if(IsPlayerAttachedObjectSlotUsed(playerid,0)){
  39. RemovePlayerAttachedObject(playerid,0);
  40. }
  41. if(weaponid[2] && weaponammo[2] > 0){
  42. if(pArmedWeapon != weaponid[2]){
  43. if(!IsPlayerAttachedObjectSlotUsed(playerid,1)){
  44. SetPlayerAttachedObject(playerid,1,GetWeaponModel(weaponid[2]),8, -0.079999, -0.039999, 0.109999, -90.100006, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000);
  45. }
  46. }
  47. else {
  48. if(IsPlayerAttachedObjectSlotUsed(playerid,1)){
  49. RemovePlayerAttachedObject(playerid,1);
  50. }
  51. }
  52. }
  53. else if(IsPlayerAttachedObjectSlotUsed(playerid,1)){
  54. RemovePlayerAttachedObject(playerid,1);
  55. }
  56. if(weaponid[4] && weaponammo[4] > 0){
  57. if(pArmedWeapon != weaponid[4]){
  58. if(!IsPlayerAttachedObjectSlotUsed(playerid,2)){
  59. SetPlayerAttachedObject(playerid,2,GetWeaponModel(weaponid[4]),7, 0.000000, -0.100000, -0.080000, -95.000000, -10.000000, 0.000000, 1.000000, 1.000000, 1.000000);
  60. }
  61. }
  62. else {
  63. if(IsPlayerAttachedObjectSlotUsed(playerid,2)){
  64. RemovePlayerAttachedObject(playerid,2);
  65. }
  66. }
  67. }
  68. else if(IsPlayerAttachedObjectSlotUsed(playerid,2)){
  69. RemovePlayerAttachedObject(playerid,2);
  70. }
  71. if(weaponid[5] && weaponammo[5] > 0){
  72. if(pArmedWeapon != weaponid[5]){
  73. if(!IsPlayerAttachedObjectSlotUsed(playerid,3)){
  74. SetPlayerAttachedObject(playerid,3,GetWeaponModel(weaponid[5]),1, 0.200000, -0.119999, -0.059999, 0.000000, 206.000000, 0.000000, 1.000000, 1.000000, 1.000000);
  75. }
  76. }
  77. else {
  78. if(IsPlayerAttachedObjectSlotUsed(playerid,3)){
  79. RemovePlayerAttachedObject(playerid,3);
  80. }
  81. }
  82. }
  83. else if(IsPlayerAttachedObjectSlotUsed(playerid,3)){
  84. RemovePlayerAttachedObject(playerid,3);
  85. }
  86. if(weaponid[7] && weaponammo[7] > 0){
  87. if(pArmedWeapon != weaponid[7]){
  88. if(!IsPlayerAttachedObjectSlotUsed(playerid,4)){
  89. SetPlayerAttachedObject(playerid,4,GetWeaponModel(weaponid[7]),1,-0.100000, 0.000000, -0.100000, 84.399932, 112.000000, 10.000000, 1.099999, 1.000000, 1.000000);
  90. }
  91. }
  92. else {
  93. if(IsPlayerAttachedObjectSlotUsed(playerid,4)){
  94. RemovePlayerAttachedObject(playerid,4);
  95. }
  96. }
  97. }
  98. else if(IsPlayerAttachedObjectSlotUsed(playerid,4)){
  99. RemovePlayerAttachedObject(playerid,4);
  100. }
  101. armedbody_pTick[playerid] = GetTickCount();
  102. }
  103. return true;
  104. }
  105. stock GetWeaponModel(weaponid)
  106. {
  107. switch(weaponid)
  108. {
  109. case 1:
  110. return 331;
  111. case 2..8:
  112. return weaponid+331;
  113. case 9:
  114. return 341;
  115. case 10..15:
  116. return weaponid+311;
  117. case 16..18:
  118. return weaponid+326;
  119. case 22..29:
  120. return weaponid+324;
  121. case 30,31:
  122. return weaponid+325;
  123. case 32:
  124. return 372;
  125. case 46:
  126. return 371;
  127. }
  128. return 0;
  129. }
RAW Paste Data