Set this as a
Global Variable
Code:
new gPlayerLevels[SH_MAXSLOTS+1]
Set this to get run in the
plugin_init so it runs function heroname_levels to check the levels (change heroname to your heroes name)
Code:
// LEVELS
register_srvcmd("heroname_levels", "heroname_levels")
shRegLevels(gHeroName,"heroname_levels")
Set this as a function in the code to obtain a players levels (change heroname to your heroes name)
Code:
public heroname_levels()
{
new id[5]
new lev[5]
read_argv(1,id,4)
read_argv(2,lev,4)
gPlayerLevels[str_to_num(id)] = str_to_num(lev)
}
gPlayerLevels[id] now equals the ids level
and to change your code above to: (change heroname to your heroes cvar name)
Code:
if ( gPlayerLevels[id] >= get_cvar_num("heroname_level")) {
//do hero stuff to player
}
//you dont need an else if you aren't doing anything on it