Quote:
Originally Posted by dinogust
i did, as i said zp50_class_zombie has its own class randomizer for bots that overwrite zp_set_user_zombie
|
I just check zp50_class_zombie and I think the only way is to move this highlight part
Code:
public zp_fw_core_infect_post
(id, attacker
)
{
// Show zombie class menu if they haven't chosen any (e.g. just connected)
if (g_ZombieClassNext
[id
] == ZP_INVALID_ZOMBIE_CLASS
)
{
if (g_ZombieClassCount >
1)
show_menu_zombieclass
(id
)
else // If only one class is registered, choose it automatically
g_ZombieClassNext
[id
] =
0
}
// Bots pick class automatically
if (is_user_bot(id))
{
// Try choosing class
new index, start_index = random_num(0, g_ZombieClassCount - 1)
for (index = start_index + 1; /* no condition */; index++)
{
// Start over when we reach the end
if (index >= g_ZombieClassCount)
index = 0
// Execute class select attempt forward
ExecuteForward(g_Forwards[FW_CLASS_SELECT_PRE], g_ForwardResult, id, index)
// Class available to player?
if (g_ForwardResult < ZP_CLASS_NOT_AVAILABLE)
{
g_ZombieClassNext[id] = index
break;
}
// Loop completed, no class could be chosen
if (index == start_index)
break;
}
}
// Set selected zombie class. If none selected yet, use the first one
g_ZombieClass
[id
] = g_ZombieClassNext
[id
]
if (g_ZombieClass
[id
] == ZP_INVALID_ZOMBIE_CLASS
) g_ZombieClass
[id
] =
0
// Apply zombie attributes
set_user_health
(id, ArrayGetCell
(g_ZombieClassHealth, g_ZombieClass
[id
]))
set_user_gravity
(id,
Float:ArrayGetCell
(g_ZombieClassGravity, g_ZombieClass
[id
]))
cs_set_player_maxspeed_auto
(id,
Float:ArrayGetCell
(g_ZombieClassSpeed, g_ZombieClass
[id
]))
to
zp_fw_core_infect_pre (if zp_fw_core_infect_pre didn't exist, just copy this one below)
PHP Code:
public zp_fw_core_infect_pre(id, attacker)
{
// Bots pick class automatically
if (is_user_bot(id))
{
// Try choosing class
new index, start_index = random_num(0, g_ZombieClassCount - 1)
for (index = start_index + 1; /* no condition */; index++)
{
// Start over when we reach the end
if (index >= g_ZombieClassCount)
index = 0
// Execute class select attempt forward
ExecuteForward(g_Forwards[FW_CLASS_SELECT_PRE], g_ForwardResult, id, index)
// Class available to player?
if (g_ForwardResult < ZP_CLASS_NOT_AVAILABLE)
{
g_ZombieClassNext[id] = index
break;
}
// Loop completed, no class could be chosen
if (index == start_index)
break;
}
}
}
}
Then if you want to set specific class, you can set it in
zp_fw_core_infect(can be use in other plugins outside zp50_class_zombie)
PHP Code:
public zp_fw_core_infect(id, attacker)
{
zp_set_user_zombie_class(id, iRandomClass)
}
Explain stuff (if you don't understand)
__________________