I always do something like this whenever I know I'll use a class for both NPC's and players:
PHP Code:
function myFunction()
{
if (objecttype() == "TServerPlayer") temp.obj = "player";
else if (objecttype() == "TServerNPC") temp.obj = "this";
(@obj).variable = 666;
(@obj).triggerAnotherCoolFunction();
}
Etcetera etcetera.