Jump to content
  • 0

causing my server to crash


Fresh prince

Question


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

Please take a look at this script. It causes my server to crash after I run it for a while

Thanks in advance.

can someone change it's timer? onpcloginevent, they have 20 seconds to input their password otherwise they will be kicked. I need the simplest one please ty

Edited by Fresh prince
Link to comment
Share on other sites

10 answers to this question

Recommended Posts


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

Can you tell error in map-server?

To Change Timer Simply Change

OnTimer20000:

20000 means 20 seconds.

to remove timer remove these lines,

attachnpctimer ""+strcharinfo(0)+"";
    initnpctimer;

And

OnTimer20000:
    atcommand "@kick "+strcharinfo(0);
    end;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

I appreciate your time answering my questions.

There are no errors seriously. It's just the map crashes for some unknown reason.

2 questions:

1.How many Onpcloginevent is allowed in a server? I'm wondering maybe it crashes because of that.

Thanks!

2.How to unmute?

Hi tried adding atcommand "@mute "+strcharinfo(0); on onPCloginEvent.

It worked when i logged in but when i typed int the correct password the mute did not go away!

I did put another atcommand "@unmute "+strcharinfo(0); before close;

"player not attached!" error message. <-map server

Please help :(

Edited by Fresh prince
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Post your current script using codebox.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

prontera,200,200,3	script	Security	468,{

if (#password$ == "") {

	mes "Hello. Would you like a ^0000FFpass code?^000000";
	mes "lock your";
	mes "account to prevent hacking";
	switch(select("No!:Yes.")) {
	case 1:
		next;

		mes "Okay."
		close;
	case 2:

		mes "^FF0000Please type in your lock code.^000000";
		input .@tempword$;
		next;

		mes "Is this correct?";
		mes "	 ^FF0000"+.@tempword$+"^000000";
		   if (select("Yes:No") == 2) close;
		next;
		set #password$, .@tempword$

		mes "^FF0000All done.^000000 Your account is currently locked." ;
		mes "Please relog and follow instructions if you" ;
		mes "wish to unlock." ;
		close;
	}
}

mes "Please enter your ^0000FFlock code^000000";
input .@try$;
if(.@try$ != #password$) {
	mes "Sorry. That is incorrect.";
	mes "If you forgot your ^0000FFlock code^000000, You can!";
	next;
	mes "notify GMs";
	close;
}
next;
mes "Hello again. Would you like to change your ^0000FFlock code?^000000";
switch(select(" ^FF0000Yes Please!^000000: ^0000FFDelete it please!^000000")) {
case 1:	
next;
mes "Okay. Please enter your current ^0000FFlock code.^000000";
input @try$;
if(.@try$ = #password$) {
	mes "Sorry. That is incorrect.";
	close;
}
next;
mes "Okay. Please enter your new ^0000FFlock code.^000000";
input .@tempword$;
next;
mes "Is this correct?";
mes "	 ^FF0000"+.@tempword$+"^000000";
if (select("Yes:No") == 2) close;
next;
set #password$ @tempword$;
mes "Very good. Your new ^0000FFlock code^000000 has been saved.";
close;


case 2:
next;
mes "Are you sure!";
if (select"Yes:No") == 2) close;
next;
set #Password$,"";
mes "You have deleted your ^0000FFlock code.^000000" ;
mes "You can always comeback to setup" ;
mes "a new one if you change your mind." ;
close;	
}

OnPCLoginEvent:
if (#password$ == "") end;
sc_start sc_berserk, 1000000000, 1;
atcommand "@mute"+ strcharinfo(0);
mes "COOL RAGNAROK ONLINE";
mes " ";
mes "Please enter the ^0000FFlock code ^000000 attached to this account.";
mes "You have 20 seconds.";
attachnpctimer ""+strcharinfo(0)+"";
initnpctimer;
input .@try$;
if(.@try$ != #password$) {
	next;
	mes "Sorry, that is not correct. If you've forgotten your ^0000FFlock code^000000, ";
	mes "Notify any ^FF0000Admin^000000 to fix this issue. ";
	mes "hello and ";
	mes "Goodbye.";
	sleep2 5000;
	atcommand "@kick "+strcharinfo(0);
	end;
OnTimer20000:
atcommand "@kick "+strcharinfo(0);
end;

}
mes "Password$ ^0000FFCorrect! ^000000 Welcome to Cool-RO!";
stopnpctimer;
sc_end sc_berserk;
atcommand "@unmute" +strcharinfo(0);
close;
}

Please help :(

Edited by Fresh prince
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

There is a laps of time after unmute. If you are still mute, atcommand script doesn't work. You should used berserk instead of mute.

OnPCLoginEvent:
   if (#password$ == "") end;
   percentheal 100,0;
   sc_start sc_berserk, 1000000000, 1;
   mes "COOL RAGNAROK ONLINE";
   mes " ";
   mes "Please enter the ^0000FFlock code ^000000 attached to this account.";
   mes "You have 20 seconds.";
   attachnpctimer strcharinfo(0);
   initnpctimer;
   input .@try$;
   if(.@try$ != #password$) {
       next;
       mes "Sorry, that is not correct. If you've forgotten your ^0000FFlock code^000000, ";
       mes "Notify any ^FF0000Admin^000000 to fix this issue. ";
       mes "hello and ";
       mes "Goodbye.";
       stopnpctimer;
       detachnpctimer;
       sleep2 5000;
       sc_end sc_berserk;
       atcommand "@kick "+strcharinfo(0);
       end;
   }
   mes "Password$ ^0000FFCorrect! ^000000 Welcome to Cool-RO!";
   stopnpctimer;
   sc_end sc_berserk;
   percentheal 100,100;
   detachnpctimer;
   close;

OnTimer20000:
   stopnpctimer;
   sc_end sc_berserk;
   atcommand "@kick "+strcharinfo(0);
   detachnpctimer;
   end;

In

   mes "Are you sure!";
   if (select("Yes:No") == 2) close;
   next;
   set #Password$,"";
   mes "You have deleted your ^0000FFlock code.^000000" ;

#Password$

should be

#password$

otherwise the password isn't deleted.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

would this detachnpctimer; fix the server crash Sir? and thanks for replying.

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

would this detachnpctimer; fix the server crash Sir? and thanks for replying.

Really, I don't know... but after attachnpctimer, at the end of the script it's not weird to use detachnpctimer, is it ? lol

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

what's gonna happen if we dont use detachnpctimer? everything is fine then when I load this script, it crashes after a while. I even have to reboot it to get it up running again. A restart would not work after a crash.

btw, is there a limit on OnpcloginEvent in cluded on a script? Again, many thanks!!!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  43
  • Reputation:   15
  • Joined:  06/24/12
  • Last Seen:  

On a script, you can put only one OnPcLoginEvent... not only for semantic reasons. I'm not sure if there's actually a limit of this rotule usage, but nothing seems to cause crash in your script.

And if you mute a character, it wont be able to run script atcommand, and your 'atcommand "@unmute "+strcharinfo(0);' will turn useless.

Everyway, there are a lot of optimizations to do in this script.

Check out my methods:

1. Create a not-so-gentle group in groups.conf with the following atributes:

{
id: <your choose>
name: "pwd_group"
inherit: (  )
leve: -1
comands: ()
permissions: {
disable_commands_when_dead: true
}
},

2. Add this block-action script part at the beggining of your script:

set @old_group,getgroupid();
atcommand "@option 1";
atcommand "@hide";
atcommand "@adjgroup <that choose>";

This will block:

• Movement;

• Commands (Alt + M @Go shortcuts);

• Hability to Drop/Trade items;

3. Optimize your script (I'll help you in this further ahead...)

4. Add the limits reversion if the player matches the pass:

atcommand "@option 0";
atcommand "@hide";
atcommand "@adjgroup "+@old_group;

Quite complicated, isn't it? I had bad times programming segund-password systems... long time ago.

To end, you can change this

switch(select("Blab:La"))
{
case 1:

case 2:
}

To this

if(select("Blab:La") == x)
{
dothis
} else {
dothat
}

I apologize the oversized reply.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

Thank you for taking time looking into this. I'll try following your suggestions as soon as I encounter any crashes. So far, I got none.

Thanks for everyone you replied. More power to all!

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