Jump to content
Hyroshima

Script Command: guild_ally

Recommended Posts

It's not a big deal but I'm providing a utility that I made because I hadn't found anything that did this, basically you pass 2 guild IDs to check if they are allies, 1 for true and 0 for false.

 

script.c

/*
//Hyroshima *guild_ally(guild_id1,guild_id2)
//=
PARAM 1 (guild1)
PARAM 2 (guild2)
RETURN 0= false, 1= true
*/
static BUILDIN(guild_ally)
{
    int guild1,guild2 = 0;

	if(script_getnum(st,2) == script_getnum(st,3))
	{
		ShowError("buildin_guild_ally: guild_id1(%d) cannot be equal to guild_id2(%d).\n",script_getnum(st,2),script_getnum(st,3));
		script_pushint(st,0);
		return true;
	}
	
	guild1 = script_getnum(st,2);
	guild2 = script_getnum(st,3);
	
	if(guild->search(guild1) == NULL)
	{
		ShowError("buildin_guild_ally: Guild does not exist (guild_id1: %d).\n",guild1);
		script_pushint(st,0);
		return true;
	}
	if(guild->search(guild2) == NULL)
	{
		ShowError("buildin_guild_ally: Guild does not exist (guild_id2: %d).\n",guild2);
		script_pushint(st,0);
		return true;
	}

	script_pushint(st,guild->isallied(guild1,guild2));
    return true;
}

 

BUILDIN_DEF(guild_ally,"ii"),

 

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

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