summaryrefslogblamecommitdiff
path: root/npc/commands/discord.txt
blob: b5ab69fef14fc0d48c5d7bd5f390b184ec997ba6 (plain) (tree)
























































                                                                                                                      
// TMW-2 Script.
// Author:
//    Jesusalva
//    LawnCable
// Notes:
//    Controls `discord` table with @discord command.
//    Only useful for TMW2-Discord integration.

-	script	@discord	32767,{
    end;

OnCall:
    // Anti-Flood System
    if (@discord) {
        mesc l("You already ran this command today. Please try again at a later time."), 1;
        close;
    }

    if (!validatepin())
        close;

    @discord=1;
	.@nb = query_sql("select `discord_id` from `discord` WHERE `account_id` == "+getcharid(3), .@discord$);


    do
    {
        mesn "Lawn Cable";
        mesq l("Current linked Discord account: @@", .@discord$);
        next;
        select
            l("Change Linked Discord Account"),
            l("Disconnect"),
            l("Quit");

        switch (@menu) {
            case 1:
                mesc l("Please insert your Discord ID, on the following format: "), 1;
                mesc l("Usename#0000"), 2;
                input .@discord$;
                mes "";
                query_sql("UPDATE `discord` SET `discord_id` = '"+.@discord$+"' WHERE `account_id` == "+getcharid(3));
                break;
            case 2:
                query_sql("DELETE FROM `discord` WHERE `account_id` == "+getcharid(3));
                .@discord$="";
                break;
        }

    } while (@menu != 3);
    close;

OnInit:
    bindatcmd "discord", "@discord::OnCall", 0, 0, 1;
    end;
}