Problema con precacheo y seteo de damage -solucionado-
#1
ZP 4.3
Código PHP:
if (!g_survivor[attacker]) 
        {
                static 
plrWeapId
                
if (is_user_connected(attacker) || is_user_bot(attacker))
                
plrWeapId get_user_weapon(attacker)

            static 
i
            
for(0MAX_PRIMARIASi++) 
            {
                if (
g_primarias[attacker] && get_weaponid Armasp[i][PITEMS] == plrWeapId)
                {
                    
damage *= Armasp[i][PDAMAGE]
                }
            }
            for(
0MAX_SECUNDARIASi++) 
            {
                if (
g_secundarias[attacker] && get_weaponid(Armass[i][PITEMS]) == plrWeapId)
                {
                    
damage *= Armass[i][PDAMAGE]
                }
            }
        } 
Responder
#2
el precache no es por arrays....

Código PHP:
for(0MAX_PRIMARIASi++) 
    {
        
precache_model(Armasp[i][PMODEL]) 
    }
    for(
0MAX_SECUNDARIASi++) 
    {
        
precache_model(Armass[i][PMODEL])
    } 

y el otro pasa la public entera del fw_takedamage
Responder
#3
(04/01/2019, 11:26 AM)GoldenCosta escribió: el precache no es por arrays....

Código PHP:
for(0MAX_PRIMARIASi++) 
    {
        
precache_model(Armasp[i][PMODEL]) 
    }
    for(
0MAX_SECUNDARIASi++) 
    {
        
precache_model(Armass[i][PMODEL])
    } 

y el otro pasa la public entera del fw_takedamage

Código PHP:
public fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    
// Non-player damage or self damage
    
if (victim == attacker || !is_user_valid_connected(attacker))
        return 
HAM_IGNORED;
    
    
// New round starting or round ended
    
if (g_newround || g_endround)
        return 
HAM_SUPERCEDE;
    
    
// Victim shouldn't take damage or victim is frozen
    
if (g_nodamage[victim] || g_frozen[victim])
        return 
HAM_SUPERCEDE;
    
    
// Prevent friendly fire
    
if (g_zombie[attacker] == g_zombie[victim])
        return 
HAM_SUPERCEDE;
    
//a
    
kDamage[attacker] += floatround(damage)
        
    while(
kDamage[attacker] >= DMG_NECESARIO
        { 
// Mientras el daño infligido sea igual o mayor al daño necesario
        
kDamage[attacker] -= DMG_NECESARIO // Le restamos el valor de la definición DMG_NECESARIO(1200) a kDamage
        
setExpattacker WINEXP ); // Le damos la exp por dmg
        

    
    
// Attacker is human...
    
if (!g_zombie[attacker])
    {
        if (!
g_survivor[attacker]) 
        {
            static 
plrWeapId
            
if (is_user_connected(attacker) || is_user_bot(attacker))
                
plrWeapId get_user_weapon(attacker)

            static 
i
            
for(0MAX_PRIMARIASi++) 
            {
                if (
g_primarias[attacker][i] && get_weaponid(Armasp[i][PITEMS]) == plrWeapId)
                {
                    
SetHamParamFloat(4damage *= Armasp[i][PDAMAGE])
                }
            }
            for(
0MAX_SECUNDARIASi++) 
            {
                if (
g_secundarias[attacker][i] && get_weaponid(Armass[i][PITEMS]) == plrWeapId)
                {
                    
SetHamParamFloat(4damage *= Armass[i][PDAMAGE])
                }
            }
        }
  
        
damage *= ResetDamage(kReset[attacker])
        
        
//mg
        
kDamage[attacker] += floatround(damage)
        
        while(
kDamage[attacker] >= DMG_NECESARIO
        { 
// Mientras el daño infligido sea igual o mayor al daño necesario
        
kDamage[attacker] -= DMG_NECESARIO // Le restamos el valor de la definición DMG_NECESARIO(1200) a kDamage
        
setExpattacker WINEXP ); // Le damos la exp por dmg
        

        
// Armor multiplier for the final damage on normal zombies
        
if (!g_nemesis[victim])
        {
            
damage *= get_pcvar_float(cvar_zombiearmor)
            
SetHamParamFloat(4damage)
        }
        
        
// Reward ammo packs to humans for damaging zombies?
        
if ((get_pcvar_num(cvar_ammodamage_human) > 0) && (!g_survivor[attacker] || !get_pcvar_num(cvar_survignoreammo)))
        {
            
// Store damage dealt
            
g_damagedealt_human[attacker] += floatround(damage)
            
            
// Reward ammo packs for every [ammo damage] dealt
            
while (g_damagedealt_human[attacker] > get_pcvar_num(cvar_ammodamage_human))
            {
                
g_ammopacks[attacker]++
                
g_damagedealt_human[attacker] -= get_pcvar_num(cvar_ammodamage_human)
            }
        }
        
        return 
HAM_IGNORED;
    }
    
    
// Attacker is zombie...
    
    // Prevent infection/damage by HE grenade (bugfix)
    
if (damage_type DMG_HEGRENADE)
        return 
HAM_SUPERCEDE;
    
    
// Nemesis?
    
if (g_nemesis[attacker])
    {
        
// Ignore nemesis damage override if damage comes from a 3rd party entity
        // (to prevent this from affecting a sub-plugin's rockets e.g.)
        
if (inflictor == attacker)
        {
            
// Set nemesis damage
            
SetHamParamFloat(4get_pcvar_float(cvar_nemdamage))
        }
        
        return 
HAM_IGNORED;
    }
    
    
// Reward ammo packs to zombies for damaging humans?
    
if (get_pcvar_num(cvar_ammodamage_zombie) > 0)
    {
        
// Store damage dealt
        
g_damagedealt_zombie[attacker] += floatround(damage)
        
        
// Reward ammo packs for every [ammo damage] dealt
        
while (g_damagedealt_zombie[attacker] > get_pcvar_num(cvar_ammodamage_zombie))
        {
            
g_ammopacks[attacker]++
            
g_damagedealt_zombie[attacker] -= get_pcvar_num(cvar_ammodamage_zombie)
        }
    }
    
    
// Last human or not an infection round
    
if (g_survround || g_nemround || g_swarmround || g_plagueround || fnGetHumans() == 1)
        return 
HAM_IGNORED// human is killed
    
    // Does human armor need to be reduced before infecting?
    
if (get_pcvar_num(cvar_humanarmor))
    {
        
// Get victim armor
        
static Float:armor
        pev
(victimpev_armorvaluearmor)
        
        
// If he has some, block the infection and reduce armor instead
        
if (armor 0.0)
        {
            
emit_sound(victimCHAN_BODYsound_armorhit1.0ATTN_NORM0PITCH_NORM)
            if (
armor damage 0.0)
                
set_pev(victimpev_armorvaluearmor damage)
            else
                
cs_set_user_armor(victim0CS_ARMOR_NONE)
            return 
HAM_SUPERCEDE;
        }
    }
    
    
// Infection allowed
    
zombieme(victimattacker001// turn into zombie
    
return HAM_SUPERCEDE;

Responder
#4
Código PHP:
public fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    
// Non-player damage or self damage
    
if (victim == attacker || !is_user_valid_connected(attacker))
        return 
HAM_IGNORED;
    
    
// New round starting or round ended
    
if (g_newround || g_endround)
        return 
HAM_SUPERCEDE;
    
    
// Victim shouldn't take damage or victim is frozen
    
if (g_nodamage[victim] || g_frozen[victim])
        return 
HAM_SUPERCEDE;
    
    
// Prevent friendly fire
    
if (g_zombie[attacker] == g_zombie[victim])
        return 
HAM_SUPERCEDE;
    
//a
    
kDamage[attacker] += floatround(damage)
    
    while(
kDamage[attacker] >= DMG_NECESARIO
    { 
// Mientras el daño infligido sea igual o mayor al daño necesario
        
kDamage[attacker] -= DMG_NECESARIO // Le restamos el valor de la definición DMG_NECESARIO(1200) a kDamage
        
setExpattacker WINEXP ); // Le damos la exp por dmg
    

    
    
// Attacker is human...
    
if (!g_zombie[attacker])
    {
        if (
g_survivor[attacker]) 
        {
            
// mas daño para el survivor si se te antoja
        
}
        else 
// si no es survivor sera humano
        
{
            static 
plrWeapId
            
if (is_user_connected(attacker) || is_user_bot(attacker))
                
plrWeapId get_user_weapon(attacker)
            
            static 
i
            
for(0MAX_PRIMARIASi++) 
            {
                if (
g_primarias[attacker][i] && get_weaponid(Armasp[i][PITEMS]) == plrWeapId)
                {
                    
SetHamParamFloat(4damage *= Armasp[i][PDAMAGE])
                }
            }
            for(
0MAX_SECUNDARIASi++) 
            {
                if (
g_secundarias[attacker][i] && get_weaponid(Armass[i][PITEMS]) == plrWeapId)
                {
                    
SetHamParamFloat(4damage *= Armass[i][PDAMAGE])
                }
            }
    }
        
        
damage *= ResetDamage(kReset[attacker])
        
        
//mg
        
kDamage[attacker] += floatround(damage)
        
        while(
kDamage[attacker] >= DMG_NECESARIO
        { 
// Mientras el daño infligido sea igual o mayor al daño necesario
            
kDamage[attacker] -= DMG_NECESARIO // Le restamos el valor de la definición DMG_NECESARIO(1200) a kDamage
            
setExpattacker WINEXP ); // Le damos la exp por dmg
        

        
// Armor multiplier for the final damage on normal zombies
        
if (!g_nemesis[victim])
        {
            
damage *= get_pcvar_float(cvar_zombiearmor)
            
SetHamParamFloat(4damage)
        }
        
        
// Reward ammo packs to humans for damaging zombies?
        
if ((get_pcvar_num(cvar_ammodamage_human) > 0) && (!g_survivor[attacker] || !get_pcvar_num(cvar_survignoreammo)))
        {
            
// Store damage dealt
            
g_damagedealt_human[attacker] += floatround(damage)
            
            
// Reward ammo packs for every [ammo damage] dealt
            
while (g_damagedealt_human[attacker] > get_pcvar_num(cvar_ammodamage_human))
            {
                
g_ammopacks[attacker]++
                
g_damagedealt_human[attacker] -= get_pcvar_num(cvar_ammodamage_human)
            }
        }
        
        return 
HAM_IGNORED;
    }
    
    
// Attacker is zombie...
    
    // Prevent infection/damage by HE grenade (bugfix)
    
if (damage_type DMG_HEGRENADE)
        return 
HAM_SUPERCEDE;
    
    
// Nemesis?
    
if (g_nemesis[attacker])
    {
        
// Ignore nemesis damage override if damage comes from a 3rd party entity
        // (to prevent this from affecting a sub-plugin's rockets e.g.)
        
if (inflictor == attacker)
        {
            
// Set nemesis damage
            
SetHamParamFloat(4get_pcvar_float(cvar_nemdamage))
        }
        
        return 
HAM_IGNORED;
    }
    
    
// Reward ammo packs to zombies for damaging humans?
    
if (get_pcvar_num(cvar_ammodamage_zombie) > 0)
    {
        
// Store damage dealt
        
g_damagedealt_zombie[attacker] += floatround(damage)
        
        
// Reward ammo packs for every [ammo damage] dealt
        
while (g_damagedealt_zombie[attacker] > get_pcvar_num(cvar_ammodamage_zombie))
        {
            
g_ammopacks[attacker]++
            
g_damagedealt_zombie[attacker] -= get_pcvar_num(cvar_ammodamage_zombie)
        }
    }
    
    
// Last human or not an infection round
    
if (g_survround || g_nemround || g_swarmround || g_plagueround || fnGetHumans() == 1)
        return 
HAM_IGNORED// human is killed
    
    // Does human armor need to be reduced before infecting?
    
if (get_pcvar_num(cvar_humanarmor))
    {
        
// Get victim armor
        
static Float:armor
        pev
(victimpev_armorvaluearmor)
        
        
// If he has some, block the infection and reduce armor instead
        
if (armor 0.0)
        {
            
emit_sound(victimCHAN_BODYsound_armorhit1.0ATTN_NORM0PITCH_NORM)
            if (
armor damage 0.0)
                
set_pev(victimpev_armorvaluearmor damage)
            else
                
cs_set_user_armor(victim0CS_ARMOR_NONE)
            return 
HAM_SUPERCEDE;
        }
    }
    
    
// Infection allowed
    
zombieme(victimattacker001// turn into zombie
    
return HAM_SUPERCEDE;

Responder
#5
(04/01/2019, 11:37 AM)GoldenCosta escribió:
Código PHP:
public fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    
// Non-player damage or self damage
    
if (victim == attacker || !is_user_valid_connected(attacker))
        return 
HAM_IGNORED;
    
    
// New round starting or round ended
    
if (g_newround || g_endround)
        return 
HAM_SUPERCEDE;
    
    
// Victim shouldn't take damage or victim is frozen
    
if (g_nodamage[victim] || g_frozen[victim])
        return 
HAM_SUPERCEDE;
    
    
// Prevent friendly fire
    
if (g_zombie[attacker] == g_zombie[victim])
        return 
HAM_SUPERCEDE;
    
//a
    
kDamage[attacker] += floatround(damage)
    
    while(
kDamage[attacker] >= DMG_NECESARIO
    { 
// Mientras el daño infligido sea igual o mayor al daño necesario
        
kDamage[attacker] -= DMG_NECESARIO // Le restamos el valor de la definición DMG_NECESARIO(1200) a kDamage
        
setExpattacker WINEXP ); // Le damos la exp por dmg
    

    
    
// Attacker is human...
    
if (!g_zombie[attacker])
    {
        if (
g_survivor[attacker]) 
        {
            
// mas daño para el survivor si se te antoja
        
}
        else 
// si no es survivor sera humano
        
{
            static 
plrWeapId
            
if (is_user_connected(attacker) || is_user_bot(attacker))
                
plrWeapId get_user_weapon(attacker)
            
            static 
i
            
for(0MAX_PRIMARIASi++) 
            {
                if (
g_primarias[attacker][i] && get_weaponid(Armasp[i][PITEMS]) == plrWeapId)
                {
                    
SetHamParamFloat(4damage *= Armasp[i][PDAMAGE])
                }
            }
            for(
0MAX_SECUNDARIASi++) 
            {
                if (
g_secundarias[attacker][i] && get_weaponid(Armass[i][PITEMS]) == plrWeapId)
                {
                    
SetHamParamFloat(4damage *= Armass[i][PDAMAGE])
                }
            }
    }
        
        
damage *= ResetDamage(kReset[attacker])
        
        
//mg
        
kDamage[attacker] += floatround(damage)
        
        while(
kDamage[attacker] >= DMG_NECESARIO
        { 
// Mientras el daño infligido sea igual o mayor al daño necesario
            
kDamage[attacker] -= DMG_NECESARIO // Le restamos el valor de la definición DMG_NECESARIO(1200) a kDamage
            
setExpattacker WINEXP ); // Le damos la exp por dmg
        

        
// Armor multiplier for the final damage on normal zombies
        
if (!g_nemesis[victim])
        {
            
damage *= get_pcvar_float(cvar_zombiearmor)
            
SetHamParamFloat(4damage)
        }
        
        
// Reward ammo packs to humans for damaging zombies?
        
if ((get_pcvar_num(cvar_ammodamage_human) > 0) && (!g_survivor[attacker] || !get_pcvar_num(cvar_survignoreammo)))
        {
            
// Store damage dealt
            
g_damagedealt_human[attacker] += floatround(damage)
            
            
// Reward ammo packs for every [ammo damage] dealt
            
while (g_damagedealt_human[attacker] > get_pcvar_num(cvar_ammodamage_human))
            {
                
g_ammopacks[attacker]++
                
g_damagedealt_human[attacker] -= get_pcvar_num(cvar_ammodamage_human)
            }
        }
        
        return 
HAM_IGNORED;
    }
    
    
// Attacker is zombie...
    
    // Prevent infection/damage by HE grenade (bugfix)
    
if (damage_type DMG_HEGRENADE)
        return 
HAM_SUPERCEDE;
    
    
// Nemesis?
    
if (g_nemesis[attacker])
    {
        
// Ignore nemesis damage override if damage comes from a 3rd party entity
        // (to prevent this from affecting a sub-plugin's rockets e.g.)
        
if (inflictor == attacker)
        {
            
// Set nemesis damage
            
SetHamParamFloat(4get_pcvar_float(cvar_nemdamage))
        }
        
        return 
HAM_IGNORED;
    }
    
    
// Reward ammo packs to zombies for damaging humans?
    
if (get_pcvar_num(cvar_ammodamage_zombie) > 0)
    {
        
// Store damage dealt
        
g_damagedealt_zombie[attacker] += floatround(damage)
        
        
// Reward ammo packs for every [ammo damage] dealt
        
while (g_damagedealt_zombie[attacker] > get_pcvar_num(cvar_ammodamage_zombie))
        {
            
g_ammopacks[attacker]++
            
g_damagedealt_zombie[attacker] -= get_pcvar_num(cvar_ammodamage_zombie)
        }
    }
    
    
// Last human or not an infection round
    
if (g_survround || g_nemround || g_swarmround || g_plagueround || fnGetHumans() == 1)
        return 
HAM_IGNORED// human is killed
    
    // Does human armor need to be reduced before infecting?
    
if (get_pcvar_num(cvar_humanarmor))
    {
        
// Get victim armor
        
static Float:armor
        pev
(victimpev_armorvaluearmor)
        
        
// If he has some, block the infection and reduce armor instead
        
if (armor 0.0)
        {
            
emit_sound(victimCHAN_BODYsound_armorhit1.0ATTN_NORM0PITCH_NORM)
            if (
armor damage 0.0)
                
set_pev(victimpev_armorvaluearmor damage)
            else
                
cs_set_user_armor(victim0CS_ARMOR_NONE)
            return 
HAM_SUPERCEDE;
        }
    }
    
    
// Infection allowed
    
zombieme(victimattacker001// turn into zombie
    
return HAM_SUPERCEDE;

si usa una variable para cachear el arma sería mejor usar eso para acceder al array en lugar de un bucle
[Imagen: zcsztw-4.png] [Imagen: 6u5fj2-4.png]
[Imagen: linkedin_thumb_image.png][Imagen: 76561198283253977.png][Imagen: linkedin_thumb_image.png]
Responder
#6
Esta parte es la que me tira el error..
Código PHP:
if (g_primarias[attacker][i] && get_weaponid(Armasp[i][PITEMS]) == plrWeapId

(04/01/2019, 11:37 AM)GoldenCosta escribió:
Código PHP:
public fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    
// Non-player damage or self damage
    
if (victim == attacker || !is_user_valid_connected(attacker))
        return 
HAM_IGNORED;
    
    
// New round starting or round ended
    
if (g_newround || g_endround)
        return 
HAM_SUPERCEDE;
    
    
// Victim shouldn't take damage or victim is frozen
    
if (g_nodamage[victim] || g_frozen[victim])
        return 
HAM_SUPERCEDE;
    
    
// Prevent friendly fire
    
if (g_zombie[attacker] == g_zombie[victim])
        return 
HAM_SUPERCEDE;
    
//a
    
kDamage[attacker] += floatround(damage)
    
    while(
kDamage[attacker] >= DMG_NECESARIO
    { 
// Mientras el daño infligido sea igual o mayor al daño necesario
        
kDamage[attacker] -= DMG_NECESARIO // Le restamos el valor de la definición DMG_NECESARIO(1200) a kDamage
        
setExpattacker WINEXP ); // Le damos la exp por dmg
    

    
    
// Attacker is human...
    
if (!g_zombie[attacker])
    {
        if (
g_survivor[attacker]) 
        {
            
// mas daño para el survivor si se te antoja
        
}
        else 
// si no es survivor sera humano
        
{
            static 
plrWeapId
            
if (is_user_connected(attacker) || is_user_bot(attacker))
                
plrWeapId get_user_weapon(attacker)
            
            static 
i
            
for(0MAX_PRIMARIASi++) 
            {
                if (
g_primarias[attacker][i] && get_weaponid(Armasp[i][PITEMS]) == plrWeapId)
                {
                    
SetHamParamFloat(4damage *= Armasp[i][PDAMAGE])
                }
            }
            for(
0MAX_SECUNDARIASi++) 
            {
                if (
g_secundarias[attacker][i] && get_weaponid(Armass[i][PITEMS]) == plrWeapId)
                {
                    
SetHamParamFloat(4damage *= Armass[i][PDAMAGE])
                }
            }
    }
        
        
damage *= ResetDamage(kReset[attacker])
        
        
//mg
        
kDamage[attacker] += floatround(damage)
        
        while(
kDamage[attacker] >= DMG_NECESARIO
        { 
// Mientras el daño infligido sea igual o mayor al daño necesario
            
kDamage[attacker] -= DMG_NECESARIO // Le restamos el valor de la definición DMG_NECESARIO(1200) a kDamage
            
setExpattacker WINEXP ); // Le damos la exp por dmg
        

        
// Armor multiplier for the final damage on normal zombies
        
if (!g_nemesis[victim])
        {
            
damage *= get_pcvar_float(cvar_zombiearmor)
            
SetHamParamFloat(4damage)
        }
        
        
// Reward ammo packs to humans for damaging zombies?
        
if ((get_pcvar_num(cvar_ammodamage_human) > 0) && (!g_survivor[attacker] || !get_pcvar_num(cvar_survignoreammo)))
        {
            
// Store damage dealt
            
g_damagedealt_human[attacker] += floatround(damage)
            
            
// Reward ammo packs for every [ammo damage] dealt
            
while (g_damagedealt_human[attacker] > get_pcvar_num(cvar_ammodamage_human))
            {
                
g_ammopacks[attacker]++
                
g_damagedealt_human[attacker] -= get_pcvar_num(cvar_ammodamage_human)
            }
        }
        
        return 
HAM_IGNORED;
    }
    
    
// Attacker is zombie...
    
    // Prevent infection/damage by HE grenade (bugfix)
    
if (damage_type DMG_HEGRENADE)
        return 
HAM_SUPERCEDE;
    
    
// Nemesis?
    
if (g_nemesis[attacker])
    {
        
// Ignore nemesis damage override if damage comes from a 3rd party entity
        // (to prevent this from affecting a sub-plugin's rockets e.g.)
        
if (inflictor == attacker)
        {
            
// Set nemesis damage
            
SetHamParamFloat(4get_pcvar_float(cvar_nemdamage))
        }
        
        return 
HAM_IGNORED;
    }
    
    
// Reward ammo packs to zombies for damaging humans?
    
if (get_pcvar_num(cvar_ammodamage_zombie) > 0)
    {
        
// Store damage dealt
        
g_damagedealt_zombie[attacker] += floatround(damage)
        
        
// Reward ammo packs for every [ammo damage] dealt
        
while (g_damagedealt_zombie[attacker] > get_pcvar_num(cvar_ammodamage_zombie))
        {
            
g_ammopacks[attacker]++
            
g_damagedealt_zombie[attacker] -= get_pcvar_num(cvar_ammodamage_zombie)
        }
    }
    
    
// Last human or not an infection round
    
if (g_survround || g_nemround || g_swarmround || g_plagueround || fnGetHumans() == 1)
        return 
HAM_IGNORED// human is killed
    
    // Does human armor need to be reduced before infecting?
    
if (get_pcvar_num(cvar_humanarmor))
    {
        
// Get victim armor
        
static Float:armor
        pev
(victimpev_armorvaluearmor)
        
        
// If he has some, block the infection and reduce armor instead
        
if (armor 0.0)
        {
            
emit_sound(victimCHAN_BODYsound_armorhit1.0ATTN_NORM0PITCH_NORM)
            if (
armor damage 0.0)
                
set_pev(victimpev_armorvaluearmor damage)
            else
                
cs_set_user_armor(victim0CS_ARMOR_NONE)
            return 
HAM_SUPERCEDE;
        }
    }
    
    
// Infection allowed
    
zombieme(victimattacker001// turn into zombie
    
return HAM_SUPERCEDE;

Responder
#7
Pasame el error del amx
Responder
#8
(04/01/2019, 12:34 PM)GoldenCosta escribió: Pasame el error del amx

Código PHP:
ErrorExpected token")"but found "[" on line 2306
Error
Invalid expressionassumed zero on line 2306
Warning
Expression has no effect on line 2306
Error
Expected token";"but found "]" on line 2306
Error
Too many error messages on one line on line 2306 

Código PHP:
//2306 if (g_primarias[attacker][i] && get_weaponid(Armasp[i][PITEMS]) == plrWeapId) 
Responder
#9
te falta un ( al principio
Hi Milashkasiya CrabCrab

Soy un #Panda.. Soy solo un tipo que parece #común pero soy todo lo contrario; alguien #atípico en esta sociedad actual

[Imagen: xl0jvd-5.png]
Link
Responder
#10
(04/01/2019, 12:54 PM)[R]ak escribió: te falta un ( al principio
El if iria encerrado entre parentesis?
Porque de otra manera no comprendo donde iria el "(" ya razone, mira y trate de comprender el lugar.
Responder
#11
(04/01/2019, 01:10 PM)reloaD escribió:
(04/01/2019, 12:54 PM)[R]ak escribió: te falta un ( al principio
El if iria encerrado entre parentesis?
Porque de otra manera no comprendo donde iria el "(" ya razone, mira y trate de comprender el lugar.

No, en el if (palabra if) no, revisa bien, ve tus paréntesis.
Responder
#12
(04/01/2019, 01:10 PM)reloaD escribió:
(04/01/2019, 12:54 PM)[R]ak escribió: te falta un ( al principio
El if iria encerrado entre parentesis?
Porque de otra manera no comprendo donde iria el "(" ya razone, mira y trate de comprender el lugar.

tengo que dormir mas; y a van 2 veces que me salteo un (; revise todo el codigo y no vi nada que te pueda dar ese error; lo revise varias veces..

vas a tener que dejar el .sma para poder encontrar el error
Hi Milashkasiya CrabCrab

Soy un #Panda.. Soy solo un tipo que parece #común pero soy todo lo contrario; alguien #atípico en esta sociedad actual

[Imagen: xl0jvd-5.png]
Link
Responder
#13
(04/01/2019, 01:23 PM)[R]ak escribió:
(04/01/2019, 01:10 PM)reloaD escribió:
(04/01/2019, 12:54 PM)[R]ak escribió: te falta un ( al principio
El if iria encerrado entre parentesis?
Porque de otra manera no comprendo donde iria el "(" ya razone, mira y trate de comprender el lugar.

tengo que dormir mas; y a van 2 veces que me salteo un (; revise todo el codigo y no vi nada que te pueda dar ese error; lo revise varias veces..

vas a tener que dejar el .sma para poder encontrar el error

Si fue un acertijo, estoy mal para esos juegos.
Dejo el .sma de las armas con niveles y rr completo.
Hice prueba y error del paréntesis.


Archivos adjuntos
.sma   Descargar AMXX / armasNyR.sma (Tamaño: 10.67 KB / Descargas: 5)
Responder
#14
Código PHP:
public show_menu_buy1(taskid)
{
    
// Get player id
    
static id
    
(taskid 32) ? (id ID_SPAWN) : (id taskid);
    
    
// Zombies or survivors get no guns
    
if (g_zombie[id] || g_survivor[id] || !is_user_alive(id))
        return; 

te faltaba id en g_zombie; lo mire asi nomas porque como no puedo compilar, no me voy a quemar la cabeza porque queres guardar tu code
Hi Milashkasiya CrabCrab

Soy un #Panda.. Soy solo un tipo que parece #común pero soy todo lo contrario; alguien #atípico en esta sociedad actual

[Imagen: xl0jvd-5.png]
Link
Responder
#15
(04/01/2019, 02:02 PM)[R]ak escribió:
Código PHP:
public show_menu_buy1(taskid)
{
    
// Get player id
    
static id
    
(taskid 32) ? (id ID_SPAWN) : (id taskid);
    
    
// Zombies or survivors get no guns
    
if (g_zombie[id] || g_survivor[id] || !is_user_alive(id))
        return; 

te faltaba id en g_zombie; lo mire asi nomas porque como no puedo compilar, no me voy a quemar la cabeza porque queres guardar tu code
soy un idiota, entendi del code de las armas.
Se lo agregue, pero sigue siendo el mismo error en la misma linea, disculpa ..


Archivos adjuntos
.sma   Descargar AMXX / zparmas.sma (Tamaño: 11.71 KB / Descargas: 5)
Responder
#16
la verdad que no entiendo que estas haciendo... estas solo pegando dentro del code del zp las armas? sabes que tienes q modificar los menu y algunas nuevas variables?
Responder
#17
(04/01/2019, 03:43 PM)GoldenCosta escribió: la verdad que no entiendo que estas haciendo... estas solo pegando dentro del code del zp las armas? sabes que tienes q modificar los menu y algunas nuevas variables?
Solo segui el tutorial, estoy aprendiendo.
Responder
#18
donde sigue estando tu error a todo esto, por que con el code de las armas no se puede ver que es lo que esta fallando
Responder
#19
Cita:
Código PHP:
ErrorExpected token")"but found "[" on line 2306
Error
Invalid expressionassumed zero on line 2306
Warning
Expression has no effect on line 2306
Error
Expected token";"but found "]" on line 2306
Error
Too many error messages on one line on line 2306 

Código PHP:
//2306 if (g_primarias[attacker][i] && get_weaponid(Armasp[i][PITEMS]) == plrWeapId) 
Dice que tengo error de caracteres, rak dijo que faltaba un parentesis al principio, pero ya hice prueba y error..
Responder
#20
pone tu sma del zp; no somos adivinos
Hi Milashkasiya CrabCrab

Soy un #Panda.. Soy solo un tipo que parece #común pero soy todo lo contrario; alguien #atípico en esta sociedad actual

[Imagen: xl0jvd-5.png]
Link
Responder
#21
Error: se esperaba el token: ")", pero se encontró "[" en la línea 2306
Error: Expresión inválida, asumida cero en la línea 2306
Advertencia: la expresión no tiene efecto en la línea 2306
Error: Token esperado: ";", pero encontrado "]" en la línea 2306
Error: demasiados mensajes de error en una línea en la línea 2306

hay una exprecion que esta mal y no es por un parentesis o cerradura
una pregunta.. de que color vez el get_weaponid
Responder
#22
(04/01/2019, 04:32 PM)GoldenCosta escribió: Error: se esperaba el token: ")", pero se encontró "[" en la línea 2306
Error: Expresión inválida, asumida cero en la línea 2306
Advertencia: la expresión no tiene efecto en la línea 2306
Error: Token esperado: ";", pero encontrado "]" en la línea 2306
Error: demasiados mensajes de error en una línea en la línea 2306

hay una exprecion que esta mal y no es por un parentesis o cerradura
una pregunta.. de que color vez el get_weaponid

Lo veo en rojo, ya actualice el post, me habia confundido de .sma
Responder
#23
olvidaste modificar las variables

new g_primarias[33]
new g_secundarias[33]
----------------------------->
new g_primarias[33][MAX_PRIMARIAS+1]
new g_secundarias[33][MAX_SECUNDARIAS+1]

y me mando mas errores pero ya son correcciones de variables leveles por que no estan puestas con las tuyas
tambien hay que borrar esto
Código PHP:
// Primary and Secondary Weapon Names
new const WEAPONNAMES[][] = { """P228 Compact""""Schmidt Scout""""XM1014 M4""""Ingram MAC-10""Steyr AUG A1",
    
"""Dual Elite Berettas""FiveseveN""UMP 45""SG-550 Auto-Sniper""IMI Galil""Famas",
    
"USP .45 ACP Tactical""Glock 18C""AWP Magnum Sniper""MP5 Navy""M249 Para Machinegun",
    
"M3 Super 90""M4A1 Carbine""Schmidt TMP""G3SG1 Auto-Sniper""""Desert Eagle .50 AE",
"SG-552 Commando""AK-47 Kalashnikov""""ES P90" 

Código PHP:
cvar_randweapons
    cvar_randweapons 
register_cvar("zp_random_weapons""0"

y pusistema mal el reemplazo de los models, te lo dejo acomodado

Código PHP:
// Set Custom Weapon Models
replace_weapon_models(idweaponid)
{
        
// Not alive
    
if (!is_user_alive(id))
        return;
        
    static 
i
    
    
if(!g_zombie[id]) 
    {
        for(
0MAX_PRIMARIASi++) 
        {
            if(
g_primarias[id][i] && get_weaponid(Armasp[i][PITEMS]) == g_currentweapon[id]) 
            {
                
set_pev(idpev_viewmodel2Armasp[i][PMODEL])
                return
            }
        }
        for(
0MAX_SECUNDARIASi++) 
        {
            if(
g_secundarias[id][i] && get_weaponid(Armass[i][PITEMS]) == g_currentweapon[id]) 
            {
                
set_pev(idpev_viewmodel2Armass[i][PMODEL])
                return
            }
        }
    }

    switch (
weaponid)
    {
        case 
CSW_KNIFE// Custom knife models
        
{
            if (
g_zombie[id])
            {

                if (
g_nemesis[id]) // Nemesis
                
{
                    
set_pev(idpev_viewmodel2model_vknife_nemesis)
                    
set_pev(idpev_weaponmodel2"")
                }
                else 
// Zombies
                
{
                    
// Admin knife models?
                    
if (get_pcvar_num(cvar_adminknifemodelszombie) && get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS])
                    {
                        
set_pev(idpev_viewmodel2model_vknife_admin_zombie)
                        
set_pev(idpev_weaponmodel2"")
                    }
                    else
                    {
                        static 
clawmodel[100]
                        
ArrayGetString(g_zclass_clawmodelg_zombieclass[id], clawmodelcharsmax(clawmodel))
                        
format(clawmodelcharsmax(clawmodel), "models/zombie_plague/%s"clawmodel)
                        
set_pev(idpev_viewmodel2clawmodel)
                        
set_pev(idpev_weaponmodel2"")
                    }
                }
            }
            else 
// Humans
            
{
                
// Admin knife models?
                
if (get_pcvar_num(cvar_adminknifemodelshuman) && get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS])
                {
                    
set_pev(idpev_viewmodel2model_vknife_admin_human)
                    
set_pev(idpev_weaponmodel2"models/p_knife.mdl")
                }
                else
                {
                    
set_pev(idpev_viewmodel2model_vknife_admin_human)
                    
set_pev(idpev_weaponmodel2"models/p_knife.mdl")
                }
            }
        }
        case 
CSW_HEGRENADE// Infection bomb or fire grenade
        
{
            if (
g_zombie[id])
                
set_pev(idpev_viewmodel2model_grenade_infect)
            else
                
set_pev(idpev_viewmodel2model_grenade_fire)
        }
        case 
CSW_FLASHBANG// Frost grenade
        
{
            
set_pev(idpev_viewmodel2model_grenade_frost)
        }
        case 
CSW_SMOKEGRENADE// Flare grenade
        
{
            
set_pev(idpev_viewmodel2model_grenade_flare)
        }
    }
    
    
// Survivor's custom weapon model
    
static survweaponname[32]
    
get_pcvar_string(cvar_survweaponsurvweaponnamecharsmax(survweaponname))
    if (
g_survivor[id] && weaponid == cs_weapon_name_to_id(survweaponname))
        
set_pev(idpev_viewmodel2model_vweapon_survivor)
    
    
// Update model on weaponmodel ent
    
if (g_handle_models_on_separate_entfm_set_weaponmodel_ent(id)


lo acomode pero no creo funcione los models clases zombies por que creo que le falta algo o borraste algo del 4.3 en el reemplace models lo mismo proba
Responder
#24
(04/01/2019, 04:46 PM)GoldenCosta escribió: olvidaste modificar las variables

new g_primarias[33]
new g_secundarias[33]
----------------------------->
new g_primarias[33][MAX_PRIMARIAS+1]
new g_secundarias[33][MAX_SECUNDARIAS+1]

y me mando mas errores pero ya son correcciones de variables leveles por que no estan puestas con las tuyas

y pusistema mal el reemplazo de los models
Me compilo, comente la linea WEAPONNAMES y tube que eliminar cvar_randweapon.
Las restricciones funionan bien, olvide de agregarle a las variables para que al entrar puedan usar el arma, pero eso lo podria modificar para que el usuario ya entre con lvl 1.. dejo la .sma nueva, por si quieren confirmarme que esta bien..
Responder
#25
(04/01/2019, 04:49 PM)reloaD escribió:
(04/01/2019, 04:46 PM)GoldenCosta escribió: olvidaste modificar las variables

new g_primarias[33]
new g_secundarias[33]
----------------------------->
new g_primarias[33][MAX_PRIMARIAS+1]
new g_secundarias[33][MAX_SECUNDARIAS+1]

y me mando mas errores pero ya son correcciones de variables leveles por que no estan puestas con las tuyas

y pusistema mal el reemplazo de los models
Me compilo, comente la linea WEAPONNAMES y tube que eliminar cvar_randweapon.
Las restricciones funionan bien, olvide de agregarle a las variables para que al entrar puedan usar el arma, pero eso lo podria modificar para que el usuario ya entre con lvl 1.. dejo la .sma nueva, por si quieren confirmarme que esta bien..

Si queres confirmar que todo está bien, probalo vos mismo, si tenes algún error creas un tema y listo Nothingdohere

Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)