Jump to content
  • 0

MAP related scripts not working HELP


Yami

Question


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   2
  • Joined:  01/02/14
  • Last Seen:  

Hey hi, I used some scripts in the past that checks for players on a map. ie; map shower, maprecall custom script. It was working before, but for some reason it's not working anymore. It would output "0 players detected" even if there are players on the map.

Can someone please help me make these scripts work again please?

 

maprecall script :
 

-	script	atcmd_examplere	-1,{
OnInit:
	bindatcmd "recallmap",strnpcinfo(3)+"::OnAtcommand",60,60;
	end;
OnAtcommand:
	getmapxy .map_self$, .x_self, .y_self, 0;
	.myname$ = strcharinfo(0);
	.count = 0;
	addrid 0;
	if ( strcharinfo(3) == .map_self$ && strcharinfo(0) != .myname$ ) {
		message strcharinfo(0), "You have been recalled by "+ .myname$ +".";
		warp .map_self$, .x_self, .y_self;
		.count++;
	}
	if ( strcharinfo(0) != .myname$ ) end;
	sleep2 10;
	if ( .count == 0 )
		message strcharinfo(0), "There's no player on this map except you.";
	else
		message strcharinfo(0), .count +" player(s) recalled.";
	end;
}

 

and my shower script only the map option is not working:

// usage :
// [npc:Sample]map#512#10
// [npc:Sample]all#512#123

-	script	shower	-1,{
OnWhisperGlobal:
if( getgmlevel() >= 99 ){
	// check map
	if( @whispervar0$ == "all" ) set .@type$,"";
	else if( @whispervar0$ == "map" ) set .@type$,strcharinfo(3);
	else {
		dispbottom "Error: all#512#123";
		end;
	}
	
	// check item
	set .@itemid,atoi( @whispervar1$ );
	set .@amount,atoi( @whispervar2$ );
	if( getitemname( .@itemid ) == "null" || .@amount < 1 ){
		dispbottom "Enter valid item id and amount.";
	}
	
	set .@self_id,getcharid(3);
	query_sql( "SELECT COUNT(`account_id`) FROM `char` WHERE `online` = 1 ", .@total );
	while( .@count < .@total ){
		query_sql( "SELECT `account_id`,`name` FROM `char` WHERE `online` = 1 ORDER BY `account_id` LIMIT 128 OFFSET "+.@offset, .@aid,.@name$ );
		set .@i,0;
		set .@size,getarraysize( .@aid );
		while( .@i < .@size ){
			if( .@aid[.@i] != .@self_id ){
				if( .@type$ != "" ){
					getmapxy( .@map$,.@x,.@y,0,.@name$[.@i] );
					if( .@map$ == .@type$ ){
						getitem .@itemid,.@amount,.@aid[.@i];
						set .@gave,.@gave + 1;
					}
				}else{
					getitem .@itemid,.@amount,.@aid[.@i];
					set .@gave,.@gave + 1;
				}
			}
			set .@count,.@count + 1;
			set .@i,.@i + 1;
		}
		set .@offset,.@offset + .@size;
		deletearray .@aid,.@size;
		deletearray .@name$,.@size;
	}
	dispbottom "Gave "+.@amount+" x "+getitemname( .@itemid )+" to "+.@gave+" Player(s).";
}
end;
}

 

Both scripts was working back then but doesn't work anymore. Thank you for the help.

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  398
  • Reputation:   246
  • Joined:  07/04/19
  • Last Seen:  

getmapxy .map_self$, .x_self, .y_self, 0;

replace 0; to this BL_PC;

 

for item map much better to use this

 

 

Edited by BeWan
  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   2
  • Joined:  01/02/14
  • Last Seen:  

11 hours ago, BeWan said:

replace 0; to this BL_PC;

Do you mean like this?

getmapxy .map_self$, .x_self, .y_self, BL_PC;

 

11 hours ago, BeWan said:

getmapxy .map_self$, .x_self, .y_self, 0;

replace 0; to this BL_PC;

 

for item map much better to use this

 

 

Worked like a charm. Thank you so much!

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