Buenas, lamento molestar y no se si esto va acá pero estaba siguiendo este post sobre como agregar clases humanas al ZP 4.3.
El punto es, que tome solo la parte del código que me interesaba para agregarle chaleco y daño al humano. Luego los agregue en el sma de las clases humanas y modifique el include del zombieplague.
Todo termina compilando bien pero el problema es que cuando entro al juego crashea (a veces mientras carga los recursos y otras veces al entrar al mapa). Por suerte tengo un back up del juego con los avances que llevo del ZP pero cada vez que intento agregarle esos atributos al humano me sucede lo mismo. Les adjunto los archivos que modifique para que vean cual puede ser la razón del problema seguramente algo de lo que cambie este mal puesto y lo haga reventar pero no se que puede ser.
Lamento el doble post y quedar pesado pero realmente necesito ayuda con esto para seguir avanzando en mi ZP ya que el back up que tenia tampoco me funciona (se sigue saliendo el juego al cargar el mapa) y no quiero tener que empezar todo de 0 (realmente no se que hacer ni porque pasa esto). Voy a detallar como agregue esos atributos para ver si me pueden ayudar. Si hay otra forma de agregarlos para usarlos mediante el plugin externo de las clases humanas díganmelo tendré que empezar de 0 pero usare ese método...
new Array:g_hclass_damage // daño new Array:g_hclass_armor // chaleco
Me quedo:
Código PHP:
// Human Classes vars new Array:g_hclass_name // name new Array:g_hclass_info // description new Array:g_hclass_model // player model new Array:g_hclass_modelindex // model index new Array:g_hclass_modelsstart // start position in models array new Array:g_hclass_modelsend // end position in models array new Array:g_hclass_lvl // level new Array:g_hclass_reset // reset new Array:g_hclass_sreset // sreset new Array:g_hclass_hp // health new Array:g_hclass_spd // speed new Array:g_hclass_grav // gravity new Array:g_hclass_damage // daño new Array:g_hclass_armor // chaleco new g_hclass_i // loaded human classes counter
-Mas abajo en
Código PHP:
// For human classes file parsing
agregue esto
Código PHP:
Array:g_hclass2_damage, Array:g_hclass2_armor
Me quedo:
Código PHP:
// For human classes file parsing new Array:g_hclass2_realname, Array:g_hclass2_name, Array:g_hclass2_info, Array:g_hclass2_modelsstart, Array:g_hclass2_modelsend, Array:g_hclass2_playermodel, Array:g_hclass2_modelindex, Array:g_hclass2_lvl, Array:g_hclass2_reset, Array:g_hclass2_sreset, Array:g_hclass2_hp, Array:g_hclass2_spd, Array:g_hclass2_grav, Array:g_hclass2_damage, Array:g_hclass2_armor, Array:g_hclass_new
-Mas abajo en
Código PHP:
// Cached stuff for players
agregue esto
Código PHP:
new Float:g_human_dmg[33] // human class dmg
Me quedo:
Código PHP:
// Cached stuff for players new g_isconnected[33] // whether player is connected new g_isalive[33] // whether player is alive new g_isbot[33] // whether player is a bot new g_currentweapon[33] // player's current weapon id new g_playername[33][32] // player's name new Float:g_zombie_spd[33] // zombie class speed new Float:g_zombie_knockback[33] // zombie class knockback new g_zombie_classname[33][32] // zombie class name new Float:g_human_spd[33] // human class speed new Float:g_human_dmg[33] // human class dmg new g_human_classname[33][32] // human class name
SEGUNDO:
-En
Código PHP:
public plugin_precache() // Initialize a few dynamically sized arrays (alright, maybe more than just a few...)
// Cache damage for player's class g_human_dmg[id] = Float:ArrayGetCell(g_hclass_damage, g_humanclass[id])
Me quedo:
Código PHP:
// Ham Player Spawn Post Forward public fw_PlayerSpawn_Post(id) { // Not alive or didn't join a team yet if (!is_user_alive(id) || !fm_cs_get_user_team(id)) return;
// Spawn at a random location? if (get_pcvar_num(cvar_randspawn)) do_random_spawn(id)
// Hide money? if (get_pcvar_num(cvar_removemoney)) set_task(0.4, "task_hide_money", id+TASK_SPAWN)
// Respawn player if he dies because of a worldspawn kill? if (get_pcvar_num(cvar_respawnworldspawnkill)) set_task(2.0, "respawn_player_check_task", id+TASK_SPAWN)
// Spawn as zombie? if (g_respawn_as_zombie[id] && !g_newround) { reset_vars(id, 0) // reset player vars zombieme(id, 0, 0, 0, 0) // make him zombie right away return; }
// Reset player vars reset_vars(id, 0) g_buytime[id] = get_gametime()
// Show custom buy menu? if (get_pcvar_num(cvar_buycustom)) set_task(0.2, "show_menu_buy1", id+TASK_SPAWN)
// Set selected human class g_humanclass[id] = g_humanclassnext[id] if (g_humanclass[id] == HCLASS_NONE) g_humanclass[id] = 0
// Set health and gravity fm_set_user_health(id, ArrayGetCell(g_hclass_hp, g_humanclass[id])) set_pev(id, pev_gravity, Float:ArrayGetCell(g_hclass_grav, g_humanclass[id]))
// Cache speed and name for player's class ArrayGetString(g_hclass_name, g_humanclass[id], g_human_classname[id], charsmax(g_human_classname[])) g_human_spd[id] = float(ArrayGetCell(g_hclass_spd, g_humanclass[id]))
// Cache damage for player's class g_human_dmg[id] = Float:ArrayGetCell(g_hclass_damage, g_humanclass[id])
// Switch to CT if spawning mid-round if (!g_newround && fm_cs_get_user_team(id) != FM_CS_TEAM_CT) // need to change team? { remove_task(id+TASK_TEAM) fm_cs_set_user_team(id, FM_CS_TEAM_CT) fm_user_team_update(id) }
// Attacker is human... if (!g_zombie[attacker]) { kDamage[attacker] += floatround(damage)
while(kDamage[attacker] >= DMG_NECESARIO) { kDamage[attacker] -= DMG_NECESARIO setExp( attacker , WINEXP ); } // Armor multiplier for the final damage on normal zombies if (!g_nemesis[victim]) { damage *= get_pcvar_float(cvar_zombiearmor) SetHamParamFloat(4, damage) } // Añadimos el daño que tenemos como habilidad damage *= g_human_dmg[attacker]
SetHamParamFloat(4, damage)
// 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; }
// code code code...
CUARTO:
-Fui a
Código PHP:
// Function Human Me (player id, turn into a survivor, silent mode) humanme(id, survivor, silentmode)
// Cache damage for player's class g_human_dmg[id] = Float:ArrayGetCell(g_hclass_damage, g_humanclass[id])
Me quedo:
Código PHP:
// Function Human Me (player id, turn into a survivor, silent mode) humanme(id, survivor, silentmode) { // User humanize attempt forward ExecuteForward(g_fwUserHumanize_attempt, g_fwDummyResult, id, survivor)
// One or more plugins blocked the "humanization". Only allow this after making sure it's // not going to leave us with no humans. Take into account a last player leaving case. // BUGFIX: only allow after a mode has started, to prevent blocking first survivor e.g. if (g_fwDummyResult >= ZP_PLUGIN_HANDLED && g_modestarted && fnGetHumans() > g_lastplayerleaving) return;
// Pre user humanize forward ExecuteForward(g_fwUserHumanized_pre, g_fwDummyResult, id, survivor)
// Set selected human class g_humanclass[id] = g_humanclassnext[id]
// If no class selected yet, use the first (default) one if (g_humanclass[id] == HCLASS_NONE) g_humanclass[id] = 0
// Remove CS nightvision if player owns one (bugfix) if (cs_get_user_nvg(id)) { cs_set_user_nvg(id, 0) if (get_pcvar_num(cvar_customnvg)) remove_task(id+TASK_NVISION) else if (g_nvisionenabled[id]) set_user_gnvision(id, 0) }
// Drop previous weapons drop_weapons(id, 1) drop_weapons(id, 2)
// Strip off from weapons fm_strip_user_weapons(id) fm_give_item(id, "weapon_knife")
// Set human attributes based on the mode if (survivor) { // Survivor g_survivor[id] = true
// Set Health [0 = auto] if (get_pcvar_num(cvar_survhp) == 0) { if (get_pcvar_num(cvar_survbasehp) == 0) fm_set_user_health(id, ArrayGetCell(g_hclass_hp, 0) * fnGetAlive()) else fm_set_user_health(id, get_pcvar_num(cvar_survbasehp) * fnGetAlive()) } else fm_set_user_health(id, get_pcvar_num(cvar_survhp))
// Set gravity, if frozen set the restore gravity value instead if (!g_frozen[id]) set_pev(id, pev_gravity, get_pcvar_float(cvar_survgravity)) else g_frozen_gravity[id] = get_pcvar_float(cvar_survgravity)
// Set survivor maxspeed ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
// Give survivor his own weapon static survweapon[32] get_pcvar_string(cvar_survweapon, survweapon, charsmax(survweapon)) fm_give_item(id, survweapon) ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[cs_weapon_name_to_id(survweapon)], AMMOTYPE[cs_weapon_name_to_id(survweapon)], MAXBPAMMO[cs_weapon_name_to_id(survweapon)])
// Turn off his flashlight turn_off_flashlight(id)
// Give the survivor a bright light if (get_pcvar_num(cvar_survaura)) set_pev(id, pev_effects, pev(id, pev_effects) | EF_BRIGHTLIGHT)
// Survivor bots will also need nightvision to see in the dark if (g_isbot[id]) { g_nvision[id] = true cs_set_user_nvg(id, 1) } } else { // Human taking an antidote
// Set health and gravity for player class fm_set_user_health(id, ArrayGetCell(g_hclass_hp, g_humanclass[id])) if (!g_frozen[id]) set_pev(id, pev_gravity, Float:ArrayGetCell(g_hclass_grav, g_humanclass[id]))
Trate de explicarlo lo mas detalladamente posible, espero no les cueste leer todo ya que es medio largo de ser así igual me ayudaría que pongan otro método para agregarlos...
Desde ya, muchas gracias.