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;
}