Jump to content
  • 0

guild room rental


powkda

Question


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  89
  • Reputation:   1
  • Joined:  11/11/17
  • Last Seen:  

Good afternoon, I need a npc that the leader of a guild rent a room and that only members of his guild have access to the room.
Example: guild leader rented the room, the member typed the command @guildroom, if he is a member of the guild he will enter the room, if not, the message will appear: you do not have a guild with a guild room.

remembering that if another guild leader is going to rent, there will be other rooms too, I will leave 30 rooms ready

I thank you for your attention.

Edited by powkda
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

You could try below

prontera,150,150,6	script	Gold Room Manager	2_M_OLDBLSMITH,{
	function CheckRoom;
	.@guild = getcharid(2);
	if (!.@guild) {
		mes .npc$;
		mes "You are not in guild";
		close;
	}
	if (strcharinfo(0) != getguildmaster(.@guild)) {
		mes .npc$;
		mes "Only guild leader can talk to me";
		close;
	}
	if (Zeny < .zeny) {
		mes .npc$;
		mes "You need " + (callfunc ("F_InsertComma", .zeny)) + " zeny in order to rent a room.";
		close;
	}
	mes .npc$;
	mes "Which map do you want to rent?";
	next;
	while (.@i < .size) {
		if (CheckRoom(.@i) && getd(".Room"+.@i) == getcharid(2))
			.@owned++;
		.@menu$ += .Maps$[.@i] + " - [" + (CheckRoom(.@i) ? "Unavailable" : "Available") + "]:";
		.@i++;
	}
	.@s = select(.@menu$) - 1;
	if (CheckRoom(.@s)) {
		mes .npc$;
		mes "I told you it's unavailable!";
		close;
	}
	if (.@owned) {
		mes .npc$;
		mes "You already owned a room! Make room for others!";
		close;
	}
	mes .npc$;
	mes "Are you sure you want to rent " + .Maps$[.@s] + "?";
	next;
	if (select("Yes:No") - 1) end;
	Zeny -= .zeny;
	setd ".Room"+.@s, .@guild;
	announce "Guild " + getguildname(.@guild) + " has occupied gold room " + .Maps$[.@s], 0;
	close;
	
	// true = occupied | false = available
	function CheckRoom {
		.@rn = getarg(0, 0);
		return getd(".Room"+.@rn) ? true : false;
	}
	
	// Release rooms every 2 hours
	OnMinute00:
		if (gettime(DT_HOUR) % 2) end;
		while (.@i < .size) {
			setd ".Room"+.@i, 0;
			.@i++;
		}
		announce "Gold rooms are now available again for rent!", 0;
		end;
	
	OnGuildRoom:
		if (!getcharid(2)) end;
		while (.@i < .size) {
			if (getd(".Room"+.@i) == getcharid(2)) {
				warp .Maps$[.@i], 0, 0;
				break;
			}
			.@i++;
		}
		end;
	
	OnInit:
		.npc$ = "[" + strnpcinfo(1) + "]";
		setarray .Maps$[0], "ordeal_3-1", "ordeal_3-2";
		.size = getarraysize(.Maps$);
		while (.@i < .size) {
			setmapflag .Maps$[.@i], MF_NOWARPTO;
			.@i++;
		}
		.zeny = 5000;
		bindatcmd "guildroom", strnpcinfo(1) + "::OnGuildRoom";
		end;
}

-	script	GRBuff	FAKE_NPC,{
	if (@delay > gettimetick(2)) {
		emotion ET_ANGER;
		npctalk "Use me after " + (@delay - gettimetick(2)) + " second(s).";
	} else {
		specialeffect2 EF_HEAL2;
		percentheal 100,100;
		specialeffect2 EF_INCAGILITY;
		sc_start SC_INCREASEAGI,240000,10;
		specialeffect2 EF_BLESSING;
		sc_start SC_BLESSING,240000,10;
		@delay = gettimetick(2) + 3; // 3 seconds delay
	}
	end;
}

// Add more npc on every room
ordeal_3-1,149,149,6	duplicate(GRBuff)	Kiddo#ord31	4W_KID
ordeal_3-2,153,153,6	duplicate(GRBuff)	Kiddo#ord32	4W_KID

// Monsters
ordeal_3-1,0,0	monster	Dokebi	1110,50,5000
ordeal_3-2,0,0	monster	Dokebi	1110,50,5000

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  89
  • Reputation:   1
  • Joined:  11/11/17
  • Last Seen:  

On 4/20/2020 at 10:25 PM, Patskie said:

You could try below


prontera,150,150,6	script	Gold Room Manager	2_M_OLDBLSMITH,{
	function CheckRoom;
	.@guild = getcharid(2);
	if (!.@guild) {
		mes .npc$;
		mes "You are not in guild";
		close;
	}
	if (strcharinfo(0) != getguildmaster(.@guild)) {
		mes .npc$;
		mes "Only guild leader can talk to me";
		close;
	}
	if (Zeny < .zeny) {
		mes .npc$;
		mes "You need " + (callfunc ("F_InsertComma", .zeny)) + " zeny in order to rent a room.";
		close;
	}
	mes .npc$;
	mes "Which map do you want to rent?";
	next;
	while (.@i < .size) {
		if (CheckRoom(.@i) && getd(".Room"+.@i) == getcharid(2))
			.@owned++;
		.@menu$ += .Maps$[.@i] + " - [" + (CheckRoom(.@i) ? "Unavailable" : "Available") + "]:";
		.@i++;
	}
	.@s = select(.@menu$) - 1;
	if (CheckRoom(.@s)) {
		mes .npc$;
		mes "I told you it's unavailable!";
		close;
	}
	if (.@owned) {
		mes .npc$;
		mes "You already owned a room! Make room for others!";
		close;
	}
	mes .npc$;
	mes "Are you sure you want to rent " + .Maps$[.@s] + "?";
	next;
	if (select("Yes:No") - 1) end;
	Zeny -= .zeny;
	setd ".Room"+.@s, .@guild;
	announce "Guild " + getguildname(.@guild) + " has occupied gold room " + .Maps$[.@s], 0;
	close;
	
	// true = occupied | false = available
	function CheckRoom {
		.@rn = getarg(0, 0);
		return getd(".Room"+.@rn) ? true : false;
	}
	
	// Release rooms every 2 hours
	OnMinute00:
		if (gettime(DT_HOUR) % 2) end;
		while (.@i < .size) {
			setd ".Room"+.@i, 0;
			.@i++;
		}
		announce "Gold rooms are now available again for rent!", 0;
		end;
	
	OnGuildRoom:
		if (!getcharid(2)) end;
		while (.@i < .size) {
			if (getd(".Room"+.@i) == getcharid(2)) {
				warp .Maps$[.@i], 0, 0;
				break;
			}
			.@i++;
		}
		end;
	
	OnInit:
		.npc$ = "[" + strnpcinfo(1) + "]";
		setarray .Maps$[0], "ordeal_3-1", "ordeal_3-2";
		.size = getarraysize(.Maps$);
		while (.@i < .size) {
			setmapflag .Maps$[.@i], MF_NOWARPTO;
			.@i++;
		}
		.zeny = 5000;
		bindatcmd "guildroom", strnpcinfo(1) + "::OnGuildRoom";
		end;
}

-	script	GRBuff	FAKE_NPC,{
	if (@delay > gettimetick(2)) {
		emotion ET_ANGER;
		npctalk "Use me after " + (@delay - gettimetick(2)) + " second(s).";
	} else {
		specialeffect2 EF_HEAL2;
		percentheal 100,100;
		specialeffect2 EF_INCAGILITY;
		sc_start SC_INCREASEAGI,240000,10;
		specialeffect2 EF_BLESSING;
		sc_start SC_BLESSING,240000,10;
		@delay = gettimetick(2) + 3; // 3 seconds delay
	}
	end;
}

// Add more npc on every room
ordeal_3-1,149,149,6	duplicate(GRBuff)	Kiddo#ord31	4W_KID
ordeal_3-2,153,153,6	duplicate(GRBuff)	Kiddo#ord32	4W_KID

// Monsters
ordeal_3-1,0,0	monster	Dokebi	1110,50,5000
ordeal_3-2,0,0	monster	Dokebi	1110,50,5000

 

thank you very much my friend, i will test and give you the feedback ♥

 

friend let me ask you, can someone rent the room without knowing which one?
do for example like this:
Would you like to rent a room for your clan?
then the person rents without knowing the map only when they go to it

and also put the remaining time that the clan has with the rented room, and may extend that time

 

I found a possible bug, when I restart the server or give @reloadscript the clan loses the room

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