Advertisement
Guest User

asdawdaaaaa

a guest
Jan 10th, 2013
1,044
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.02 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. //This isn't a filterscript, nor an include. You must add this to your gamemode, etc..
  4. //Change all SetPlayerAttachedObject(...) with SetPlayerAttachedObjectE(...), except the one I have not.
  5. //Change all RemovePlayerAttachedObject(...) with RemovePlayerAttachedObjectE(...), except the one I have not.
  6. //You are done. Be nice and do good work, return0 aka Einstein
  7. #define PRESSED(%0) \
  8. (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  9. #define RELEASED(%0) \
  10. (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
  11.  
  12. enum pATTACHMENTS
  13. {
  14. Exists,
  15. ModelID,
  16. BoneID,
  17. Float:pOffsetX,
  18. Float:pOffsetY,
  19. Float:pOffsetZ,
  20. Float:pRotX,
  21. Float:pRotY,
  22. Float:pRotZ,
  23. Float:pScaleX,
  24. Float:pScaleY,
  25. Float:pScaleZ
  26. };
  27. new pAttachments[MAX_PLAYERS][10][pATTACHMENTS];
  28. new Attachments[MAX_PLAYERS];
  29.  
  30.  
  31.  
  32. public OnplayerConnect(playerid)
  33. {
  34. Attachments[playerid] = 0;
  35. for(new i = 0; i < 10; i++)
  36. pAttachments[playerid][i][Exists] = 0;
  37. return 1;
  38. }
  39.  
  40. public OnPlayerEditAttachedObject( playerid, response, index, modelid, boneid,
  41. Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ,
  42. Float:fRotX, Float:fRotY, Float:fRotZ,
  43. Float:fScaleX, Float:fScaleY, Float:fScaleZ )
  44. {
  45. SetPlayerAttachedObjectE(playerid,index,modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
  46. return 1;
  47. }
  48. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  49. {
  50. if(!IsPlayerInAnyVehicle(playerid))
  51. {
  52. if(PRESSED(KEY_HANDBRAKE))
  53. {
  54. if(GetPlayerWeapon(playerid) == WEAPON_ROCKETLAUNCHER || GetPlayerWeapon(playerid) == WEAPON_SNIPER
  55. || GetPlayerWeapon(playerid) == WEAPON_CAMERA || GetPlayerWeapon(playerid) == WEAPON_HEATSEEKER)
  56. {
  57. for(new i=0; i<10; i++)
  58. {
  59. RemovePlayerAttachedObject(playerid, i);
  60. }
  61. }
  62. PlayerInfo[playerid][Attachments][2] = 1;
  63. }
  64. if(RELEASED(KEY_HANDBRAKE))
  65. {
  66. for(new i=0; i<10; i++)
  67. {
  68. RemovePlayerAttachedObject(playerid, i);
  69. if(pAttachments[playerid][i][Exists])SetPlayerAttachedObject(playerid,i,pAttachments[playerid][i][ModelID],pAttachments[playerid][i][BoneID],
  70. pAttachments[playerid][i][pOffsetX],pAttachments[playerid][i][pOffsetY],pAttachments[playerid][i][pOffsetZ],
  71. pAttachments[playerid][i][pRotX],pAttachments[playerid][i][pRotY],pAttachments[playerid][i][pRotZ],
  72. pAttachments[playerid][i][pScaleX],pAttachments[playerid][i][pScaleY],pAttachments[playerid][i][pScaleZ]);
  73. }
  74. }
  75. }
  76. return 1;
  77. }
  78.  
  79. stock RemovePlayerAttachedObjectE(playerid, index)
  80. {
  81. pAttachments[playerid][index][Exists] = 0;
  82. RemovePlayerAttachedObject(playerid, index);
  83. }
  84. stock SetPlayerAttachedObjectE(playerid,index,modelid,boneid,
  85. Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ,
  86. Float:fRotX, Float:fRotY, Float:fRotZ,
  87. Float:fScaleX, Float:fScaleY, Float:fScaleZ )
  88. {
  89. pAttachments[playerid][index][Exists] = 1;
  90. pAttachments[playerid][index][ModelID] = modelid;
  91. pAttachments[playerid][index][BoneID] = boneid;
  92. pAttachments[playerid][index][pOffsetX] = fOffsetX;
  93. pAttachments[playerid][index][pOffsetY] = fOffsetY;
  94. pAttachments[playerid][index][pOffsetZ] = fOffsetZ;
  95. pAttachments[playerid][index][pRotX] = fRotX;
  96. pAttachments[playerid][index][pRotY] = fRotY;
  97. pAttachments[playerid][index][pRotZ] = fRotZ;
  98. pAttachments[playerid][index][pScaleX] = fScaleX;
  99. pAttachments[playerid][index][pScaleY] = fScaleY;
  100. pAttachments[playerid][index][pScaleZ] = fScaleZ;
  101.  
  102. SetPlayerAttachedObject(playerid,index,modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
  103. }
  104.  
  105. stock IsPlayerAiming(playerid) {
  106. new anim = GetPlayerAnimationIndex(playerid);
  107. if (((anim >= 1160) && (anim <= 1163)) || (anim == 1167) || (anim == 1365) ||
  108. (anim == 1643) || (anim == 1453) || (anim == 220)) return 1;
  109. return 0;
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement