Jump to content
  • 0

Hello guys, Need HELP about this error script


Question

Posted (edited)

I am currently getting this error:
[Warning]: script:getelementofarray: index out of range (-1)

[Debug]: Data: variable name='.tmp$' index=0
[Debug]: Source (NPC): dualclientkicker (invisible/not on a map)

And here is the script:
Sorry but I'm kind of new in eA scripting. I mean I never studied the language.

-	script	dualclientkicker	-1,{
OnPCLoadMapEvent:
set .@charmap$, strcharinfo(3);
query_sql("SELECT FIND_IN_SET('"+.@charmap$+"', '"+.maps$+"');",.@q);
if(.@charmap$!=.tmp$[(.@q-1)]) end;
set .@len, query_sql("SELECT DISTINCT `account_id` FROM `char` WHERE `account_id` IN (SELECT `account_id` FROM `login` WHERE `last_ip` = (SELECT `last_ip` FROM `login` WHERE `account_id`="+getcharid(3)+")) AND `online` <> 0;",.@a);
if(.@len-1) {
for(set(.@d,0);.@d<.@len;set(.@d,.@d+1)) {
getmapxy(.@map$,.@x,.@y,0,rid2name(.@a[.@d]));
if(.tmp$[(.@q-1)]==.@map$&&rid2name(.@a[.@d])!=strcharinfo(0)) {
dispbottom "Dual accounts not allowed in HERE.";
warp "prontera",156,173;
}
}
}
end;
 
OnInit:
set .maps$ ,"bat_a01,bat_room,guild_vs3,pvp_y_5-1";
explode(.tmp$,.maps$,",") ;
set .lens , getarraysize(.tmp$);
for(set .a,0;.a<.lens;set .a,.a+1)
setmapflag .tmp$[.a], mf_loadevent;
} 
Edited by fallen0519

9 answers to this question

Recommended Posts

Posted (edited)

i guess you forgot to use TAB on your script  /ok

-	script	dualclientkicker	-1,{
OnPCLoadMapEvent:
set .@charmap$, strcharinfo(3);
query_sql("SELECT FIND_IN_SET('"+.@charmap$+"', '"+.maps$+"');",.@q);
if(.@charmap$!=.tmp$[(.@q-1)]) end;
set .@len, query_sql("SELECT DISTINCT `account_id` FROM `char` WHERE `account_id` IN (SELECT `account_id` FROM `login` WHERE `last_ip` = (SELECT `last_ip` FROM `login` WHERE `account_id`="+getcharid(3)+")) AND `online` <> 0;",.@a);
if(.@len-1) {
for(set(.@d,0);.@d<.@len;set(.@d,.@d+1)) {
getmapxy(.@map$,.@x,.@y,0,rid2name(.@a[.@d]));
if(.tmp$[(.@q-1)]==.@map$&&rid2name(.@a[.@d])!=strcharinfo(0)) {
dispbottom "Dual accounts not allowed in HERE.";
warp "prontera",156,173;
}
}
}
end;
 
OnInit:
set .maps$ ,"bat_a01,bat_room,guild_vs3,pvp_y_5-1";
explode(.tmp$,.maps$,",") ;
set .lens , getarraysize(.tmp$);
for(set .a,0;.a<.lens;set .a,.a+1)
setmapflag .tmp$[.a], mf_loadevent;
}
Edited by Ares
Posted

Not about tab-ing, I ald did it, must be some other issue...


Anyone help me about this please, I don't know how to fix this problem, is the debug things related to the problem occured? Hmm............. Help any pro scripter here....><

Posted

try use this:

-	script	dualclientkicker	-1,{
OnPCLoadMapEvent:
	set .@charmap$, strcharinfo(3);
	query_sql("SELECT FIND_IN_SET('"+.@charmap$+"', '"+.maps$+"');",.@q);
	if(.@charmap$!=.tmp$[(.@q-1)]) end;
	set .@len, query_sql("SELECT DISTINCT `account_id` FROM `char` WHERE `account_id` IN (SELECT `account_id` FROM `login` WHERE `last_ip` = (SELECT `last_ip` FROM `login` WHERE `account_id`="+getcharid(3)+")) AND `online` <> 0;",.@a);
	if(.@len-1) {
		for(set(.@d,0);.@d<.@len;set(.@d,.@d+1)) {
			getmapxy(.@map$,.@x,.@y,0,rid2name(.@a[.@d]));
			if(.tmp$[(.@q-1)]==.@map$&&rid2name(.@a[.@d])!=strcharinfo(0)) {
				dispbottom "Duel accounts not allowed in WOE.";
				warp "geffen",0,0;
			}
		}
	}
	end;
	
OnInit:
	set        .maps$  ,	"aldeg_cas01,gefg_cas01,payg_cas01,prtg_cas01";
	explode(   .tmp$   ,    .maps$, ",")                                  ;
	set        .lens   ,	getarraysize(.tmp$)                           ;
	for(set .a,0;.a<.lens;set .a,.a+1)
		setmapflag .tmp$[.a],	mf_loadevent ;
}

original there

Posted

probably here

query_sql("SELECT FIND_IN_SET('"+.@charmap$+"', '"+.maps$+"');",.@q);
if(.@charmap$!=.tmp$[(.@q-1)]) end;

you can try something like this

.maps$ = "aldeg_cas01|gefg_cas01|payg_cas01|prtg_cas01";

if( compare( "|"+.maps$+"|","|"+strcharinfo(3)+"|" ) ){
    // check dual here.
}
Posted

Sir Emistry, can I have the full script please, I afraid that I make some tiny mistake and cause it error again. Is it replace them or something? hmmmmm.... much appreciated~

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