Guest User

Untitled

a guest
Jan 23rd, 2011
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.57 KB | None | 0 0
  1. //In cima alla tua GM:
  2. #define VIOLA 0xC2A2DAAA
  3. new munizioni;
  4. new arma;
  5. new bool:pieno[MAX_PLAYERS];
  6.  
  7. //OnPlayerCommandText
  8.  
  9. public OnPlayerCommandText(playerid, cmdtext[])
  10. {
  11.     if (strcmp("/mettizaino", cmdtext, true) == 0)
  12.     {
  13.         new string[128];
  14.         new nome[MAX_PLAYER_NAME];
  15.         munizioni = GetPlayerAmmo(playerid);
  16.         arma = GetPlayerWeapon(playerid);
  17.         if(munizioni == 0 && arma == 0) return SendClientMessage(playerid, 0xFF000000, "* Non hai nessuna arma da mettere!!!");
  18.         if(pieno[playerid] == true) return SendClientMessage(playerid, 0xFF000000, "* Zaino Pieno!!!");
  19.         RemovePlayerWeapon(playerid, arma);
  20.         GetPlayerName(playerid,nome,30);
  21.         format(string, 128, "* %s prende un arma e la mette nello zaino.", nome);
  22.                 ProxDetector(10.0, playerid, string, VIOLA,VIOLA,VIOLA,VIOLA,VIOLA);
  23.         pieno[playerid] = true;
  24.         return 1;
  25.     }
  26.     if (strcmp("/prendizaino", cmdtext, true) == 0)
  27.     {
  28.                 new string[128];
  29.         new nome[MAX_PLAYER_NAME];
  30.         if(pieno[playerid] == false) return SendClientMessage(playerid, 0xFF000000, "* Non hai nessuna arma nello zaino!!!");
  31.         GivePlayerWeapon(playerid, arma, munizioni);
  32.         GetPlayerName(playerid,nome,30);
  33.         format(string, 128, "* %s prende un arma dallo zaino.", nome);
  34.                 ProxDetector(10.0, playerid, string, VIOLA,VIOLA,VIOLA,VIOLA,VIOLA);
  35.                 munizioni = 0;
  36.         arma = 0;
  37.         pieno[playerid] = false;
  38.         return 1;
  39.     }
  40.         if (strcmp("/aprizaino", cmdtext, true) == 0)
  41.     {
  42.         new nomearma[32], string[64], string2[128],nome[MAX_PLAYER_NAME];
  43.         GetWeaponName(arma,nomearma,32);
  44.         GetPlayerName(playerid,nome,30);
  45.         if(pieno[playerid] == false) return SendClientMessage(playerid, 0xFF000000, "* Non hai nessuna arma nello zaino!!!");
  46.         SendClientMessage(playerid, 0xFF0000FF, "-----------------------------------");
  47.         format(string,128,"Attuale arma nello zaino: %s  Munizioni: %d", nomearma, munizioni);
  48.         SendClientMessage(playerid, 0xFFFFFFFF, string);
  49.         SendClientMessage(playerid, 0xFF0000FF, "-----------------------------------");
  50.         format(string2, 128, "* %s apre lo zaino e guarda il suo contenuto.", nome);
  51.                 ProxDetector(10.0, playerid, string2, VIOLA,VIOLA,VIOLA,VIOLA,VIOLA);
  52.         return 1;
  53.     }
  54.     return 0;
  55. }
  56.  
  57. //In Fondo alla tua GM:
  58. forward RemovePlayerWeapon(playerid, weaponid);
  59. public RemovePlayerWeapon(playerid, weaponid)
  60. {
  61.     new plyWeapons[12] = 0;
  62.     new plyAmmo[12] = 0;
  63.     for(new slot = 0; slot != 12; slot++)
  64.     {
  65.         new wep, ammo;
  66.         GetPlayerWeaponData(playerid, slot, wep, ammo);
  67.  
  68.         if(wep != weaponid && ammo != 0)
  69.         {
  70.             GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]);
  71.         }
  72.     }
  73.  
  74.     ResetPlayerWeapons(playerid);
  75.     for(new slot = 0; slot != 12; slot++)
  76.     {
  77.         if(plyAmmo[slot] != 0)
  78.         {
  79.             GivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot]);
  80.         }
  81.     }
  82.     return 1;
  83. }
  84. forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
  85. public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  86. {
  87.     if(IsPlayerConnected(playerid))
  88.     {
  89.         new Float:posx, Float:posy, Float:posz;
  90.         new Float:oldposx, Float:oldposy, Float:oldposz;
  91.         new Float:tempposx, Float:tempposy, Float:tempposz;
  92.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  93.         for(new i = 0; i < MAX_PLAYERS; i++)
  94.         {
  95.             if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
  96.             {
  97.                     GetPlayerPos(i, posx, posy, posz);
  98.                     tempposx = (oldposx -posx);
  99.                     tempposy = (oldposy -posy);
  100.                     tempposz = (oldposz -posz);
  101.                     if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
  102.                     {
  103.                         SendClientMessage(i, col1, string);
  104.                     }
  105.                     else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  106.                     {
  107.                         SendClientMessage(i, col2, string);
  108.                     }
  109.                     else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  110.                     {
  111.                         SendClientMessage(i, col3, string);
  112.                     }
  113.                     else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  114.                     {
  115.                         SendClientMessage(i, col4, string);
  116.                     }
  117.                     else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  118.                     {
  119.                         SendClientMessage(i, col5, string);
  120.                     }
  121.             }
  122.         }
  123.     }
  124.     return 1;
  125. }
Advertisement
Add Comment
Please, Sign In to add comment