Guest User

Untitled

a guest
Jul 18th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. /*
  2. * Created: 02.02.11
  3. * Author: OKStyle
  4. * Description: Armour 2.3
  5. */
  6. #include <a_samp>
  7. #define COLOR_INTERFACE_BODY 0xFDE39DAA
  8. public OnPlayerCommandText(playerid, cmdtext[])
  9. {
  10. if(strcmp(cmdtext, "/equip", true, 6) == 0)
  11. {
  12. if(GetPVarInt(playerid, "Equipped") != 0) return SendClientMessage(playerid, COLOR_INTERFACE_BODY, "You are already equipped!");
  13. if(GetPlayerSkin(playerid) < 280 || GetPlayerSkin(playerid) > 288) return SendClientMessage(playerid, COLOR_INTERFACE_BODY, "This command is available only to the servants of the law.");
  14. SetPlayerAttachedObject(playerid, 1, 19142, 1, 0.1, 0.05, 0.0, 0.0, 0.0, 0.0);
  15. SetPlayerAttachedObject(playerid, 2, 19141, 2, 0.11, 0.0, 0.0, 0.0, 0.0, 0.0);
  16. SetPlayerAttachedObject(playerid, 3, 18637, 13, 0.35, 0.0, 0.0, 0.0, 0.0, 180.0);
  17. SetPlayerAttachedObject(playerid, 4, 18642, 7, 0.1, 0.0, -0.11, 0.0, -90.0, 90.0);
  18. GivePlayerWeapon(playerid, 3, 1);
  19. SetPlayerArmour(playerid, 100.0);
  20. SetPVarInt(playerid, "Equipped", 1);
  21. SendClientMessage(playerid, COLOR_INTERFACE_BODY, "You outfits.");
  22. return 1;
  23. }
  24. if(strcmp(cmdtext, "/equipoff", true, 9) == 0)
  25. {
  26. if(GetPVarInt(playerid, "Equipped") != 1) return SendClientMessage(playerid, COLOR_INTERFACE_BODY, "You already unequipped!");
  27. new Float:ap;
  28. GetPlayerArmour(playerid, ap);
  29. if(ap > 0)
  30. {
  31. RemovePlayerAttachedObject(playerid, 1);
  32. SetPlayerArmour(playerid, 0.0);
  33. }
  34. RemovePlayerAttachedObject(playerid, 2);
  35. RemovePlayerAttachedObject(playerid, 3);
  36. RemovePlayerAttachedObject(playerid, 4);
  37. new weapons[13][2];
  38. for (new i; i < 13; i++)
  39. {
  40. GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
  41. }
  42. ResetPlayerWeapons(playerid);
  43. for (new i; i < 13; i++)
  44. {
  45. if(i == 1) continue;
  46. GivePlayerWeapon(playerid, weapons[i][0], weapons[i][1]);
  47. }
  48. SetPVarInt(playerid, "Equipped", 0);
  49. SendClientMessage(playerid, COLOR_INTERFACE_BODY, "You undressed and disarmed.");
  50. return 1;
  51. }
  52. return 0;
  53. }
  54. public OnPlayerUpdate(playerid)
  55. {
  56. if(GetPVarInt(playerid, "Equipped") == 1)
  57. {
  58. RemovePlayerAttachedObject(playerid, 1);
  59. new Float:ap;
  60. GetPlayerArmour(playerid, ap);
  61. if(ap > 0) SetPlayerAttachedObject(playerid, 1, 19142, 1, 0.1, 0.05, 0.0, 0.0, 0.0, 0.0);
  62. }
  63. return 1;
  64. }
  65. public OnFilterScriptExit()
  66. {
  67. for(new i, j = GetMaxPlayers(); i != j; i++)
  68. {
  69. if(!IsPlayerConnected(i)) continue;
  70. if(IsPlayerNPC(i)) continue;
  71. if(GetPVarInt((i), "Equipped") != 1) continue;
  72. RemovePlayerAttachedObject(i, 1);
  73. RemovePlayerAttachedObject(i, 2);
  74. RemovePlayerAttachedObject(i, 3);
  75. RemovePlayerAttachedObject(i, 4);
  76. }
  77. return 1;
  78. }
Add Comment
Please, Sign In to add comment