Jump to content

Question

2 answers to this question

Recommended Posts

  • 1
Posted (edited)

Like this?

I was looking at this topic and I think the script would work better like this so the player can enter multiple times throughout the week if he didn't use his 30 minutes up.
prontera,150,150,5	script	gold room	456,{
function t {
function s;
	set .@left, getarg(0);
	if ( .@left <= 0 ) return getarg(0);
	set .@day, .@left / 86400;
	set .@hour, .@left % 86400 / 3600;
	set .@min, .@left % 3600 / 60;
	set .@sec, .@left % 60;
	return ( ( .@day ? .@day +" day"+ s( .@day ) : "" ) + ( .@hour ? .@hour +" hour"+ s( .@hour ) : "" ) + ( .@min ? .@min +" min"+ s( .@min ) : "" ) + ( .@sec ? .@sec +" sec"+ s( .@sec,1 ) : "" ) );
function s { return ( ( getarg(0) > 1 ? "s" : "" ) + ( getarg(1,0) ? "" : " " ) ); }
}
	
	if ( gltimer <= 0 && enter_gold_room < gettimetick(2) ) {
		set gltimer, .glt;
		enter_gold_room = gettimetick(2) + 86400 * .dly;
	} else if ( enter_gold_room > gettimetick(2) && gltimer <= 0 ) {
		mes "I'm sorry you can't enter in the gold room. You must wait "+ t( enter_gold_room - gettimetick(2) )+".";
		close;
	}
	mes "You have "+t( gltimer )+" remaining.";
	select( "enter in the gold room" );
	warp .map$,0,0;
	end;

OnPCLoadMapEvent:
	if(strcharinfo(3)==.map$) {
		attachnpctimer;
		initnpctimer;
	} end;
	
OnTimer1000:
	if( playerattached() ){
		if(strcharinfo(3)!=.map$) {
			stopnpctimer;
			end;
		}
		set gltimer, gltimer-1;
		attachnpctimer; initnpctimer;
		if( gltimer <= 0 ) {
			stopnpctimer;
			warp "prontera",0,0;
			message strcharinfo(0), "end of time for the gold room";
			end;
		}
	}
	end;

OnInit:
	set        .dly ,	7           ; //Delay in days.
	set        .glt ,	1800        ; //Gold Room Timer in seconds.
	set        .map$,	"geffen"    ; //Gold Room map.
	setmapflag .map$,	mf_loadevent;
	end;
	
}
I was also thinking about doing this with a rental item like a pass but I'm not sure if the time is consumed while the player is offline. Edited by Skorm
  • Upvote 1
Posted

Like this?

prontera,150,150,5	script	gold room	456,{
function t {
function s;
	set .@left, getarg(0);
	if ( .@left <= 0 ) return getarg(0);
	set .@day, .@left / 86400;
	set .@hour, .@left % 86400 / 3600;
	set .@min, .@left % 3600 / 60;
	set .@sec, .@left % 60;
	return ( ( .@day ? .@day +" day"+ s( .@day ) : "" ) + ( .@hour ? .@hour +" hour"+ s( .@hour ) : "" ) + ( .@min ? .@min +" min"+ s( .@min ) : "" ) + ( .@sec ? .@sec +" sec"+ s( .@sec,1 ) : "" ) );
function s { return ( ( getarg(0) > 1 ? "s" : "" ) + ( getarg(1,0) ? "" : " " ) ); }
}

	if ( enter_gold_room > gettimetick(2) ) {
		mes "I'm sorry you can't enter in the gold room. you must wait "+ t( enter_gold_room - gettimetick(2) );
		close;
	}
	select( "enter in the gold room" );
	warp "geffen",0,0;	// your gold room map
	attachnpctimer;
	initnpctimer;
	enter_gold_room = gettimetick(2) + 86400 * 7;	// 1 week of delay
	end;
OnTimer1800000:	// 30 mins
	stopnpctimer;
	warp "prontera",0,0;
	message strcharinfo(0), "end of time for the gold room";
	end;
}

Read the comment in the script

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...