Well, assuming that you meant in a specific class, like, combat level 50, the check would be something like:
if ( ch->skill_level[COMBAT_ABILITY] == 50 && ch->pcdata->learned[gsn_YOURSKILL] != 100 )
This would go towards the beginning of the function. If you meant top level 50, same thing, but:
if ( ch->top_level == 50 && ch->pcdata->learned[gsn_YOURSKILL] != 100 )
That should work, just have it return after that. Course, I'm using SWR, it might be a little different, I think its just ch->level in smaug, but general principle shuold work.