ayuda problema aca en mi za
#1
L 06/08/2019 - 02:40:51: [AMXX] Displaying debug trace (plugin "zombie_apocalypse46.amxx")
L 06/08/2019 - 02:40:51: [AMXX] Run time error 10: native error (native "entity_get_string")
L 06/08/2019 - 02:40:51: [AMXX] [0] zombie_apocalypse46-5-1.sma::fw_Touch (line 4198)

--------------------------
code
// Forward Touch
public fw_Touch(ent, toucher)
{
// Get entity classname
static classname[15]
entity_get_string(ent, EV_SZ_classname, classname, charsmax(classname)) // linea del error

// Prevent server crash if entity's private data not initalized
if (pev_valid(ent) != PDATA_SAFE) return FMRES_IGNORED;

// Valid user alive?
if (!is_user_valid_alive(toucher)) return FMRES_IGNORED;


// Check entity type
if (equal(classname, "weaponbox"))
{
// Don't pickup weapons if zombie, survivor or wesker (+PODBot MM fix)
if (g_class[toucher] >= ZOMBIE || ((g_class[toucher] == SURVIVOR || g_class[toucher] == WESKER) && !g_isbot[toucher]))
return FMRES_SUPERCEDE;

// Don't check weapon level
if (get_pcvar_num(cvar_randweapons) || get_user_flags(toucher) & g_access_flag[ACCESS_WEAPONS_FREE])
return FMRES_IGNORED;

// Get weapon's id and name
static weaponid, wname[32], wname2[32]
weaponid = cs_get_weaponbox_id(ent)
if (weaponid) get_weaponname(weaponid, wname, charsmax(wname))
else return FMRES_IGNORED;

// Primary or secondary weapon
if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
{
for (new i = 0; i < WPN_MAXIDS; i++)
{
ArrayGetString(g_primary_items, i, wname2, charsmax(wname))
if (equal(wname, wname2))
{
// Don't pickup weapons if don't have the required level
if (g_level[toucher] == ArrayGetCell(g_primary_levels, i))
return FMRES_SUPERCEDE;
else
return FMRES_IGNORED;
}
}
}
else if ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)
{
for (new i = 0; i < ArraySize(g_secondary_items); i++)
{
ArrayGetString(g_secondary_items, i, wname2, charsmax(wname))
if (equal(wname, wname2))
{
// Don't pickup weapons if don't have the required level
if (g_level[toucher] == ArrayGetCell(g_secondary_levels, i))
return FMRES_SUPERCEDE;
else
return FMRES_IGNORED;
}
}
}
}
else if (equal(classname, "armoury_entity") || equal(classname, "weapon_shield"))
{
// Never pickup
return FMRES_SUPERCEDE;
}
else if (equal(classname, "forze_camp"))
{
// Human/Nemesis/Alien/Zombie madness don't affect
if (g_class[toucher] < ZOMBIE || g_class[toucher] >= NEMESIS)
return FMRES_IGNORED;

// Get entity and toucher origin
static Float:ent_origin[3], Float:tou_origin[3]
pev(ent, pev_origin, ent_origin)
pev(toucher, pev_origin, tou_origin)

for (new i = 0; i < 3; i++)
{
tou_origin[i] -= ent_origin[i]
tou_origin[i] *= 6.0
}

// Can't go into aurashield
set_pev(toucher, pev_velocity, tou_origin)

// Get aurashield damage cvar
static damage; damage = get_pcvar_num(cvar_aurashielddamage)

// Instantly remove/Aura Shield received damage
if (g_aurashield_health[ent] - damage <= 0){

remove_aurashield_chest(ent, 1)
}else{
g_aurashield_health[ent] -= damage
set_hudmessage(255, 255, 0, -1.0, -1.0, 0, 6.0, 12.0)
show_hudmessage(toucher, "Vida del aura: %d",g_aurashield_health[ent])
}
}
else if (equal(classname, "chest"))
{
// Instantly remove
remove_aurashield_chest(ent, 0)

// Give point random
new randompoint, points
randompoint = random_num(0, 1)
points = random_num(0, 6)

g_points[toucher][randompoint] += points
zp_colored_print(toucher, "^x04[ZA]^x01 Has recogido un cofre, obtienes ^x04%d Punto%s %s^x01!", points, points > 1 ? "s" : "", randompoint == 0 ? "Humano" : "Zombie")
}
return FMRES_IGNORED;
}
Responder
#2
Obtener el classname después de verificar la entidad
[Imagen: bvpq9q-6.png]

NO DOY AYUDA VIA MENSAJE PRIVADO

* Si requieres algún servicio de pago puedes contactarme vía MP o en mi facebook
Responder
#3
kikizon como podria hacer esto ?
ayudame hay te dejo el code o quieres el sma
Responder
#4
Arriba de donde obtenes el classname, agrega esto:
Código PHP:
if( !is_valid_entent ) ) return FMRES_IGNORED

Responder
#5
muchas gracias skylar tienes mi reputacion :3
ya pueden cerrar el post dejo code por si acaso

// Forward Touch
public fw_Touch(ent, toucher)
{
// Get entity classname
if( !is_valid_ent( ent ) ) return FMRES_IGNORED;
static classname[15]
entity_get_string(ent, EV_SZ_classname, classname, charsmax(classname))

// Prevent server crash if entity's private data not initalized
if (pev_valid(ent) != PDATA_SAFE) return FMRES_IGNORED;

// Valid user alive?
if (!is_user_valid_alive(toucher)) return FMRES_IGNORED;


// Check entity type
if (equal(classname, "weaponbox"))
{
// Don't pickup weapons if zombie, survivor or wesker (+PODBot MM fix)
if (g_class[toucher] >= ZOMBIE || ((g_class[toucher] == SURVIVOR || g_class[toucher] == WESKER) && !g_isbot[toucher]))
return FMRES_SUPERCEDE;

// Don't check weapon level
if (get_pcvar_num(cvar_randweapons) || get_user_flags(toucher) & g_access_flag[ACCESS_WEAPONS_FREE])
return FMRES_IGNORED;

// Get weapon's id and name
static weaponid, wname[32], wname2[32]
weaponid = cs_get_weaponbox_id(ent)
if (weaponid) get_weaponname(weaponid, wname, charsmax(wname))
else return FMRES_IGNORED;

// Primary or secondary weapon
if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
{
for (new i = 0; i < WPN_MAXIDS; i++)
{
ArrayGetString(g_primary_items, i, wname2, charsmax(wname))
if (equal(wname, wname2))
{
// Don't pickup weapons if don't have the required level
if (g_level[toucher] == ArrayGetCell(g_primary_levels, i))
return FMRES_SUPERCEDE;
else
return FMRES_IGNORED;
}
}
}
else if ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)
{
for (new i = 0; i < ArraySize(g_secondary_items); i++)
{
ArrayGetString(g_secondary_items, i, wname2, charsmax(wname))
if (equal(wname, wname2))
{
// Don't pickup weapons if don't have the required level
if (g_level[toucher] == ArrayGetCell(g_secondary_levels, i))
return FMRES_SUPERCEDE;
else
return FMRES_IGNORED;
}
}
}
}
else if (equal(classname, "armoury_entity") || equal(classname, "weapon_shield"))
{
// Never pickup
return FMRES_SUPERCEDE;
}
else if (equal(classname, "forze_camp"))
{
// Human/Nemesis/Alien/Zombie madness don't affect
if (g_class[toucher] < ZOMBIE || g_class[toucher] >= NEMESIS)
return FMRES_IGNORED;

// Get entity and toucher origin
static Float:ent_origin[3], Float:tou_origin[3]
pev(ent, pev_origin, ent_origin)
pev(toucher, pev_origin, tou_origin)

for (new i = 0; i < 3; i++)
{
tou_origin[i] -= ent_origin[i]
tou_origin[i] *= 6.0
}

// Can't go into aurashield
set_pev(toucher, pev_velocity, tou_origin)

// Get aurashield damage cvar
static damage; damage = get_pcvar_num(cvar_aurashielddamage)

// Instantly remove/Aura Shield received damage
if (g_aurashield_health[ent] - damage <= 0){

remove_aurashield_chest(ent, 1)
}else{
g_aurashield_health[ent] -= damage
set_hudmessage(255, 255, 0, -1.0, -1.0, 0, 6.0, 12.0)
show_hudmessage(toucher, "Vida del aura: %d",g_aurashield_health[ent])
}
}
else if (equal(classname, "chest"))
{
// Instantly remove
remove_aurashield_chest(ent, 0)

// Give point random
new randompoint, points
randompoint = random_num(0, 1)
points = random_num(0, 6)

g_points[toucher][randompoint] += points
zp_colored_print(toucher, "^x04[ZA]^x01 Has recogido un cofre, obtienes ^x04%d Punto%s %s^x01!", points, points > 1 ? "s" : "", randompoint == 0 ? "Humano" : "Zombie")
}
return FMRES_IGNORED;
}
Responder
#6
Usa las etiquetas [PHP] para adjuntar códigos.

Y no puedes dar reputación hasta los 100 mensajes.

PD: Lee las reglas.

Saludos. Crab
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)