Does anyone know any reason that yoda would stop working? On my server yoda will work for a while then it will just stop working. I have to restart the server to make it work again.
Update:
Here is what I did to fix the people. In the force_push function I changed it to do a for loop searching all the players instead of relying to get_user_team. Here is the code that is working great for me.
Code:
public force_push(id)
{
if ( !is_user_alive(id) ) return
new team[33], players[SH_MAXSLOTS], pnum
new origin[3], vorigin[3], parm[4], distance
new Float:tempVelocity[3] = {0.0, 0.0, 200.0}
new bool:enemyPushed = false
for (new vic = 1; vic <= SH_MAXSLOTS; vic++)
{
if ( (is_user_alive(vic) && get_user_team(id) != get_user_team(vic)) || vic == id )
{
if( !is_user_alive(vic) ) continue
get_user_origin(vic, vorigin)
distance = get_distance(origin, vorigin)
if ( distance < get_cvar_num("yoda_radius") ) {
// Set cooldown/sound/self damage only once, if push is used
if ( !enemyPushed ) {
if (get_cvar_float("yoda_cooldown") > 0.0) ultimateTimer(id, get_cvar_float("yoda_cooldown"))
emit_sound(id, CHAN_ITEM, "shmod/yoda_forcepush.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
// Do damage to Yoda?
if ( get_cvar_num("yoda_selfdmg") > 0 ) {
shExtraDamage(id, id, get_cvar_num("yoda_selfdmg"), "Force Push")
}
enemyPushed = true
}
parm[0] = ((vorigin[0] - origin[0]) / distance) * get_cvar_num("yoda_power")
parm[1] = ((vorigin[1] - origin[1]) / distance) * get_cvar_num("yoda_power")
parm[2] = vic
parm[3] = id
// Stun enemy makes them easier to push
shStun(vic, 1)
set_user_maxspeed(vic, 1.0)
// First lift them
Entvars_Set_Vector(vic, EV_VEC_velocity, tempVelocity)
// Then push them back in x seconds after lift and do some damage
set_task(0.1, "move_enemy", 0, parm, 4)
}
}
}
if ( !enemyPushed && is_user_alive(id) ) {
client_print(id, print_chat, "[SH](Yoda) No enemies within Range!")
playSoundDenySelect(id)
}
}