15/02/2019, 02:58 PM
Hola a todos espero que estén bien.
Tengo tiempo intentando de varias formas pero no lo logro hacer, quiero que cuando el humano entre al Aura Shield se le setee una variable a True y si sale se le setee a False
cuando lo hice me seteo el valor a true al entrar pero al salir tenia que colisionar con otra entidad para que me lo seteara a False, aqui les dejo la parte del code.
y asi fue mi ultimo intento de hacer que funcionara como quiero
Les agradeceré mucho su ayuda.
Tengo tiempo intentando de varias formas pero no lo logro hacer, quiero que cuando el humano entre al Aura Shield se le setee una variable a True y si sale se le setee a False
cuando lo hice me seteo el valor a true al entrar pero al salir tenia que colisionar con otra entidad para que me lo seteara a False, aqui les dejo la parte del code.
Código PHP:
new bool:non_infect[33] = false
Código PHP:
public fw_Touch(ent, toucher)
{
// Get entity classname
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;
}
y asi fue mi ultimo intento de hacer que funcionara como quiero
Código PHP:
public fw_Touch(ent, toucher)
{
// Get entity classname
static classname[15]
entity_get_string(ent, EV_SZ_classname, classname, charsmax(classname))
if (non_infect[toucher] && !pev_valid(ent) && !equal(classname, "forze_camp"))
{
non_infect[toucher] = false
zp_colored_print(toucher, "^x04[non_ifect][false]")
}
// 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){
if(!non_infect[toucher])
{
non_infect[toucher] = true
zp_colored_print(toucher, "^x04[non_ifect][true]")
}
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;
}
Les agradeceré mucho su ayuda.