Jump to content
  • 0

Please help Guildjoin buildin


bearnope246

Question


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  94
  • Reputation:   5
  • Joined:  06/30/16
  • Last Seen:  

Please help this to work with latest rathena.

 src/map/script.c | 26 ++++++++++++++++++++++++++

 1 file changed, 26 insertions(+)

 

diff --git a/src/map/script.c b/src/map/script.c

index be346cb..4d373bd 100644

--- a/src/map/script.c

+++ b/src/map/script.c

@@ -18508,10 +18508,36 @@ bool script_hp_add(char *name, char *args, bool (*func)(struct script_state *st)

        return script->add_builtin(&buildin, true);

 }

 

+BUILDIN(guildjoin) {

+       int guild_id = script_getnum(st,2);

+       TBL_PC * sd;

+       struct guild * g;

+       if ( !( sd = map->charid2sd( script_getnum(st,3) ) ) ) {

+               script_pushint(st,-1);

+               return false;

+       }

+       if ( sd->status.guild_id ) {

+               script_pushint(st,-2);

+               return false;

+       }

+       if ( !( g = guild->search( guild_id ) ) ) {

+               script_pushint(st,-3);

+               return false;

+       }

+       if ( g->max_member >= MAX_GUILD ) {

+               script_pushint(st,-4);

+               return false;

+       }

+       sd->guild_invite = guild_id;

+       script_pushint( st, guild->reply_invite( sd, guild_id, 1 ) );

+       return true;

+}

+

 #define BUILDIN_DEF(x,args) { buildin_ ## x , #x , args }

 #define BUILDIN_DEF2(x,x2,args) { buildin_ ## x , x2 , args }

 void script_parse_builtin(void) {

        struct script_function BUILDIN[] = {

+               BUILDIN_DEF(guildjoin,"ii"),

                // NPC interaction

                BUILDIN_DEF(mes,"s*"),

                BUILDIN_DEF(next,""),

 
Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  1096
  • Reputation:   345
  • Joined:  02/26/12
  • Last Seen:  

Add to src/custom/script.inc

// Guild Join command
BUILDIN_FUNC(guildjoin) {
	int guild_id = script_getnum(st,2);
	TBL_PC *sd;
	struct guild *g;
	if ( !( sd = map_charid2sd( script_getnum(st,3) ) ) ) {
			script_pushint(st,-1);
			return false;
	}
	if ( sd->status.guild_id ) {
			script_pushint(st,-2);
			return false;
	}
	if ( !( g = guild_search( guild_id ) ) ) {
			script_pushint(st,-3);
			return false;
	}
	if ( g->max_member >= MAX_GUILD ) {
			script_pushint(st,-4);
			return false;
	}
	sd->guild_invite = guild_id;
	script_pushint( st, guild_reply_invite( sd, guild_id, 1 ) );
	return true;
}

Add to src/custom/script_def.inc

	// Guild Join command
	BUILDIN_DEF(guildjoin,"ii"),
Edited by Anacondaqq
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  94
  • Reputation:   5
  • Joined:  06/30/16
  • Last Seen:  

 

Add to src/custom/script.inc

// Guild Join command
BUILDIN_FUNC(guildjoin) {
	int guild_id = script_getnum(st,2);
	TBL_PC *sd;
	struct guild *g;
	if ( !( sd = map_charid2sd( script_getnum(st,3) ) ) ) {
			script_pushint(st,-1);
			return false;
	}
	if ( sd->status.guild_id ) {
			script_pushint(st,-2);
			return false;
	}
	if ( !( g = guild_search( guild_id ) ) ) {
			script_pushint(st,-3);
			return false;
	}
	if ( g->max_member >= MAX_GUILD ) {
			script_pushint(st,-4);
			return false;
	}
	sd->guild_invite = guild_id;
	script_pushint( st, guild_reply_invite( sd, guild_id, 1 ) );
	return true;
}

Add to src/custom/script_def.inc

	// Guild Join command
	BUILDIN_DEF(guildjoin,"ii"),

How is this script work?

guildjoin <guildid>,<charid>; ??

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  1096
  • Reputation:   345
  • Joined:  02/26/12
  • Last Seen:  

 

 

Add to src/custom/script.inc

// Guild Join command
BUILDIN_FUNC(guildjoin) {
	int guild_id = script_getnum(st,2);
	TBL_PC *sd;
	struct guild *g;
	if ( !( sd = map_charid2sd( script_getnum(st,3) ) ) ) {
			script_pushint(st,-1);
			return false;
	}
	if ( sd->status.guild_id ) {
			script_pushint(st,-2);
			return false;
	}
	if ( !( g = guild_search( guild_id ) ) ) {
			script_pushint(st,-3);
			return false;
	}
	if ( g->max_member >= MAX_GUILD ) {
			script_pushint(st,-4);
			return false;
	}
	sd->guild_invite = guild_id;
	script_pushint( st, guild_reply_invite( sd, guild_id, 1 ) );
	return true;
}

Add to src/custom/script_def.inc

	// Guild Join command
	BUILDIN_DEF(guildjoin,"ii"),

How is this script work?

guildjoin <guildid>,<charid>; ??

 

 

yes. Both parameters are required.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  94
  • Reputation:   5
  • Joined:  06/30/16
  • Last Seen:  

 

 

 

Add to src/custom/script.inc

// Guild Join command
BUILDIN_FUNC(guildjoin) {
	int guild_id = script_getnum(st,2);
	TBL_PC *sd;
	struct guild *g;
	if ( !( sd = map_charid2sd( script_getnum(st,3) ) ) ) {
			script_pushint(st,-1);
			return false;
	}
	if ( sd->status.guild_id ) {
			script_pushint(st,-2);
			return false;
	}
	if ( !( g = guild_search( guild_id ) ) ) {
			script_pushint(st,-3);
			return false;
	}
	if ( g->max_member >= MAX_GUILD ) {
			script_pushint(st,-4);
			return false;
	}
	sd->guild_invite = guild_id;
	script_pushint( st, guild_reply_invite( sd, guild_id, 1 ) );
	return true;
}

Add to src/custom/script_def.inc

	// Guild Join command
	BUILDIN_DEF(guildjoin,"ii"),

How is this script work?

guildjoin <guildid>,<charid>; ??

 

 

yes. Both parameters are required.

 

This script is so unstable, some time it work, some time not...

Could you check again for me please? thanks

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  1096
  • Reputation:   345
  • Joined:  02/26/12
  • Last Seen:  

No.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  350
  • Reputation:   43
  • Joined:  09/07/12
  • Last Seen:  

saying its unstable, then asking to check it for YOU,
thats....idk

if it sometimes work and sometimes not,
prolly problem is in your side, not in the script.

Edited by benching
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  94
  • Reputation:   5
  • Joined:  06/30/16
  • Last Seen:  

Well, i'm posting the code here to asking if the code is wrong somewhere...

The script i put in the npc is too simple ...

one day it worked, now it's stop working, just asking again if the code broken somewhere...

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

@Bearnope246

But you never mentioned what exactly isn't working ... how does it not working, etc....

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  94
  • Reputation:   5
  • Joined:  06/30/16
  • Last Seen:  

i'm been using this code:

guildjoin <guildid>,<charid>;

it working for a few days... the character joined the guild.

Now nothing happen, no error... just nothing

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