Jump to content
  • 0

@joinguild for rAthena


liwanaganjo

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  04/09/13
  • Last Seen:  

Hello, Im desperately  in need of a 'force' guild join for my server. I did find one but it's on eAthena and sadly, I can't port to to rAthena. Thank you in advance!

 

in case you need the eAthenean @joinguild script; here it is :D

 int atcommand_joinguild(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
    struct map_session_data *pl_sd;
    struct guild *g;
    int guild_id_;
    struct guild_member m;
    nullpo_retr(-1, sd);
 
        memset(atcmd_output, '\0', sizeof(atcmd_output));
         memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
        sscanf(message, "%i,%23[^\n]", &guild_id_,atcmd_player_name);
    if (!message || !*message || !guild_id_ || !atcmd_player_name) {
        clif_displaymessage(fd, "Error. (usage: @joinguild <guild id>,<char name>).");
        return -1;
    }
 
    if ((pl_sd = map_nick2sd(atcmd_player_name)) == NULL) {
        clif_displaymessage(fd, msg_txt(3));
        return -1;
    }
 
    if (pc_isGM(sd) < pc_isGM(pl_sd))
      {    
        clif_displaymessage(fd, msg_txt(81));     
        return -1;
    }
    
    if ((g = guild_search(pl_sd->status.guild_id))!= NULL)
      {
        clif_displaymessage(fd, "Target player appears to already be in a guild.");
        return -1;
    }
    
    guild_makemember(&m,pl_sd); //This is line 7631
    pl_sd->guild_invite = guild_id_;
    intif_guild_addmember(pl_sd->guild_invite, &m );
    clif_displaymessage(fd, "Player has joined selected guild.");
 
    return 0;
}

 

Oh! I almost forgot, I'm using rathena - Revision 17209

Edited by liwanaganjo
Changed [Quote] to [Code].
Link to comment
Share on other sites

11 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  222
  • Reputation:   35
  • Joined:  12/13/11
  • Last Seen:  

so this force join guild thing is this so you can listen to a certain guilds conversations?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  04/09/13
  • Last Seen:  

so this force join guild thing is this so you can listen to a certain guilds conversations?

 

Thank you very much for replying! Actually, I need the @joinguild to force a player to join an existing guild. Im gonna make an NPC that would make them choose either (for example) Guild 1 or Guild 2, Then the npc will @joinguild the player :D It's possible, I already made that script but at eAthena, Right now all I need is the command. I know it's possible, I just don't know how to do it.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

this will work on rA with few work,

1) change pc_isGM(sd) for something like pc_has_permission and create a force guildjoin permission, or if you want to stick with lvl change it to pc_get_group_level(sd). (that will compare both group lvl)

2) add: pl_sd->guild_invite_account = sd->bl.id;

 

nb : I would have use guild_reply_invite(pl_sd,guild_id,1); rather but it's ok how you did it too.

int atcommand_joinguild(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
    struct map_session_data *pl_sd;
    struct guild *g;
    int guild_id_;
    struct guild_member m;
    nullpo_retr(-1, sd);
 
        memset(atcmd_output, '\0', sizeof(atcmd_output));
         memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
        sscanf(message, "%i,%23[^\n]", &guild_id_,atcmd_player_name);
    if (!message || !*message || !guild_id_ || !atcmd_player_name) {
        clif_displaymessage(fd, "Error. (usage: @joinguild <guild id>,<char name>).");
        return -1;
    }
 
    if ((pl_sd = map_nick2sd(atcmd_player_name)) == NULL) {
        clif_displaymessage(fd, msg_txt(3));
        return -1;
    }
 
    if (pc_get_group_level(sd) <  pc_get_group_level(pl_sd) )
      {    
        clif_displaymessage(fd, msg_txt(81));     
        return -1;
    }
 
   pl_sd->guild_invite = guild_id_;
   pl_sd->guild_invite_account = sd->bl.id;
   guild_reply_invite(pl_sd,guild_id_,1);
 
    clif_displaymessage(fd, "Player has joined selected guild.");
 
    return 0;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  04/09/13
  • Last Seen:  

this will work on rA with few work,

1) change pc_isGM(sd) for something like pc_has_permission and create a force guildjoin permission, or if you want to stick with lvl change it to pc_get_group_level(sd). (that will compare both group lvl)

2) add: pl_sd->guild_invite_account = sd->bl.id;

 

nb : I would have use guild_reply_invite(pl_sd,guild_id,1); rather but it's ok how you did it too.

 

int atcommand_joinguild(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
    struct map_session_data *pl_sd;
    struct guild *g;
    int guild_id_;
    struct guild_member m;
    nullpo_retr(-1, sd);
 
        memset(atcmd_output, '\0', sizeof(atcmd_output));
         memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
        sscanf(message, "%i,%23[^\n]", &guild_id_,atcmd_player_name);
    if (!message || !*message || !guild_id_ || !atcmd_player_name) {
        clif_displaymessage(fd, "Error. (usage: @joinguild <guild id>,<char name>).");
        return -1;
    }
 
    if ((pl_sd = map_nick2sd(atcmd_player_name)) == NULL) {
        clif_displaymessage(fd, msg_txt(3));
        return -1;
    }
 
    if (pc_get_group_level(sd) <  pc_get_group_level(pl_sd) )
      {    
        clif_displaymessage(fd, msg_txt(81));     
        return -1;
    }
 
   pl_sd->guild_invite = guild_id_;
   pl_sd->guild_invite_account = sd->bl.id;
   guild_reply_invite(pl_sd,guild_id_,1);
 
    clif_displaymessage(fd, "Player has joined selected guild.");
 
    return 0;
}

 

It gives me warning after I compile, It says;

 

 1>------ Build started: Project: map-server_sql, Configuration: Debug Win32 ------
1>  atcommand.c
1>c:\users\anjo\desktop\rathena - revision 17209\src\map\atcommand.c(9111): warning C4101: 'g' : unreferenced local variable
1>c:\users\anjo\desktop\rathena - revision 17209\src\map\atcommand.c(9113): warning C4101: 'm' : unreferenced local variable
1>  map-server_sql.vcxproj -> C:\Users\Anjo\Desktop\rathena - Revision 17209\vcproj-12\..\map-server_sql.exe
========== Build: 1 succeeded, 0 failed, 3 up-to-date, 0 skipped ==========

 

Though in-game, I couldn't work, I followed the syntax correctly whereas '@joinguild 1,anjo' (for example) It would display the clif_displaymessage 'Player has joined selected guild'

but with no luck, still unable to join.  /sob  I hope you have something else on your sleeves.

 

Oh and I forgot to thank you for replying. Thank you /thx

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

I didn't try it yet, that was just what I'd have try if I was doing the command. the warnings are just some variable that we don't use anymore.

You didn't have error on console ?


just converting should give something like :

int atcommand_joinguild(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
    struct map_session_data *pl_sd;
    struct guild *g;
    int guild_id_;
    struct guild_member m;
    nullpo_retr(-1, sd);
 
        memset(atcmd_output, '\0', sizeof(atcmd_output));
         memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
        sscanf(message, "%i,%23[^\n]", &guild_id_,atcmd_player_name);
    if (!message || !*message || !guild_id_ || !atcmd_player_name) {
        clif_displaymessage(fd, "Error. (usage: @joinguild <guild id>,<char name>).");
        return -1;
    }
 
    if ((pl_sd = map_nick2sd(atcmd_player_name)) == NULL) {
        clif_displaymessage(fd, msg_txt(3));
        return -1;
    }
 
    if (pc_get_group_level(sd) <  pc_get_group_level(pl_sd) )
      {    
        clif_displaymessage(fd, msg_txt(81));     
        return -1;
    }
 
    if ((g = guild_search(pl_sd->status.guild_id))!= NULL)
    {
        clif_displaymessage(fd, "Target player appears to already be in a guild.");
        return -1;
    }
 
    guild_makemember(&m,pl_sd); //This is line 7631
    pl_sd->guild_invite = guild_id_;
    intif_guild_addmember(pl_sd->guild_invite, &m );
    clif_displaymessage(fd, "Player has joined selected guild.");

    return 0;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  04/09/13
  • Last Seen:  

Sadly it still gives me error on compilation.  /sob

it says:

Error    4    error C2059: syntax error : ')'    c:\users\anjo\desktop\rathena - revision 17209\src\map\atcommand.c    9172    1    map-server_sql
Error    8    error C2059: syntax error : ')'    c:\users\anjo\desktop\rathena - revision 17209\src\map\atcommand.c    9178    1    map-server_sql
Warning    1    warning C4003: not enough actual parameters for macro 'msg_txt'    c:\users\anjo\desktop\rathena - revision 17209\src\map\atcommand.c    9172    1    map-server_sql
Warning    5    warning C4003: not enough actual parameters for macro 'msg_txt'    c:\users\anjo\desktop\rathena - revision 17209\src\map\atcommand.c    9178    1    map-server_sql
Warning    9    warning C4013: 'guild_makemember' undefined; assuming extern returning int    c:\users\anjo\desktop\rathena - revision 17209\src\map\atcommand.c    9188    1    map-server_sql
Warning    3    warning C4024: 'map_msg_txt' : different types for formal and actual parameter 1    c:\users\anjo\desktop\rathena - revision 17209\src\map\atcommand.c    9172    1    map-server_sql
Warning    7    warning C4024: 'map_msg_txt' : different types for formal and actual parameter 1    c:\users\anjo\desktop\rathena - revision 17209\src\map\atcommand.c    9178    1    map-server_sql
Warning    2    warning C4047: 'function' : 'map_session_data *' differs in levels of indirection from 'int'    c:\users\anjo\desktop\rathena - revision 17209\src\map\atcommand.c    9172    1    map-server_sql
Warning    6    warning C4047: 'function' : 'map_session_data *' differs in levels of indirection from 'int'    c:\users\anjo\desktop\rathena - revision 17209\src\map\atcommand.c    9178    1    map-server_sql
 
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

idepend on your ra version, if its, after r17151 (multimsg) change (wich look the case here)
msg_txt
(81)

to

msg_txt(sd,81)

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  04/09/13
  • Last Seen:  

idepend on your ra version, if its, after r17151 (multimsg) change (wich look the case here)

msg_txt(81)

to

msg_txt(sd,81)

 

This is getting frustrating, I am deeply sorry for being such a burden.

 

Anyway, it Compiled correctly though it warned me this:

 

1>c:\users\anjo\desktop\rathena - revision 17209\src\map\atcommand.c(9188): warning C4013: 'guild_makemember' undefined; assuming extern returning 
 
 
No error on console, It is usable in-game, it works! well, technically. I had to relog first to actually see that the character has joined the guild. Otherwise it won't count the character as part of the guild, Not even @refresh or @warp-ing to other places works as I hoped it would.
 
You have been a great help mr. Lighta! I greatly appreciate it! Though if you could fix this little bug, I would be so thankful!
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

in src/map/guild.h add the following:
void guild_makemember(struct guild_member *m,struct map_session_data *sd);
(you can put it like juste after guild_guildaura_refresh).

 

Ye sorry for this kind of help I would give you a proper diff normally but didn't have clean version to spare =(

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  297
  • Reputation:   15
  • Joined:  11/17/11
  • Last Seen:  

you can try using my mod from way back.

instead of @joinguild, it is called @guildinvite

http://rathena.org/board/topic/65688-leaveguild-breakguild-guildinvite/

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

He would need to accept the invitation with guild_invite wich I believe he didn't want to give the choice.

Link to comment
Share on other sites

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...