fallen0519 Posted March 16, 2014 Posted March 16, 2014 (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 March 16, 2014 by fallen0519 Quote
Aureon Posted March 16, 2014 Posted March 16, 2014 (edited) i guess you forgot to use TAB on your script - 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 March 16, 2014 by Ares Quote
fallen0519 Posted March 16, 2014 Author Posted March 16, 2014 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....>< Quote
sandbox Posted March 16, 2014 Posted March 16, 2014 Does it happen everytime? I think that would only occur if the array would be empty. Quote
fallen0519 Posted March 16, 2014 Author Posted March 16, 2014 Whenever I use a command like go back to Prontera city, it keep appearing. Example: @go 0 ...Putty will appear again. Have no idea how to fix it. Please help me sir. =x Quote
Phenomena Posted March 16, 2014 Posted March 16, 2014 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 Quote
fallen0519 Posted March 16, 2014 Author Posted March 16, 2014 I try the following script first, see if it cause the same problem or not. Thanks for helping, get back to you ASAP !! Quote
Emistry Posted March 16, 2014 Posted March 16, 2014 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. } Quote
fallen0519 Posted March 16, 2014 Author Posted March 16, 2014 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~ Quote
fallen0519 Posted March 18, 2014 Author Posted March 18, 2014 Bump !! Please anyone could help me please..~~ Thanks Quote
Question
fallen0519
I am currently getting this error:
[Warning]: script:getelementofarray: index out of range (-1)
And here is the script:
Edited by fallen0519Sorry but I'm kind of new in eA scripting. I mean I never studied the language.
9 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.