Code not running.
#1

Hello, I'm trying a problem in the code but I can not, what's the problem? Simple, the player can drop only one item at a time, for example, I dropped one AK47 and can not drop another. I've debugged, there's no use.

Common questions.
What happens when you drop more than one item? Ae shows an error in the script, I will show what is not executed, I will show the part.

In short, a certain part of the code is not executed, so you can not drop more than one item at a time.


PHP код:
stock DroparArma(playeridArmaIDArmaAmmoFloat:XFloat:YFloat:Zworldinterior)
{
    new 
name[MAX_PLAYER_NAME], gunname[128];
    
GetWeaponName(ArmaIDgunnamesizeof(gunname));
    
GetPlayerName(playerid,name,sizeof(name));
    if(
ArmaID != && ArmaAmmo != 0)
    {
        for(new 
0sizeof(ArmasInfo); i++)
          {
              if(
ArmasInfo[i][ArmaPosX] == 0.0 && ArmasInfo[i][ArmaPosY] == 0.0 && ArmasInfo[i][ArmaPosZ] == 0.0)
              { 
//On that down line does not run
                  
ArmasInfo[i][ArmaInfo][0] = ArmaID;
                  
ArmasInfo[i][ArmaInfo][1] = ArmaAmmo;
                  
ArmasInfo[i][ArmaPosX] = X;
                  
ArmasInfo[i][ArmaPosY] = Y;
                  
ArmasInfo[i][ArmaPosZ] = Z;
                  
ArmasInfo[i][ArmaWorld] = world;
                  
ArmasInfo[i][ArmaInterior] = interior;
                  
                  
ApplyAnimation(playerid"BOMBER""BOM_PLANT_IN"10000.000000);
            
                  
ArmaDropada[i] = CreateObject(GetGunObjectID(ArmaID), XYZ-180.00.00.0world);
                
format(strglobalsizeof(strglobal), "%s\n(%d)"gunnameArmaAmmo);
                
ObjetoDropado2 Create3DTextLabel(strglobal, -1XYZ-13.0world0);
                
                
RemovePlayerWeapon(playeridGetPlayerWeapon(playerid));
                return 
1;
              }
              return 
1;
        }
        return 
1;
    }
    return 
1;

PHP код:
if(ArmasInfo[i][ArmaPosX] == 0.0 && ArmasInfo[i][ArmaPosY] == 0.0 && ArmasInfo[i][ArmaPosZ] == 0.0
Reply
#2

Код:
stock DroparArma(playerid, ArmaID, ArmaAmmo, Float:X, Float:Y, Float:Z, world, interior) 
{ 
    new name[MAX_PLAYER_NAME], gunname[128]; 
    GetWeaponName(ArmaID, gunname, sizeof(gunname)); 
    GetPlayerName(playerid,name,sizeof(name)); 
    if(ArmaID != 0 && ArmaAmmo != 0) 
    { 
        for(new i = 0; i < sizeof(ArmasInfo); i++) 
          { 
              if(ArmasInfo[i][ArmaPosX] == 0.0 && ArmasInfo[i][ArmaPosY] == 0.0 && ArmasInfo[i][ArmaPosZ] == 0.0) 
              { //On that down line does not run 
                  ArmasInfo[i][ArmaInfo][0] = ArmaID; 
                  ArmasInfo[i][ArmaInfo][1] = ArmaAmmo; 
                  ArmasInfo[i][ArmaPosX] = X; 
                  ArmasInfo[i][ArmaPosY] = Y; 
                  ArmasInfo[i][ArmaPosZ] = Z; 
                  ArmasInfo[i][ArmaWorld] = world; 
                  ArmasInfo[i][ArmaInterior] = interior; 
                   
                  ApplyAnimation(playerid, "BOMBER", "BOM_PLANT_IN", 10000.0, 0, 0, 0, 0, 0); 
             
                  ArmaDropada[i] = CreateObject(GetGunObjectID(ArmaID), X, Y, Z-1, 80.0, 0.0, 0.0, world); 

                format(strglobal, sizeof(strglobal), "%s\n(%d)", gunname, ArmaAmmo); 
                ObjetoDropado2 = Create3DTextLabel(strglobal, -1, X, Y, Z-1, 3.0, world, 0); 
                 
                RemovePlayerWeapon(playerid, GetPlayerWeapon(playerid)); 
                return 1; 
              } 
              return 1; // Remove this line 
        } 
        return 1; 
    } 
    return 1; 
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)