como colocar condicion.
#1

Hola amigos del samp como puedo acomodar la condicion para que no me de el arma RPG, quise pornerlo asi, pero me da error:

pawn Код:
case 357: GivePlayerWeapon(playerid, 33, AMMO); // Country Rifle
case 358: GivePlayerWeapon(playerid, 34, AMMO); // Sniper Rifle
    case 359: // arma RPG
           
           if ( AMMO == 35 )
                {
                GivePlayerWeapon(playerid, 14 , 1); // me da unas flores por escoger la RPG :D
                    SendClientMessage(playerid, rojo, "No seas noob!");
                }
case 360: GivePlayerWeapon(playerid, 36, AMMO); // otra arma me da
me sale este error:

pawn Код:
C:\Users\User\Desktop\Server  (15929) : warning 205: redundant code: constant expression is zero
gracias
Reply
#2

Abre llaves.

pawn Код:
case 357: GivePlayerWeapon(playerid, 33, AMMO); // Country Rifle
case 358: GivePlayerWeapon(playerid, 34, AMMO); // Sniper Rifle
case 359:
{        // arma RPG
    if ( AMMO == 35)
    {
        GivePlayerWeapon(playerid, 14 , 1);
        SendClientMessage(playerid, rojo, "No seas noob!");
    }
}
Reply
#3

Quote:
Originally Posted by jotajeda
Посмотреть сообщение
Abre llaves.

pawn Код:
case 357: GivePlayerWeapon(playerid, 33, AMMO); // Country Rifle
case 358: GivePlayerWeapon(playerid, 34, AMMO); // Sniper Rifle
case 359:
{        // arma RPG
    if ( AMMO == 35)
    {
        GivePlayerWeapon(playerid, 14 , 1);
        SendClientMessage(playerid, rojo, "No seas noob!");
    }
}
me sigue saliendo que:
pawn Код:
C:\Users\User\Desktop\Server  (15929) : warning 205: redundant code: constant expression is zero
la cual es esta parte

pawn Код:
if ( AMMO == 35)
    {
Reply
#4

Quote:
Originally Posted by Zodiaco
Посмотреть сообщение
me sigue saliendo que:
pawn Код:
C:\Users\User\Desktop\Server  (15929) : warning 205: redundant code: constant expression is zero
la cual es esta parte

pawn Код:
if ( AMMO == 35)
    {
Pasa toda la funciуn porque asi no se sabe que mismo serб tal cosa.
Reply
#5

Quote:
Originally Posted by jotajeda
Посмотреть сообщение
Pasa toda la funciуn porque asi no se sabe que mismo serб tal cosa.
ok perdon aqui esta toda mi funcion:

pawn Код:
if(listid == gunlist)
    {
        if(response)
        {
       
        if (GetPlayerMoney(playerid) < 999) return PlayerPlaySound(playerid, 1085,0.0,0.0,0.0),GameTextForPlayer(playerid,"~y~Te falta dinero para comprar",5000,3);
            switch(modelid)
            {
                case 331: GivePlayerWeapon(playerid, 1, AMMO); // Brass Knuckles
                case 333: GivePlayerWeapon(playerid, 2, AMMO); // Golf Club
                case 334: GivePlayerWeapon(playerid, 3, AMMO); // Nightstick
                case 335: GivePlayerWeapon(playerid, 4, AMMO); // Knife
                case 336: GivePlayerWeapon(playerid, 5, AMMO); // Baseball Bat
                case 337: GivePlayerWeapon(playerid, 6, AMMO); // Shovel
                case 338: GivePlayerWeapon(playerid, 7, AMMO); // Pool Cue
                case 339: GivePlayerWeapon(playerid, 8, AMMO); // Katana
                case 341: GivePlayerWeapon(playerid, 9, AMMO); // Chainsaw
                case 321: GivePlayerWeapon(playerid, 10, AMMO); // Double-ended Dildo
                case 325: GivePlayerWeapon(playerid, 14, AMMO); // Flowers
                case 326: GivePlayerWeapon(playerid, 15, AMMO); // Cane
                //case 342: GivePlayerWeapon(playerid, 16, AMMO); // Grenade
                case 343: GivePlayerWeapon(playerid, 17, AMMO); // Tear Gas
                case 344: GivePlayerWeapon(playerid, 18, AMMO); // Molotov Cocktail
                case 346: GivePlayerWeapon(playerid, 22, AMMO); // 9mm
                case 347: GivePlayerWeapon(playerid, 23, AMMO); // Silenced 9mm
                case 348: GivePlayerWeapon(playerid, 24, AMMO); // Desert Eagle
                case 349: GivePlayerWeapon(playerid, 25, AMMO); // Shotgun
                case 350: GivePlayerWeapon(playerid, 26, AMMO); // Sawnoff
                case 351: GivePlayerWeapon(playerid, 27, AMMO); // Combat Shotgun
                case 352: GivePlayerWeapon(playerid, 28, AMMO); // Micro SMG/Uzi
                case 353: GivePlayerWeapon(playerid, 29, AMMO); // MP5
                case 355: GivePlayerWeapon(playerid, 30, AMMO); // AK-47
                case 356: GivePlayerWeapon(playerid, 31, AMMO); // M4
                case 372: GivePlayerWeapon(playerid, 32, AMMO); // Tec-9
                case 357: GivePlayerWeapon(playerid, 33, AMMO); // Country Rifle
                case 358: GivePlayerWeapon(playerid, 34, AMMO); // Sniper Rifle
                //case 359: GivePlayerWeapon(playerid, 35, AMMO); // RPG
                //case 360: GivePlayerWeapon(playerid, 36, AMMO); // HS Rocket
                case 361: GivePlayerWeapon(playerid, 37, AMMO); // Flamethrower
                //case 362: GivePlayerWeapon(playerid, 38, AMMO); // Minigun
                case 363: { GivePlayerWeapon(playerid, 39, AMMO); GivePlayerWeapon(playerid, 40, 1); }// Satchel Charge + Detonator
                case 365: GivePlayerWeapon(playerid, 41, AMMO); // Spraycan
                case 366: GivePlayerWeapon(playerid, 42, AMMO); // Fire Extinguisher
            }
            SendClientMessage(playerid, 0xFFFF00FF, "Has comprado arma y te costo 1000$");
            GivePlayerMoney(playerid, -1000);
            IsUsingSuperSniper[playerid] = 1; //super sniper
        }
        else SendClientMessage(playerid, 0xFF0000FF, "Cerrastes el catalogo de armas.");
        return 1;
    }
Reply
#6

pawn Код:
if(listid == gunlist)
{
    if(response)
    {
        if(GetPlayerMoney(playerid) < 999) return PlayerPlaySound(playerid, 1085,0.0,0.0,0.0),GameTextForPlayer(playerid,"~y~Te falta dinero para comprar",5000,3);
            switch(modelid)
            {
                case 331: GivePlayerWeapon(playerid, 1, AMMO); // Brass Knuckles
                case 333: GivePlayerWeapon(playerid, 2, AMMO); // Golf Club
                case 334: GivePlayerWeapon(playerid, 3, AMMO); // Nightstick
                case 335: GivePlayerWeapon(playerid, 4, AMMO); // Knife
                case 336: GivePlayerWeapon(playerid, 5, AMMO); // Baseball Bat
                case 337: GivePlayerWeapon(playerid, 6, AMMO); // Shovel
                case 338: GivePlayerWeapon(playerid, 7, AMMO); // Pool Cue
                case 339: GivePlayerWeapon(playerid, 8, AMMO); // Katana
                case 341: GivePlayerWeapon(playerid, 9, AMMO); // Chainsaw
                case 321: GivePlayerWeapon(playerid, 10, AMMO); // Double-ended Dildo
                case 325: GivePlayerWeapon(playerid, 14, AMMO); // Flowers
                case 326: GivePlayerWeapon(playerid, 15, AMMO); // Cane
                //case 342: GivePlayerWeapon(playerid, 16, AMMO); // Grenade
                case 343: GivePlayerWeapon(playerid, 17, AMMO); // Tear Gas
                case 344: GivePlayerWeapon(playerid, 18, AMMO); // Molotov Cocktail
                case 346: GivePlayerWeapon(playerid, 22, AMMO); // 9mm
                case 347: GivePlayerWeapon(playerid, 23, AMMO); // Silenced 9mm
                case 348: GivePlayerWeapon(playerid, 24, AMMO); // Desert Eagle
                case 349: GivePlayerWeapon(playerid, 25, AMMO); // Shotgun
                case 350: GivePlayerWeapon(playerid, 26, AMMO); // Sawnoff
                case 351: GivePlayerWeapon(playerid, 27, AMMO); // Combat Shotgun
                case 352: GivePlayerWeapon(playerid, 28, AMMO); // Micro SMG/Uzi
                case 353: GivePlayerWeapon(playerid, 29, AMMO); // MP5
                case 355: GivePlayerWeapon(playerid, 30, AMMO); // AK-47
                case 356: GivePlayerWeapon(playerid, 31, AMMO); // M4
                case 372: GivePlayerWeapon(playerid, 32, AMMO); // Tec-9
                case 357: GivePlayerWeapon(playerid, 33, AMMO); // Country Rifle
                case 358: GivePlayerWeapon(playerid, 34, AMMO); // Sniper Rifle
                case 359:
                {
                    GivePlayerWeapon(playerid, 14 , 1);
                    SendClientMessage(playerid, rojo, "No seas noob!");
                }
                //case 360: GivePlayerWeapon(playerid, 36, AMMO); // HS Rocket
                case 361: GivePlayerWeapon(playerid, 37, AMMO); // Flamethrower
                //case 362: GivePlayerWeapon(playerid, 38, AMMO); // Minigun
                case 363: { GivePlayerWeapon(playerid, 39, AMMO); GivePlayerWeapon(playerid, 40, 1); }// Satchel Charge + Detonator
                case 365: GivePlayerWeapon(playerid, 41, AMMO); // Spraycan
                case 366: GivePlayerWeapon(playerid, 42, AMMO); // Fire Extinguisher
            }
            SendClientMessage(playerid, 0xFFFF00FF, "Has comprado arma y te costo 1000$");
            GivePlayerMoney(playerid, -1000);
            IsUsingSuperSniper[playerid] = 1; //super sniper
        }
        else SendClientMessage(playerid, 0xFF0000FF, "Cerrastes el catalogo de armas.");
        return 1;
    }
Reply
#7

Quote:
Originally Posted by jotajeda
Посмотреть сообщение
pawn Код:
if(listid == gunlist)
{
    if(response)
    {
        if(GetPlayerMoney(playerid) < 999) return PlayerPlaySound(playerid, 1085,0.0,0.0,0.0),GameTextForPlayer(playerid,"~y~Te falta dinero para comprar",5000,3);
            switch(modelid)
            {
                case 331: GivePlayerWeapon(playerid, 1, AMMO); // Brass Knuckles
                case 333: GivePlayerWeapon(playerid, 2, AMMO); // Golf Club
                case 334: GivePlayerWeapon(playerid, 3, AMMO); // Nightstick
                case 335: GivePlayerWeapon(playerid, 4, AMMO); // Knife
                case 336: GivePlayerWeapon(playerid, 5, AMMO); // Baseball Bat
                case 337: GivePlayerWeapon(playerid, 6, AMMO); // Shovel
                case 338: GivePlayerWeapon(playerid, 7, AMMO); // Pool Cue
                case 339: GivePlayerWeapon(playerid, 8, AMMO); // Katana
                case 341: GivePlayerWeapon(playerid, 9, AMMO); // Chainsaw
                case 321: GivePlayerWeapon(playerid, 10, AMMO); // Double-ended Dildo
                case 325: GivePlayerWeapon(playerid, 14, AMMO); // Flowers
                case 326: GivePlayerWeapon(playerid, 15, AMMO); // Cane
                //case 342: GivePlayerWeapon(playerid, 16, AMMO); // Grenade
                case 343: GivePlayerWeapon(playerid, 17, AMMO); // Tear Gas
                case 344: GivePlayerWeapon(playerid, 18, AMMO); // Molotov Cocktail
                case 346: GivePlayerWeapon(playerid, 22, AMMO); // 9mm
                case 347: GivePlayerWeapon(playerid, 23, AMMO); // Silenced 9mm
                case 348: GivePlayerWeapon(playerid, 24, AMMO); // Desert Eagle
                case 349: GivePlayerWeapon(playerid, 25, AMMO); // Shotgun
                case 350: GivePlayerWeapon(playerid, 26, AMMO); // Sawnoff
                case 351: GivePlayerWeapon(playerid, 27, AMMO); // Combat Shotgun
                case 352: GivePlayerWeapon(playerid, 28, AMMO); // Micro SMG/Uzi
                case 353: GivePlayerWeapon(playerid, 29, AMMO); // MP5
                case 355: GivePlayerWeapon(playerid, 30, AMMO); // AK-47
                case 356: GivePlayerWeapon(playerid, 31, AMMO); // M4
                case 372: GivePlayerWeapon(playerid, 32, AMMO); // Tec-9
                case 357: GivePlayerWeapon(playerid, 33, AMMO); // Country Rifle
                case 358: GivePlayerWeapon(playerid, 34, AMMO); // Sniper Rifle
                case 359:
                {
                    GivePlayerWeapon(playerid, 14 , 1);
                    SendClientMessage(playerid, rojo, "No seas noob!");
                }
                //case 360: GivePlayerWeapon(playerid, 36, AMMO); // HS Rocket
                case 361: GivePlayerWeapon(playerid, 37, AMMO); // Flamethrower
                //case 362: GivePlayerWeapon(playerid, 38, AMMO); // Minigun
                case 363: { GivePlayerWeapon(playerid, 39, AMMO); GivePlayerWeapon(playerid, 40, 1); }// Satchel Charge + Detonator
                case 365: GivePlayerWeapon(playerid, 41, AMMO); // Spraycan
                case 366: GivePlayerWeapon(playerid, 42, AMMO); // Fire Extinguisher
            }
            SendClientMessage(playerid, 0xFFFF00FF, "Has comprado arma y te costo 1000$");
            GivePlayerMoney(playerid, -1000);
            IsUsingSuperSniper[playerid] = 1; //super sniper
        }
        else SendClientMessage(playerid, 0xFF0000FF, "Cerrastes el catalogo de armas.");
        return 1;
    }
muchas gracias no pense que era sin if e.e +rept
Reply
#8

Код:
C:\Users\User\Desktop\Server  (15929) : warning 205: redundant code: constant expression is zero
Se refiere a que tu cуdigo es constante, que el resultado del if siempre serб 0.

pawn Код:
//Este cуdigo es imposible que se cumpla y saltarнa ese warning.
if(10 == 15) {

}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)