Guest User

Armedbody

a guest
May 14th, 2011
6,719
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.50 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define ARMEDBODY_USE_HEAVY_WEAPON          (false)
  4.  
  5. static
  6.     armedbody_pTick[MAX_PLAYERS];
  7. public OnFilterScriptInit(){
  8.     printf("=====================================================================");
  9.     printf("This is a part of a OpenGTA subject, visit opengta.org for more info.");
  10.     printf("FilterScript Name: Armed body");
  11.     printf("Description:Attatch weapond to player's body");
  12.     printf("Author:yezizhu");
  13.     printf("Special thanks:Double-O-Seven, Brian.");
  14.     printf("Contact author: [email protected]");
  15.     printf("=====================================================================");
  16.     return true;
  17. }
  18. public OnFilterScriptExit(){
  19.     return true;
  20. }
  21. public OnPlayerUpdate(playerid){
  22.     if(GetTickCount() - armedbody_pTick[playerid] > 113){ //prefix check itter
  23.         new
  24.             weaponid[13],weaponammo[13],pArmedWeapon;
  25.         pArmedWeapon = GetPlayerWeapon(playerid);
  26.         GetPlayerWeaponData(playerid,1,weaponid[1],weaponammo[1]);
  27.         GetPlayerWeaponData(playerid,2,weaponid[2],weaponammo[2]);
  28.         GetPlayerWeaponData(playerid,4,weaponid[4],weaponammo[4]);
  29.         GetPlayerWeaponData(playerid,5,weaponid[5],weaponammo[5]);
  30.         #if ARMEDBODY_USE_HEAVY_WEAPON
  31.         GetPlayerWeaponData(playerid,7,weaponid[7],weaponammo[7]);
  32.         #endif
  33.         if(weaponid[1] && weaponammo[1] > 0){
  34.             if(pArmedWeapon != weaponid[1]){
  35.                 if(!IsPlayerAttachedObjectSlotUsed(playerid,0)){
  36.                     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);
  37.                 }
  38.             }
  39.             else {
  40.                 if(IsPlayerAttachedObjectSlotUsed(playerid,0)){
  41.                     RemovePlayerAttachedObject(playerid,0);
  42.                 }
  43.             }
  44.         }
  45.         else if(IsPlayerAttachedObjectSlotUsed(playerid,0)){
  46.             RemovePlayerAttachedObject(playerid,0);
  47.         }
  48.         if(weaponid[2] && weaponammo[2] > 0){
  49.             if(pArmedWeapon != weaponid[2]){
  50.                 if(!IsPlayerAttachedObjectSlotUsed(playerid,1)){
  51.                     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);
  52.                 }
  53.             }
  54.             else {
  55.                 if(IsPlayerAttachedObjectSlotUsed(playerid,1)){
  56.                     RemovePlayerAttachedObject(playerid,1);
  57.                 }
  58.             }
  59.         }
  60.         else if(IsPlayerAttachedObjectSlotUsed(playerid,1)){
  61.             RemovePlayerAttachedObject(playerid,1);
  62.         }
  63.         if(weaponid[4] && weaponammo[4] > 0){
  64.             if(pArmedWeapon != weaponid[4]){
  65.                 if(!IsPlayerAttachedObjectSlotUsed(playerid,2)){
  66.                     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);
  67.                 }
  68.             }
  69.             else {
  70.                 if(IsPlayerAttachedObjectSlotUsed(playerid,2)){
  71.                     RemovePlayerAttachedObject(playerid,2);
  72.                 }
  73.             }
  74.         }
  75.         else if(IsPlayerAttachedObjectSlotUsed(playerid,2)){
  76.             RemovePlayerAttachedObject(playerid,2);
  77.         }
  78.         if(weaponid[5] && weaponammo[5] > 0){
  79.             if(pArmedWeapon != weaponid[5]){
  80.                 if(!IsPlayerAttachedObjectSlotUsed(playerid,3)){
  81.                     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);
  82.                 }
  83.             }
  84.             else {
  85.                 if(IsPlayerAttachedObjectSlotUsed(playerid,3)){
  86.                     RemovePlayerAttachedObject(playerid,3);
  87.                 }
  88.             }
  89.         }
  90.         else if(IsPlayerAttachedObjectSlotUsed(playerid,3)){
  91.             RemovePlayerAttachedObject(playerid,3);
  92.         }
  93.         #if ARMEDBODY_USE_HEAVY_WEAPON
  94.         if(weaponid[7] && weaponammo[7] > 0){
  95.             if(pArmedWeapon != weaponid[7]){
  96.                 if(!IsPlayerAttachedObjectSlotUsed(playerid,4)){
  97.                     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);
  98.                 }
  99.             }
  100.             else {
  101.                 if(IsPlayerAttachedObjectSlotUsed(playerid,4)){
  102.                     RemovePlayerAttachedObject(playerid,4);
  103.                 }
  104.             }
  105.         }
  106.         else if(IsPlayerAttachedObjectSlotUsed(playerid,4)){
  107.             RemovePlayerAttachedObject(playerid,4);
  108.         }
  109.         #endif
  110.         armedbody_pTick[playerid] = GetTickCount();
  111.     }
  112.     return true;
  113. }
  114.  
  115.    
  116.    
  117. //by Double-O-Seven
  118. stock GetWeaponModel(weaponid)
  119. {
  120.     switch(weaponid)
  121.     {
  122.         case 1:
  123.             return 331;
  124.  
  125.         case 2..8:
  126.             return weaponid+331;
  127.  
  128.         case 9:
  129.             return 341;
  130.  
  131.         case 10..15:
  132.             return weaponid+311;
  133.  
  134.         case 16..18:
  135.             return weaponid+326;
  136.  
  137.         case 22..29:
  138.             return weaponid+324;
  139.  
  140.         case 30,31:
  141.             return weaponid+325;
  142.  
  143.         case 32:
  144.             return 372;
  145.  
  146.         case 33..45:
  147.             return weaponid+324;
  148.  
  149.         case 46:
  150.             return 371;
  151.     }
  152.     return 0;
  153. }
Advertisement
Add Comment
Please, Sign In to add comment