BUG de personaje
#1
TUT: https://amxmodx-es.com/Thread-TUT-crear-...s-y-Zombie

- Al subirle la vida al zombie al máximo, cuando me transformo en zombie, se bugea el personaje. Es decir:

. Conservo las bombas transformándose en HIELO/FLASH - LUZ/SMOKE - FUEGO/INFECCIÓN
. Conservo el chaleco humano anti infección
. Conservo el cuchillo humano hasta realizar presión en cualquier numero

PD: Solo bugea el personaje la vida del zombie, las demas habilidades al subirlas "MAX", funcionan correctamente sin bugs.

Código PHP:
// First zombie
g_firstzombie[id] = true
            
// Set health
fm_set_user_health(idArrayGetCell(g_zclass_hpg_zombieclass[id] + ammount_zhealth(g_habilidad[id][1][1])))
//-------------------
// Infected by someone
// Set health
            
fm_set_user_health(idArrayGetCell(g_zclass_hpg_zombieclass[id] + ammount_zhealth(g_habilidad[id][1][1])))
//-------------------
// Silent mode, no HUD messages, no infection sounds
// Set health
        
fm_set_user_health(idArrayGetCell(g_zclass_hpg_zombieclass[id] + ammount_zhealth(g_habilidad[id][1][1]))) 
---------
Código PHP:
// Zombie Me Function (player id, infector, turn into a nemesis, silent mode, deathmsg and rewards)
zombieme(idinfectornemesisassassinsilentmoderewards)
{
    
// User infect attempt forward
    
ExecuteForward(g_fwUserInfect_attemptg_fwDummyResultidinfectornemesis)
    
    
// One or more plugins blocked the infection. Only allow this after making sure it's
    // not going to leave us with no zombies. Take into account a last player leaving case.
    // BUGFIX: only allow after a mode has started, to prevent blocking first zombie e.g.
    
if (g_fwDummyResult >= ZP_PLUGIN_HANDLED && g_modestarted && fnGetZombies() > g_lastplayerleaving)
        return;
    
    
// Pre user infect forward
    
ExecuteForward(g_fwUserInfected_preg_fwDummyResultidinfectornemesis)
    
    
// Show zombie class menu if they haven't chosen any (e.g. just connected)
    
if (g_zombieclassnext[id] == ZCLASS_NONE && get_pcvar_num(cvar_zclasses))
        
set_task(0.2"show_menu_zclass"id)
    
    
// Set selected zombie class
    
g_zombieclass[id] = g_zombieclassnext[id]
    
// If no class selected yet, use the first (default) one
    
if (g_zombieclass[id] == ZCLASS_NONEg_zombieclass[id] = 0
    
    
// Way to go...
    
g_zombie[id] = true
    g_nemesis
[id] = false
    g_assassin
[id] = false
    g_survivor
[id] = false
    g_sniper
[id] = false
    g_firstzombie
[id] = false
    
    
// Remove survivor's aura (bugfix)
    
set_pev(idpev_effectspev(idpev_effects) &~ EF_BRIGHTLIGHT)
    
    
// Remove spawn protection (bugfix)
    
g_nodamage[id] = false
    set_pev
(idpev_effectspev(idpev_effects) &~ EF_NODRAW)
    
    
// Reset burning duration counter (bugfix)
    
g_burning_duration[id] = 0
    
    
// Show deathmsg and reward infector?
    
if (rewards && infector)
    {
        
// Send death notice and fix the "dead" attrib on scoreboard
        
SendDeathMsg(infectorid)
        
FixDeadAttrib(id)
        
        
// Reward frags, deaths, health, and ammo packs
        
UpdateFrags(infectoridget_pcvar_num(cvar_fragsinfect), 11)
        
g_ammopacks[infector] += get_pcvar_num(cvar_ammoinfect)
        
fm_set_user_health(infectorpev(infectorpev_health) + get_pcvar_num(cvar_zombiebonushp))
    }
    
    
// Cache speed, knockback, and name for player's class
    
g_zombie_spd[id] = float(ArrayGetCell(g_zclass_spdg_zombieclass[id]))
    
g_zombie_knockback[id] = Float:ArrayGetCell(g_zclass_kbg_zombieclass[id])
    
ArrayGetString(g_zclass_nameg_zombieclass[id], g_zombie_classname[id], charsmax(g_zombie_classname[]))
    
    
// Set zombie attributes based on the mode
    
static sound[64]
    if (!
silentmode)
    {
        if (
nemesis)
        {
            
// Nemesis
            
g_nemesis[id] = true
            
            
// Set health [0 = auto]
            
if (get_pcvar_num(cvar_nemhp) == 0)
            {
                if (
get_pcvar_num(cvar_nembasehp) == 0)
                    
fm_set_user_health(idArrayGetCell(g_zclass_hp0) * fnGetAlive())
                else
                    
fm_set_user_health(idget_pcvar_num(cvar_nembasehp) * fnGetAlive())
            }
            else
                
fm_set_user_health(idget_pcvar_num(cvar_nemhp))
            
            
// Set gravity, if frozen set the restore gravity value instead
            
if (!g_frozen[id]) set_pev(idpev_gravityget_pcvar_float(cvar_nemgravity))
            else 
g_frozen_gravity[id] = get_pcvar_float(cvar_nemgravity)
            
            
// Set nemesis maxspeed
            
ExecuteHamB(Ham_Player_ResetMaxSpeedid)
        }
        else if (
assassin)
        {
            
// Assassin
            
g_assassin[id] = true
            
            
// Set health [0 = auto]
            
if (get_pcvar_num(cvar_assahp) == 0)
            {
                if (
get_pcvar_num(cvar_assabasehp) == 0)
                    
fm_set_user_health(idArrayGetCell(g_zclass_hp0) * fnGetAlive())
                else
                    
fm_set_user_health(idget_pcvar_num(cvar_assabasehp) * fnGetAlive())
            }
            else
                
fm_set_user_health(idget_pcvar_num(cvar_assahp))
            
            
// Set gravity, if frozen set the restore gravity value instead
            
if (!g_frozen[id]) set_pev(idpev_gravityget_pcvar_float(cvar_assagravity))
            else 
g_frozen_gravity[id] = get_pcvar_float(cvar_assagravity)
            
            
// Set assassin maxspeed
            
ExecuteHamB(Ham_Player_ResetMaxSpeedid)
        }
        else if (
fnGetZombies() == 1)
        {
            
// First zombie
            
g_firstzombie[id] = true
            
            
// Set health
            
fm_set_user_health(idArrayGetCell(g_zclass_hpg_zombieclass[id] + ammount_zhealth(g_habilidad[id][1][1])))
            
            
// Set gravity, if frozen set the restore gravity value instead
            
if (!g_frozen[id]) set_pev(idpev_gravityFloat:ArrayGetCell(g_zclass_gravg_zombieclass[id])  - ammount_zgravity(g_habilidad[id][1][3]))
            else 
g_frozen_gravity[id] = Float:ArrayGetCell(g_zclass_gravg_zombieclass[id])
            
            
// Set zombie maxspeed
            
ExecuteHamB(Ham_Player_ResetMaxSpeedid)
            
            
// Infection sound
            
ArrayGetString(zombie_infectrandom_num(0ArraySize(zombie_infect) - 1), soundcharsmax(sound))
            
emit_sound(idCHAN_VOICEsound1.0ATTN_NORM0PITCH_NORM)
        }
        else
        {
            
// Infected by someone
            
            // Set health
            
fm_set_user_health(idArrayGetCell(g_zclass_hpg_zombieclass[id] + ammount_zhealth(g_habilidad[id][1][1])))
            
            
// Set gravity, if frozen set the restore gravity value instead
            
if (!g_frozen[id]) set_pev(idpev_gravityFloat:ArrayGetCell(g_zclass_gravg_zombieclass[id])  - ammount_zgravity(g_habilidad[id][1][3]))
            else 
g_frozen_gravity[id] = Float:ArrayGetCell(g_zclass_gravg_zombieclass[id])
            
            
// Set zombie maxspeed
            
ExecuteHamB(Ham_Player_ResetMaxSpeedid)
            
            
// Infection sound
            
ArrayGetString(zombie_infectrandom_num(0ArraySize(zombie_infect) - 1), soundcharsmax(sound))
            
emit_sound(idCHAN_VOICEsound1.0ATTN_NORM0PITCH_NORM)
            
            
// Show Infection HUD notice
            
set_hudmessage(25500HUD_INFECT_XHUD_INFECT_Y00.05.01.01.0, -1)
            
            if (
infector// infected by someone?
                
ShowSyncHudMsg(0g_MsgSync"%L"LANG_PLAYER"NOTICE_INFECT2"g_playername[id], g_playername[infector])
            else
                
ShowSyncHudMsg(0g_MsgSync"%L"LANG_PLAYER"NOTICE_INFECT"g_playername[id])
        }
    }
    else
    {
        
// Silent mode, no HUD messages, no infection sounds
        
        // Set health
        
fm_set_user_health(idArrayGetCell(g_zclass_hpg_zombieclass[id] + ammount_zhealth(g_habilidad[id][1][1])))
        
        
// Set gravity, if frozen set the restore gravity value instead
        
if (!g_frozen[id]) set_pev(idpev_gravityFloat:ArrayGetCell(g_zclass_gravg_zombieclass[id]) - ammount_zgravity(g_habilidad[id][1][3]))
        else 
g_frozen_gravity[id] = Float:ArrayGetCell(g_zclass_gravg_zombieclass[id])
        
        
// Set zombie maxspeed
        
ExecuteHamB(Ham_Player_ResetMaxSpeedid)
    }
    
    
// Remove previous tasks
    
remove_task(id+TASK_MODEL)
    
remove_task(id+TASK_BLOOD)
    
remove_task(id+TASK_AURA)
    
remove_task(id+TASK_BURN)
    
    
// Switch to T
    
if (fm_cs_get_user_team(id) != FM_CS_TEAM_T// need to change team?
    
{
        
remove_task(id+TASK_TEAM)
        
fm_cs_set_user_team(idFM_CS_TEAM_T)
        
fm_user_team_update(id)
    }
    
    
// Custom models stuff
    
static currentmodel[32], tempmodel[32], already_has_modeliiRandsize
    already_has_model 
false
    
    
if (g_handle_models_on_separate_ent)
    {
        
// Set the right model
        
if (g_nemesis[id])
        {
            
iRand random_num(0ArraySize(model_nemesis) - 1)
            
ArrayGetString(model_nemesisiRandg_playermodel[id], charsmax(g_playermodel[]))
            if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_nemesisiRand))
        }
        else if (
g_assassin[id])
        {
            
iRand random_num(0ArraySize(model_assassin) - 1)
            
ArrayGetString(model_assassiniRandg_playermodel[id], charsmax(g_playermodel[]))
            if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_assassiniRand))
        }
        else
        {
            if (
get_pcvar_num(cvar_adminmodelszombie) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
            {
                
iRand random_num(0ArraySize(model_admin_zombie) - 1)
                
ArrayGetString(model_admin_zombieiRandg_playermodel[id], charsmax(g_playermodel[]))
                if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_admin_zombieiRand))
            }
            else
            {
                
iRand random_num(ArrayGetCell(g_zclass_modelsstartg_zombieclass[id]), ArrayGetCell(g_zclass_modelsendg_zombieclass[id]) - 1)
                
ArrayGetString(g_zclass_playermodeliRandg_playermodel[id], charsmax(g_playermodel[]))
                if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_zclass_modelindexiRand))
            }
        }
        
        
// Set model on player model entity
        
fm_set_playermodel_ent(id)
        
        
// Nemesis glow / remove glow on player model entity, unless frozen
        
if (!g_frozen[id])
        {
            if (
g_nemesis[id] && get_pcvar_num(cvar_nemglow))
                
fm_set_rendering(g_ent_playermodel[id], kRenderFxGlowShell2500kRenderNormal25)
            else if (
g_nemesis[id] && !(get_pcvar_num(cvar_nemglow)))
                
fm_set_rendering(g_ent_playermodel[id], kRenderFxGlowShell00kRenderNormal25)
            else if (
g_assassin[id] && get_pcvar_num(cvar_assaglow))
                
fm_set_rendering(g_ent_playermodel[id], kRenderFxGlowShell2552550kRenderNormal25)
            else
                
fm_set_rendering(g_ent_playermodel[id])
        }
    }
    else
    {
        
// Get current model for comparing it with the current one
        
fm_cs_get_user_model(idcurrentmodelcharsmax(currentmodel))
        
        
// Set the right model, after checking that we don't already have it
        
if (g_nemesis[id])
        {
            
size ArraySize(model_nemesis)
            for (
0sizei++)
            {
                
ArrayGetString(model_nemesisitempmodelcharsmax(tempmodel))
                if (
equal(currentmodeltempmodel)) already_has_model true
            
}
            
            if (!
already_has_model)
            {
                
iRand random_num(0size 1)
                
ArrayGetString(model_nemesisiRandg_playermodel[id], charsmax(g_playermodel[]))
                if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_nemesisiRand))
            }
        }
        else if (
g_assassin[id])
        {
            
size ArraySize(model_assassin)
            for (
0sizei++)
            {
                
ArrayGetString(model_assassinitempmodelcharsmax(tempmodel))
                if (
equal(currentmodeltempmodel)) already_has_model true
            
}
            
            if (!
already_has_model)
            {
                
iRand random_num(0size 1)
                
ArrayGetString(model_assassiniRandg_playermodel[id], charsmax(g_playermodel[]))
                if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_assassiniRand))
            }
        }
        else
        {
            if (
get_pcvar_num(cvar_adminmodelszombie) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
            {
                
size ArraySize(model_admin_zombie)
                for (
0sizei++)
                {
                    
ArrayGetString(model_admin_zombieitempmodelcharsmax(tempmodel))
                    if (
equal(currentmodeltempmodel)) already_has_model true
                
}
                
                if (!
already_has_model)
                {
                    
iRand random_num(0size 1)
                    
ArrayGetString(model_admin_zombieiRandg_playermodel[id], charsmax(g_playermodel[]))
                    if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_modelindex_admin_zombieiRand))
                }
            }
            else
            {
                for (
ArrayGetCell(g_zclass_modelsstartg_zombieclass[id]); ArrayGetCell(g_zclass_modelsendg_zombieclass[id]); i++)
                {
                    
ArrayGetString(g_zclass_playermodelitempmodelcharsmax(tempmodel))
                    if (
equal(currentmodeltempmodel)) already_has_model true
                
}
                
                if (!
already_has_model)
                {
                    
iRand random_num(ArrayGetCell(g_zclass_modelsstartg_zombieclass[id]), ArrayGetCell(g_zclass_modelsendg_zombieclass[id]) - 1)
                    
ArrayGetString(g_zclass_playermodeliRandg_playermodel[id], charsmax(g_playermodel[]))
                    if (
g_set_modelindex_offsetfm_cs_set_user_model_index(idArrayGetCell(g_zclass_modelindexiRand))
                }
            }
        }
        
        
// Need to change the model?
        
if (!already_has_model)
        {
            
// An additional delay is offset at round start
            // since SVC_BAD is more likely to be triggered there
            
if (g_newround)
                
set_task(5.0 g_modelchange_delay"fm_user_model_update"id+TASK_MODEL)
            else
                
fm_user_model_update(id+TASK_MODEL)
        }
        
        
// Nemesis glow / remove glow, unless frozen
        
if (!g_frozen[id])
        {
            if (
g_nemesis[id] && get_pcvar_num(cvar_nemglow))
                
fm_set_rendering(idkRenderFxGlowShell25000kRenderNormal25)
            else if (
g_nemesis[id] && !(get_pcvar_num(cvar_nemglow)))
                
fm_set_rendering(idkRenderFxGlowShell000kRenderNormal25)
            if (
g_assassin[id] && get_pcvar_num(cvar_assaglow))
                
fm_set_rendering(idkRenderFxGlowShell2552550kRenderNormal25)
                
            else if (!
g_assassin[id] && !g_nemesis[id])
                
fm_set_rendering(id)
        }
    }
    
    
// Remove any zoom (bugfix)
    
cs_set_user_zoom(idCS_RESET_ZOOM1)
    
    
// Remove armor
    
cs_set_user_armor(id0CS_ARMOR_NONE)
    
    
// Drop weapons when infected
    
drop_weapons(id1)
    
drop_weapons(id2)
    
    
// Strip zombies from guns and give them a knife
    
fm_strip_user_weapons(id)
    
fm_give_item(id"weapon_knife")
    
    
// Fancy effects
    
infection_effects(id)
    
    
// Nemesis aura task
    
if (g_nemesis[id] && get_pcvar_num(cvar_nemaura))
        
set_task(0.1"zombie_aura"id+TASK_AURA__"b")
        
    
// Assassin aura task
    
if (g_assassin[id] && get_pcvar_num(cvar_assaaura))
        
set_task(0.1"zombie_aura"id+TASK_AURA__"b")
    
    
// Remove CS nightvision if player owns one (bugfix)
    
if (cs_get_user_nvg(id))
    {
        
cs_set_user_nvg(id0)
        if (
get_pcvar_num(cvar_customnvg)) remove_task(id+TASK_NVISION)
        else if (
g_nvisionenabled[id]) set_user_gnvision(id0)
    }
    
    
// Give Zombies Night Vision?
    
if (get_pcvar_num(cvar_nvggive))
    {
        
g_nvision[id] = true
        
        
if (!g_isbot[id])
        {
            
// Turn on Night Vision automatically?
            
if (get_pcvar_num(cvar_nvggive) == 1)
            {
                
g_nvisionenabled[id] = true
                
                
// Custom nvg?
                
if (get_pcvar_num(cvar_customnvg))
                {
                    
remove_task(id+TASK_NVISION)
                    
set_task(0.1"set_user_nvision"id+TASK_NVISION__"b")
                }
                else
                    
set_user_gnvision(id1)
            }
            
// Turn off nightvision when infected (bugfix)
            
else if (g_nvisionenabled[id])
            {
                if (
get_pcvar_num(cvar_customnvg)) remove_task(id+TASK_NVISION)
                else 
set_user_gnvision(id0)
                
g_nvisionenabled[id] = false
            
}
        }
        else
            
cs_set_user_nvg(id1); // turn on NVG for bots
    
}
    
// Disable nightvision when infected (bugfix)
    
else if (g_nvision[id])
    {
        if (
get_pcvar_num(cvar_customnvg)) remove_task(id+TASK_NVISION)
        else if (
g_nvisionenabled[id]) set_user_gnvision(id0)
        
g_nvision[id] = false
        g_nvisionenabled
[id] = false
    
}
    
    
// Set custom FOV?
    
if (get_pcvar_num(cvar_zombiefov) != 90 && get_pcvar_num(cvar_zombiefov) != 0)
    {
        
message_begin(MSG_ONEg_msgSetFOV_id)
        
write_byte(get_pcvar_num(cvar_zombiefov)) // fov angle
        
message_end()
    }
    
    
// Call the bloody task
    
if (!g_nemesis[id] && !g_nemesis[id] && get_pcvar_num(cvar_zombiebleeding))
        
set_task(0.7"make_blood"id+TASK_BLOOD__"b")
    
    
// Idle sounds task
    
if (!g_nemesis[id] && !g_assassin[id])
        
set_task(random_float(50.070.0), "zombie_play_idle"id+TASK_BLOOD__"b")
    
    
// Turn off zombie's flashlight
    
turn_off_flashlight(id)
    
    
// Post user infect forward
    
ExecuteForward(g_fwUserInfected_postg_fwDummyResultidinfectornemesis)
    
    
// Last Zombie Check
    
fnCheckLastZombie()

Responder
#2
mostra todo zombieme(id, infector, nemesis, specialmode)
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
#3
(25/01/2019, 02:16 PM)[R]ak escribió: mostra todo zombieme(id, infector, nemesis, specialmode)

Post actualizado..
Responder
#4
dios, que ciego que soy hahahaha; se nota que necesitaba dormir un poco;

Código PHP:
// Set health
fm_set_user_health(idArrayGetCell(g_zclass_hpg_zombieclass[id]) + ammount_zhealth(g_habilidad[id][1][1]))
//-------------------
// Infected by someone
// Set health
fm_set_user_health(idArrayGetCell(g_zclass_hpg_zombieclass[id]) + ammount_zhealth(g_habilidad[id][1][1]))
//-------------------
// Silent mode, no HUD messages, no infection sounds
// Set health
fm_set_user_health(idArrayGetCell(g_zclass_hpg_zombieclass[id]) + ammount_zhealth(g_habilidad[id][1][1])) 
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
#5
Gracias RAK !

(25/01/2019, 10:35 PM)[R]ak escribió: dios, que ciego que soy hahahaha; se nota que necesitaba dormir un poco;

Código PHP:
// Set health
fm_set_user_health(idArrayGetCell(g_zclass_hpg_zombieclass[id]) + ammount_zhealth(g_habilidad[id][1][1]))
//-------------------
// Infected by someone
// Set health
fm_set_user_health(idArrayGetCell(g_zclass_hpg_zombieclass[id]) + ammount_zhealth(g_habilidad[id][1][1]))
//-------------------
// Silent mode, no HUD messages, no infection sounds
// Set health
fm_set_user_health(idArrayGetCell(g_zclass_hpg_zombieclass[id]) + ammount_zhealth(g_habilidad[id][1][1])) 
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)