No le quita las armas al jugador [Ayuda!]
#1

Amigos hola tengo un problema que me gustaria me ayudaran, pasa que al usar el comando /vmaletero garma, al momento de guardar el arma en el maletero no se la quita al jugador se la multiplica por asi decirlo, y es en todos los demas comando que se usa para guardar armas, les dejare el comando.

pawn Код:
else if(!strcmp(opcion, "garma"))
    {
        if(slotid < 1 || slotid > 8)return Mensaje(playerid, COLOR_GRIS2, "USO: /maletero garma [slot 1 - 8]");
        if(!maletero[result][mbloqueo])return Mensaje(playerid, COLOR_GRIS2, "El maletero de este vehнculo estб actualmente cerrado.");
        if(!GetPlayerWeapon(playerid))return Mensaje(playerid, COLOR_GRIS2, "Usted no tiene ninguna arma en mano.");
        if(GetPlayerAmmo(playerid) < 50)return Mensaje(playerid, COLOR_GRIS2, "Usted no tiene suficiente municion, debe tener 50.");
        if(maletero[result][marma][slotid - 1])return Mensaje(playerid, COLOR_GRIS2, "El slot seleccionado ya estб siendo ocupado por otra arma.");

  maletero[result][marma][slotid - 1] = GetPlayerWeapon(playerid);
  darArma(playerid, maletero[result][marma][slotid - 1], -50);

        if(TieneMaleta(result))
        {
            DestroyDynamicObject(MaleteroObjetos[result][slotid - 1]);
            MaleteroObjetos[result][slotid - 1] = CreateDynamicObject(GunObjects[maletero[result][marma][slotid - 1]][0], 0, 0, -1000, 0, 0, 0);
            switch(slotid - 1)
            {
                case 0: AttachDynamicObjectToVehicle(MaleteroObjetos[result][0], result, 0.300000, -1.950000, 0.075000, 94.499977, 43.200004, -221.399856);
                case 1: AttachDynamicObjectToVehicle(MaleteroObjetos[result][1], result, 0.449999, -2.100000, 0.075000, 94.499977, 43.200004, -221.399856);
                case 2: AttachDynamicObjectToVehicle(MaleteroObjetos[result][2], result, 0.000000, -2.100000, 0.075000, 94.499977, 43.200004, -221.399856);
                case 3: AttachDynamicObjectToVehicle(MaleteroObjetos[result][3], result, -0.075000, -2.325000, 0.075000, 94.499977, 43.200004, -221.399856);
                case 4: AttachDynamicObjectToVehicle(MaleteroObjetos[result][4], result, 0.524999, -2.325000, 0.075000, 94.499977, 43.200004, -221.399856);
                case 5: AttachDynamicObjectToVehicle(MaleteroObjetos[result][5], result, 0.375000, -2.325000, 0.150000, 94.499977, 43.200004, -221.399856);
                case 6: AttachDynamicObjectToVehicle(MaleteroObjetos[result][6], result, -0.075000, -2.325000, 0.150000, 94.499977, 43.200004, -221.399856);
                case 7: AttachDynamicObjectToVehicle(MaleteroObjetos[result][7], result, 0.150000, -2.100000, 0.150000, 94.499977, 43.200004, -221.399856);
            }
        }
        format(string, sizeof(string), "Usted acaba de guardar una %s.", NombreArma(maletero[result][marma][slotid - 1]));
        Mensaje(playerid, COLOR_BLANCO, string);
        ActualizarMaletas(result);
    }
    else if(!strcmp(opcion, "sarma"))
    {
        if(slotid < 1 || slotid > 8)return Mensaje(playerid, COLOR_ROJO, "USO: /maletero garma (slot 1 - 8)");
        if(!maletero[result][mbloqueo])return Mensaje(playerid, COLOR_ROJO, "El maletero de este vehнculo estб actualmente cerrado.");
        if(!maletero[result][marma][slotid - 1])return Mensaje(playerid, COLOR_ROJO, "El maletero de este vehнculo no tiene un arma.");
        darArma(playerid, maletero[result][marma][slotid - 1], 50);

        format(string, sizeof(string), "Usted acaba de retirar una %s.", NombreArma(maletero[result][marma][slotid - 1]));
        Mensaje(playerid, COLOR_BLANCO, string);
        if(TieneMaleta(result))
        {
            DestroyDynamicObject(MaleteroObjetos[result][slotid - 1]);
        }
       
        maletero[result][marma][slotid - 1] = 0;
        ActualizarMaletas(result);
    }
Si alguien me pudiera ayuda.
Reply
#2

ayuda pls !
Reply
#3

pawn Код:
darArma(playerid, maletero[result][marma][slotid - 1], -50);
en garma estas dando un arma con un valor de municiуn negativa, es obvio que se va a multiplicar, para quitar un arma, usa esta siguiente funciуn (y quitando la que nombrй anteriormente).

pawn Код:
stock RemoverArma(playerid, weaponid)
{
    if(!GetWeaponSlot(weaponid)) return 0;
    new armas[13][2];
    for (new slot = 0; slot < 13; slot++)
    {
    GetPlayerWeaponData(playerid, slot, armas[slot][0], armas[slot][1]);
        ResetPlayerWeapons(playerid);
    if(weaponid != armas[slot][0] && slot!=GetWeaponSlot(weaponid)) DarArma(playerid, armas[slot][0], armas[slot][1]);
    }
    SetPlayerArmedWeapon(playerid, 0);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)