check job guild_member.

Like it~*

New member
Messages
175
Points
0
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.
http://herc.ws/board/topic/14435-add-a-new-commands-guild/
 
Code:
-	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:
 
http://herc.ws/board/topic/13947-request-limit-the-number-of-jobs-per-guild/ - Source
http://herc.ws/board/topic/14216-limit-the-number-of-jobs-per-guild/ - Script.
 
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.
 
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?
 

 
Last edited:
Back
Top