Kuroyama 6 Posted November 25, 2020 This script is no dual on the same map using last_unique_id of gepard. The problem is, it's having variable error. Need to refine the script, anyone? - script dual_client -1,{ OnInit: setarray .@map$[0], "prt_fild08","prt_fild01"; // yours maps no dual for ( .@i = 0; .@i < getarraysize( .@map$ ); .@i++ ) { if ( !getmapflag( .@map$[.@i], mf_loadevent ) ) { setmapflag .@map$[.@i], mf_loadevent; } } .map_list$ = implode( .@map$, "|" ); .@count = query_sql( "select `login`.`last_unique_id`, `char`.`name`, `char`.`char_id` from `login` left join `char` on `char`.`account_id`=`login`.`account_id` where `char`.`online`=1", .@last_uid$, .@name$, .@char_id ); for ( .@i = 0; .@i < .@count; .@i++ ) { getmapxy .@map$, .@x, .@y, 0, .@name$[.@i]; if ( !compare( .map_list$, .@map$ ) ) continue; .@size = 0; .@variable$ = ".uid_"+ .@last_uid$[.@i] +"$"; if ( getd( .@variable$ ) != "" ) { .@size = getarraysize( getd( .@variable$ ) ); for ( .@j = 0; .@j < .@size; .@j++ ) { getmapxy .@map2$, .@x, .@y, 0, getd( .@variable$ +"["+ .@j +"]" ); if ( .@map$ == .@map2$ ) { warpchar "SavePoint",0,0, .@char_id[.@i]; message .@name$[.@i], "No dual account on this map."; break; } } } if ( .@j == .@size ) { setd .@variable$ +"["+ .@size +"]", .@name$[.@i]; } } end; OnPCLoadMapEvent: if ( !compare( .map_list$, strcharinfo(3) ) ) end; .@map$ = strcharinfo(3); .@myname$ = strcharinfo(0); .@variable$ = ".uid_"+ get_unique_id() +"$"; .@size = getarraysize( getd( .@variable$ ) ); for ( .@j = 0; .@j < .@size; .@j++ ) { if ( .@myname$ == getd( .@variable$ +"["+ .@j +"]" ) ) { .@is_in = 1; continue; } getmapxy .@map2$, .@x, .@y, 0, getd( .@variable$ +"["+ .@j +"]" ); .@compare = compare( .map_list$, .@map2$ ); if ( !.@compare ) { .@tmp$ = .@variable$ +"["+ .@j +"]"; deletearray getd( .@tmp$ ), 1; .@size--; } else if ( .@map$ == .@map2$ ) { warpchar "SavePoint",0,0, getcharid(0); message .@myname$, "No dual account on this map."; end; } } if ( !.@is_in ) { setd .@variable$ +"["+ .@size +"]", .@myname$; } end; } Quote Share this post Link to post Share on other sites
0 Daraen 8 Posted December 1, 2020 Can you give the details of your error in your console? Quote Share this post Link to post Share on other sites
0 Kuroyama 6 Posted December 2, 2020 7 hours ago, Daraen said: Can you give the details of your error in your console? Quote Share this post Link to post Share on other sites
0 Daraen 8 Posted December 2, 2020 9 hours ago, Kuroyama said: It seems to me that you cannot use empty parentheses as your mistake indicates. Instead of the first parethesis, the script expects a ";" thus ignoring the rest of your line. So try without the parentheses. I don't have gepard so can't try your script. Quote Share this post Link to post Share on other sites
0 Kuroyama 6 Posted December 7, 2020 On 12/2/2020 at 7:18 PM, Daraen said: It seems to me that you cannot use empty parentheses as your mistake indicates. Instead of the first parethesis, the script expects a ";" thus ignoring the rest of your line. So try without the parentheses. I don't have gepard so can't try your script. Hi, I did remove the parenthesis but the problem now is no one can warp in the map now except the first person who entered the map. Quote Share this post Link to post Share on other sites
0 fiction 14 Posted December 7, 2020 are you sure that you have gepard?, because the get_unique_id is from gepard. Quote Share this post Link to post Share on other sites
0 astralprojection 35 Posted December 7, 2020 check in your script.c if you have entry BUILDIN(get_unique_id) { char temp[20]; struct map_session_data* sd = script_rid2sd(st); if (sd == NULL) { script_pushconststr(st, ""); return false; } sprintf(temp, "%lu", sockt->session[sd->fd]->gepard_info.unique_id); script_pushstrcopy(st, temp); return true; } static void script_parse_builtin(void) { struct script_function BUILDIN[] = { BUILDIN_DEF(get_unique_id, ""), Quote Share this post Link to post Share on other sites
This script is no dual on the same map using last_unique_id of gepard.
The problem is, it's having variable error. Need to refine the script, anyone?
- script dual_client -1,{ OnInit: setarray .@map$[0], "prt_fild08","prt_fild01"; // yours maps no dual for ( .@i = 0; .@i < getarraysize( .@map$ ); .@i++ ) { if ( !getmapflag( .@map$[.@i], mf_loadevent ) ) { setmapflag .@map$[.@i], mf_loadevent; } } .map_list$ = implode( .@map$, "|" ); .@count = query_sql( "select `login`.`last_unique_id`, `char`.`name`, `char`.`char_id` from `login` left join `char` on `char`.`account_id`=`login`.`account_id` where `char`.`online`=1", .@last_uid$, .@name$, .@char_id ); for ( .@i = 0; .@i < .@count; .@i++ ) { getmapxy .@map$, .@x, .@y, 0, .@name$[.@i]; if ( !compare( .map_list$, .@map$ ) ) continue; .@size = 0; .@variable$ = ".uid_"+ .@last_uid$[.@i] +"$"; if ( getd( .@variable$ ) != "" ) { .@size = getarraysize( getd( .@variable$ ) ); for ( .@j = 0; .@j < .@size; .@j++ ) { getmapxy .@map2$, .@x, .@y, 0, getd( .@variable$ +"["+ .@j +"]" ); if ( .@map$ == .@map2$ ) { warpchar "SavePoint",0,0, .@char_id[.@i]; message .@name$[.@i], "No dual account on this map."; break; } } } if ( .@j == .@size ) { setd .@variable$ +"["+ .@size +"]", .@name$[.@i]; } } end; OnPCLoadMapEvent: if ( !compare( .map_list$, strcharinfo(3) ) ) end; .@map$ = strcharinfo(3); .@myname$ = strcharinfo(0); .@variable$ = ".uid_"+ get_unique_id() +"$"; .@size = getarraysize( getd( .@variable$ ) ); for ( .@j = 0; .@j < .@size; .@j++ ) { if ( .@myname$ == getd( .@variable$ +"["+ .@j +"]" ) ) { .@is_in = 1; continue; } getmapxy .@map2$, .@x, .@y, 0, getd( .@variable$ +"["+ .@j +"]" ); .@compare = compare( .map_list$, .@map2$ ); if ( !.@compare ) { .@tmp$ = .@variable$ +"["+ .@j +"]"; deletearray getd( .@tmp$ ), 1; .@size--; } else if ( .@map$ == .@map2$ ) { warpchar "SavePoint",0,0, getcharid(0); message .@myname$, "No dual account on this map."; end; } } if ( !.@is_in ) { setd .@variable$ +"["+ .@size +"]", .@myname$; } end; }
Share this post
Link to post
Share on other sites