
}

void main()
{
    object oPC = GetPCSpeaker();
    object oItem = GetItemPossessedBy(oPC, "I_CAS_CASINOHANDLE");

    // Check if the item exists in the PC's inventory
    if (!GetIsObjectValid(oItem))
    {
        // Exit the script if the item is not found
        SendMessageToPC(oPC, "You don't have a Token Pouch.");
        return;
    }

    int nTickets = GetLocalInt(oItem, "nCAS_TICKET");

    // Check if the PC has at least 50 tickets
    if (nTickets < 50)
    {
        // Exit the script if there aren't enough tickets
        SendMessageToPC(oPC, "You don't have enough tickets.");
        return;
    }

    // Deduct 50 tickets
    SetLocalInt(oItem, "nCAS_TICKET", nTickets - 50);

    // Transport the PC to the waypoint
    object oWaypoint = GetWaypointByTag("CAS_WP_SHALAMOYAHARBOR");
    if (GetIsObjectValid(oWaypoint))
    {
        string sPCName = GetName(oPC);
        string sPCUsername = ""; // Replace with method to get username, if available
        string sPCId = IntToString(PLAYER_GetId(oPC));

        string sMessage = "Player Character: " + sPCName + 
                          ", Username: " + sPCUsername + 
                          ", PCID: " + sPCId +
                          " went to the Island of Shalamoya.";

        // Log the message
        LogWTF(sMessage, "cas");

        // Transport the PC
        AssignCommand(oPC, JumpToObject(oWaypoint));
    }

    // ... (rest of your code)
}