Jump to content
  • 0
Sign in to follow this  
Like it~*

check job guild_member.

Question

Hi, I'm trying to limit the number of jobs repeated per guild, checking via script. But, I'm having a lot of difficulties ... My knowledge is beginner and from what I've learned, we still have few commands to do this, making it even harder ...
Because of this, I've been researching and realized that rathena has some interesting commands, which could help further this work, so I created an issue.
 

-	script	ckeckguildjob	-1,{
OnPCLoadMapEvent:
query_sql "SELECT `guild_id`,`char_id`,`class`,`name` FROM `guild_member`",.@gi,.@ci,.@cl,.@na;
getguildmember(getcharid(0),2);
copyarray .@guildids[0],$@guildmembercid[0],$@guildmembercount;
set .@count, $@guildmembercount;
for (set .@a, 0; .@a < .@count;
set .@a, .@a + 1) {
attachrid .@partyids[.@a];
set .@jobs[.@a], Class;// Check Job from other current jobs
for (set .@b, 0; .@b < getarraysize(.@jobs); 
set .@b, .@b + 1) {
if (Class == .@jobs[.@b]) {
set .@matches, .@matches + 1;
}
}// Check if this job as too many
if (.@matches > 2) { // Too Many of the Same Job 
//**How to expel the player from the guild here?
}// Less than 2, so reset counter for next player
set .@matches, 0;
}
	end;
OnInit:
	setarray .castles$[0],
		"prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05",
		"payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05",
		"gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05",
		"aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05",
		"arug_cas01","arug_cas02","arug_cas03","arug_cas04","arug_cas05",
		"schg_cas01","schg_cas02","schg_cas03","schg_cas04","schg_cas05";
	for ( .@i = 0; .@i < 30; .@i++ )
		setmapflag .castles$[.@i], mf_loadevent;
	end;
}

 

 

 
As for my work so far, it has been this way, but it still does not work, as I tried to use getguildmember and this command only appends a specific guild and a full check is required in all guilds on the server. I also thought about doing a check every time someone enters a guild, and if it already has a certain amount of a certain class, it expels the player, but I did not find any form. So I ended up having no idea. So I ask for everyone's help.
 
Topics created with this theme, but no answer:
 
 
Note: I know this might be better done by source, but it would be more difficult and complicated, I do not have the knowledge to do so.

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
Guest

I think running "code" upon someone joining a guild can only be done by source.
In source I would start with guild.c at line 631, looks like this: int guild_invite(struct map_session_data *sd, struct map_session_data *tsd) {
And if the invited character job is already at the limit the invitation is canceled.

Now to your script:
Does your script try to expel guildmember upon joining a map after the check?
If yes: how you want to decide who is removed? Random?
 

Edited by Guest

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.