Jump to content
  • 0

Requesting for GM Room Script


Question

Posted

I need a script that the admin can only access the NPC. This npc can Open or Close the GM House. If the admin set the NPC to Open the house, means all the player can enter to the GM House. If the admin set the NPC to Close the house, means all normal player can't enter the GM House only the GM's can enter there. Please help me.. =)

5 answers to this question

Recommended Posts

Posted (edited)

Try this :

 

EDIT : add a check, trigger script only on normal players

prontera,150,150,0    script    Sample    100,{
    if ( getgmlevel() < 99 ) end;
    mes "What can i do for you?";
    next;
    if ( select("Open the house:Close the house") == 2 ) {
        if ( !.open ) 
            mes "The house is already closed";
        else {
            set .open, 0;
            mes "Closed";
            announce strcharinfo(0)+ " closed the GM house",0;
        }
    } else {
        if ( .open ) 
            mes "The house is already opened";
        else {
            set .open, 1;
            mes "Opened";
            announce strcharinfo(0)+ " opened the GM house",0;
        }
    }
    close;
}

-    script    GMHouse    -1,{
    set .check, getvariableofnpc(.open, "Sample");
    OnPCLoadMapEvent:
        getmapxy(.@map$, .@x, .@y, 0);
        if ( ( .@map$ == "payon" && !getgmlevel() ) && !.check ) {
            sleep2 100;
            warp "SavePoint",0,0;
        }
        end;
}
payon    mapflag    loadevent

A few notes : 

1. If you would change the NPC name Sample make sure you change this part of the script :

set .check, getvariableofnpc(.open, "Sample");

to : 

set .check, getvariableofnpc(.open, "<new name of npc>");

2. Change payon to your corresponding GM house map :

if ( ( .@map$ == "payon" && !getgmlevel() ) && !.check ) {

to :

if ( ( .@map$ == "<GM house map>" && !getgmlevel() ) && !.check ) {

and :

payon    mapflag    loadevent

to :

<GM house map>    mapflag    loadevent

 

PS : Didn't test this script. So if you encounter an error or a bug. Post it in a detailed manner.

Edited by Patskie
Posted (edited)
map,x,y,z	script	NPC	749,{
	if(getgroupid() >= .groupLevel){
		if($gmRoom){
			switch(select("Close Room","Quit")){
				case 1:
					set $gmRoom,0;
					mes "Done";
					close;
					
				case 2:
					mes "ok";
					close;
			}
		} else{
			switch(select("Open Room","Quit")){
				case 1:
					set $gmRoom,1;
					mes "Done";
					close;
					
				case 2:
					mes "ok";
					close;
			}
		}
	} else{
		if($gmRoom){
			mes .npc$,"Do you want to go to the Gm Room ?";
			next;
				switch(select("Yes","No")){
					case 1:
						mes .npc$,"Here we go !";
						close2
						warp .map$[0],.map$[1],.map$[2];
						end;
					case 2:
						mes .npc$,"Ok";
						close;
				}
		} else {
			mes .npc$,"Gm Room is actually locked.";
			close;
		}
	}

	OnInit:
		setarray .map$,"prontera",100,100; // Where to warp player/gm
		set .npc$,"NPC"; // Name of the Npc
		set .gmLvl,60; // Minimum Group Level to access the npc
	end;
}	

Edit: You should use Patskie's one :)

Edited by Khazou
Posted

hmm misunderstood your request. so you want a warper?

prontera,150,150,0    script    Sample    100,{
    if ( getgmlevel() < 99 ) end;
    mes "What can i do for you?";
    next;
    if ( select("Open the house:Close the house") == 2 ) {
        if ( !.open ) 
            mes "The house is already closed";
        else {
            set .open, 0;
            mes "Closed";
            announce strcharinfo(0)+ " closed the GM house",0;
        }
    } else {
        if ( .open ) 
            mes "The house is already opened";
        else {
            set .open, 1;
            mes "Opened";
            announce strcharinfo(0)+ " opened the GM house",0;
        }
    }
    close;
}

prontera,100,100,0    script    Warper    100,{
    set .check, getvariableofnpc(.open, "Sample");
    if ( .check )
        warp "prontera",150,150;
    end;
}

Change prontera to your GM house map

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