#include "mw_teleport_inc"
void main()
{
    object  oPC,
            oLeader;
    int     iTime;
    oPC = GetPCSpeaker();
    oLeader = GetFactionLeader(oPC);
    if (oLeader == oPC)
    {
        /*
        if the requester is the party leader, cycle through everyone in the
        party, teleporting to the first one found
        */
        /* if you want to allow only teleport to party leader cut until ...*/
        oLeader = GetFirstFactionMember(oPC, TRUE);
        while (GetIsObjectValid(oLeader) && oLeader == oPC)
        {
            oLeader = GetNextFactionMember(oPC, TRUE);
        }
        if (oLeader == OBJECT_INVALID)
        {
        /* cut until here for party leader only */
            AssignCommand(OBJECT_SELF, ActionSpeakString("You are the only member in your party!"));
            return;
        } /*this would be removed too */
    }
    iTime = GetHitDice(oPC);

 //TakeGoldFromCreature(iTime*50, oPC, TRUE);

    if (oLeader != oPC)
        mw_TeleportWithEffects(oPC, oLeader, IntToFloat(iTime));
}