Jump to content
  • 0

Guild Join Npc


Joker Sama

Question


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  18
  • Reputation:   9
  • Joined:  12/04/12
  • Last Seen:  

Hello my friends. I need an NPC that shows a list of existing guilds, so that players can choose which guild to join without having to be invited by the guild leader.

Mod

script.ccp

// Guild System
BUILDIN_FUNC(guild_join) {
    map_session_data *sd;
    int guild_id = script_getnum(st,2);
    int flag = 0; // Defina o valor apropriado para flag, se necessário

    if( !script_charid2sd( 3, sd ) ){
        script_pushint(st, false);
        return SCRIPT_CMD_FAILURE;
    }

    if( guild_member_added(guild_id, sd->status.account_id, sd->status.char_id, flag) )
        script_pushint(st, true);
    else
        script_pushint(st, false);

    return SCRIPT_CMD_SUCCESS;
}

BUILDIN_DEF(guild_join,"ii"),


Ex: this was my attempt.
But it's not working or showing an error

prontera,152,150,4    script    GuildJoinNPC    100,{
    mes "[Guild Master]";
    mes "Would you like to join our guild?";
    next;
    if (select("Yes:No") == 1) {
        set .@guild_id, 1; // ID of the guild the player will join
        set .@char_id, getcharid(0); // Gets the player character ID

        if (guild_join(.@guild_id, .@char_id)) {
            mes "You are now a member of our guild!";
        } else {
            mes "There was an error trying to add you to the guild.";
        }
    } else {
        mes "Maybe next time.";
    }
    close;
}
Edited by Joker Sama
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...