Advertisement
OKStyle

Equip

Oct 19th, 2011
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.68 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++) GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
  39.         ResetPlayerWeapons(playerid);
  40.         for (new i; i < 13; i++)
  41.         {
  42.             if(i == 1) continue;
  43.             GivePlayerWeapon(playerid, weapons[i][0], weapons[i][1]);
  44.         }
  45.         SetPVarInt(playerid, "Equipped", 0);
  46.         SendClientMessage(playerid, COLOR_INTERFACE_BODY, "You undressed and disarmed.");
  47.         return 1;
  48.     }
  49.     return 0;
  50. }
  51. public OnPlayerUpdate(playerid)
  52. {
  53.     if(GetPVarInt(playerid, "Equipped") == 1)
  54.     {
  55.         RemovePlayerAttachedObject(playerid, 1);
  56.         new Float:ap;
  57.         GetPlayerArmour(playerid, ap);
  58.         if(ap > 0) SetPlayerAttachedObject(playerid, 1, 19142,  1, 0.1,  0.05, 0.0,  0.0,   0.0,   0.0);
  59.     }
  60.     return 1;
  61. }
  62. public OnFilterScriptExit()
  63. {
  64.     for(new i, j = GetMaxPlayers(); i != j; i++)
  65.     {
  66.         if(!IsPlayerConnected(i)) continue;
  67.         if(IsPlayerNPC(i)) continue;
  68.         if(GetPVarInt(i, "Equipped") != 1) continue;
  69.         RemovePlayerAttachedObject(i, 1);
  70.         RemovePlayerAttachedObject(i, 2);
  71.         RemovePlayerAttachedObject(i, 3);
  72.         RemovePlayerAttachedObject(i, 4);
  73.     }
  74.     return 1;
  75. }
  76.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement