Jump to content
  • 0

Room Rental (A little help)


JRZ

Question


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  42
  • Reputation:   0
  • Joined:  08/22/12
  • Last Seen:  

Let me tell you a little about me; I'm scripter but never attempted to try making a rental scripts. /heh

I will show you about the idea of this rental room, any missing commands are in need of the helping hand out there :)

Note: I used y_sure and n_quit so other rooms will just use those to repeat the cycle of the script for the other rooms.

mes <name>;

mes "We provide private rooms for your needs.";

mes "Rental costs 50k and you can add a password on it.";

mes "Remember if you left the room or no ones left in it, the rental will be expired.";

mes "Which room would you like to rent?";

menu "Room 1",rm1,"Room 2",rm2"Room 3",rm3"Room 4",rm4"Room 5",rm5"Room 6",rm6"Room 7",rm7"Room 8",rm8"Room 9",rm9"Room 10",rm10;

(Example I chose Room 1)

rm1:

mes <name>;

mes "Are you sure to rent this private room?";

menu "Yes",y_sure,"No",n_quit;

y_sure:

set @check,Zeny/50000;

if (Zeny < 50000) { //Quick made up

next;

mes <name>;

mes "Sorry, ^427A4C"+strcharinfo(0)+"^000000, but you cant afford my service.";

close;

} else

next;

mes <name>;

mes "Please input your desired password. Please make sure to remember your password,";

mes "or else you have to pay for another rent.";

next;

input .@pwd$;

next;

mes <name>;

mes "Please re-type your password.";

input .@pwd$;

next;

mes <name>;

mes "Thank you for using my service. Have a nice day!";

next;

set Zeny,Zeny-50000;

warp "<mapname>",0,0;

end;

n_quit:

mes <name>;

mes "Bah. Don't waste my time.";

emotion 10; //lol

close;

I also want to add the mapcheck for the room, if the room is empty the npc will assume that its available for renting, and if not, the npc will say:

mes <name>;

mes "This room is currently used. Do you know the password so you can get in too?";

menu "Yes",yes,"Nevermind",quit; quit: close;

Thanks in advanced.. /thx

Edited by ronjrz
Link to comment
Share on other sites

13 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

I made this private mvp room script, which using almost the same system as your script

weird, I remembered I made a snippet script before inside eathena script support section ...

but right now I couldn't find back that topic

( wahahahah I got 6.6k post count there, I also can't find my own post myself xD )

anyway I just write this again from scratch

prontera,155,187,5    script    sdfjhsdfkj    100,{

   // script check for empty room
   for ( .@i = 1; .@i <= 8; .@i++ )
       if ( getmapusers( "06guild_0"+ .@i ) == 0 )
           .password$[.@i] = "";

   mes "select a room";
   mes " ";
   for ( .@i = 1; .@i <= 8; .@i++ )
       if ( .password$[.@i] != "" )
           mes "^000000Room no."+ .@i +" = ^0000FF"+ .creater_name$[.@i];
   next;
   for ( .@i = 1; .@i <= 8; .@i++ )
       if ( .password$[.@i] == "" )
           .@menu$ = .@menu$ +"^000000Room no."+ .@i +" = ^FF0000<Free>:";
       else
           .@menu$ = .@menu$ +"^000000Room no."+ .@i +" = ^0000FF"+ .creater_name$[.@i] +":";
   .@room = select( .@menu$ );
   if ( .password$[ .@room ] == "" ) {
       if ( zeny < 50000 ) {
           mes "you need 50,000 zeny to rent a room";
           close;
       }
       mes "this room is available";
       mes "please input a password";
       mes "string length : min 4, max 30";
       next;
       if ( input( .@pass$, 4, 30 ) ) {
           mes "invalid string length";
           close;
       }
       if ( .@pass$ == " " ) close;
       mes "password set to this ?";
       mes "^FF0000"+ .@pass$;
       next;
       if ( select ( "Yes", "No" ) == 2 ) close;

       // double check is there anyone rent faster than you
       if ( .password$[ .@room ] != "" ) {
           mes "I'm sorry but somebody rent this room faster than you";
           close;
       }

       // again double check the zeny requirement because of Ragnarok stupid mail system (send mail using friend list) <.< always make a habit to counter check item and zeny requirement
       if ( zeny < 50000 ) {
           mes "don't cheat me";
           close;
       }
       zeny -= 50000; // OOOOPPSS !!
       .password$[ .@room ] = .@pass$;
       .creater_name$[ .@room ] = strcharinfo(0);
       warp "06guild_0"+ .@room, 49, 49;
       end;
   }
   mes "input the password";

   // always have some recovery system for GMs to recover password
   if ( getgmlevel() == 99 ) {
       mes " ";
       mes "^FF0000 Admin ONLY";
       mes "^0000FF"+ .password$[ .@room ];
   }

   next;
   input .@pass$;
   if ( .@pass$ != .password$[ .@room ] ) {
       mes "wrong password input";
       close;
   }
   warp "06guild_0"+ .@room, 49, 49;
   end;
}

06guild_01    mapflag    nowarpto
06guild_02    mapflag    nowarpto
06guild_03    mapflag    nowarpto
06guild_04    mapflag    nowarpto
06guild_05    mapflag    nowarpto
06guild_06    mapflag    nowarpto
06guild_07    mapflag    nowarpto
06guild_08    mapflag    nowarpto

Edited by AnnieRuru
  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  42
  • Reputation:   0
  • Joined:  08/22/12
  • Last Seen:  

BumP!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  42
  • Reputation:   0
  • Joined:  08/22/12
  • Last Seen:  

Ahh.. Thanks AnnieRuru! But this is just for one map, can you tell me how to add rooms/maps on the script? since I have 10 rooms for it xD

Edited by JRZ
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

I thought I used 8 rooms ?

	for ( .@i = 1; .@i <= 8; .@i++ )
	if ( getmapusers( "06guild_0"+ .@i ) == 0 )
		.password$[.@i] = "";

loop through these 8 maps, 06guild_01 ~ 06guild_08,

if there's nobody in these room, that room password is reset

btw, do you know how to use array ?

.@room = select( .@menu$ );
if ( .password$[ .@room ] == "" ) {

I used dynamic menu

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  42
  • Reputation:   0
  • Joined:  08/22/12
  • Last Seen:  

array? not much really. im only an average scripter, not a pro like you xD. I said 10 rooms because I duplicated map into 10 maps. To be precise Room_01 to Room_10? (I changed the duplicated map name to be easy to add in your script) But can you teach me how to change ( "06guild_0"+ .@i ) into ( "Room_0"+ .@i ) till room 10. Correct me If im wrong. ty

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  132
  • Reputation:   8
  • Joined:  07/19/12
  • Last Seen:  

I'm pretty sure you'd be able to understand her script if you'd take more time reading the script_commands txt located in the doc folder of your athena.

Anyway, if you already have custom maps named like that, ranging from Room_01 - Room 10, then you can just simply rename it like that and change .@i <=8 to .@<=10

eg. ( "Room_0"+ .@i ) will equal to Room_01 if the value of .@i is 1. Since the (+) sign concatenates both the scope variable (.@i) and the string ("Room_0").

OR, you can have that string replaced with an array (with index of the map names you want to go), eg. setarray Rooms[.@i],"gld_dun02",gld_dun04;

while (.@i <= 10){

if(getmapusers(Rooms[.@i]) == 0 )

.password$[.@i] = "";

}

if .@i happens to be equal to 1, then the password of gld_dun04 will be erased.

Edited by Valiente
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  42
  • Reputation:   0
  • Joined:  08/22/12
  • Last Seen:  

I'm pretty sure you'd be able to understand her script if you'd take more time reading the script_commands txt located in the doc folder of your athena.

Yes I am aware of that too. Thanks for that. I just want to make sure im right on track :)

change ( "06guild_0"+ .@i )   TO   ( "Room_0"+ .@i )

Also..

( .@i = 1; .@i <= 8; .@i++ )   TO   ( .@i = 1; .@i <= 10; .@i++ )

Correct me if im wrong guys xD

Edited by JRZ
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  132
  • Reputation:   8
  • Joined:  07/19/12
  • Last Seen:  

I just edited my post. lol for a little bit detail of what you wanna do.

Anyway, that's correct ONLY If map names from Room_0 - Room_ 10 exist.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  42
  • Reputation:   0
  • Joined:  08/22/12
  • Last Seen:  

I just edited my post. lol for a little bit detail of what you wanna do.

Anyway, that's correct ONLY If map names from Room_0 - Room_ 10 exist.

Thanks. Yep those maps exists I duplicated maps and named them Room_01 - Room_10. :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  331
  • Reputation:   63
  • Joined:  11/29/11
  • Last Seen:  

Room_010 not room_10 because its room_0<number> in the script

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

actually with my current ways, the map name has to be Room_01 ~ Room_010

because I put a '0' in the map name XD

has to do some zerofill check

    // script check for empty room
   for ( .@i = 1; .@i <= 10; .@i++ )
       if ( getmapusers( "Room_"+( ( .@i < 10 )? "0":"" )+ .@i ) == 0 )
           .password$[.@i] = "";

wahahha

dastgirpojee post faster than me

Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  42
  • Reputation:   0
  • Joined:  08/22/12
  • Last Seen:  

Thanks dastgirpojee & AnnieRuru. I saw that one coming. I forgot to post that I change the "Room_0" to "Room_" cus of just like you said xD. Anyways Thanks again :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   1
  • Joined:  10/19/12
  • Last Seen:  

hehe I saw this yesterday so I thought of doing it :P doing it secretly though since it's my first time making a script :) I'll post it here when I'm done

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