Jump to content
  • 0

Help with Emistry script Give Item


lzm

Question


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  21
  • Reputation:   0
  • Joined:  08/12/17
  • Last Seen:  

Hi, I need help to update the script no longer work on latest rAthena

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


-	script	Sample	-1,{
OnWhisperGlobal:
if( getgmlevel() >= 99 ){
	// check map
	if( @whispervar0$ == "all" ) set .@type$,"";
	else if( @whispervar0$ == "map" ) set .@type$,strcharinfo(3);
	else {
		dispbottom "Error, pick 'map' or 'all' ";
		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;
}

It gives this error:

[Warning]: script: buildin_getmapxy: Invalid type 0.
[Debug]: Source (NPC): Sample (invisible/not on a map)

Thank you...

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   7
  • Joined:  06/06/19
  • Last Seen:  

Quote

getmapxy( .@map$,.@x,.@y,0,.@name$[.@i] );

to

getmapxy .@map$,.@x,.@y,BL_PC,.@name$[.@i];
*getmapxy("<variable for map name>",<variable for x>,<variable for y>{,<type>,"<search value>"})
 
This function will locate a character object, NPC object or pet's coordinates
and place their coordinates into the variables specified when calling it. It
will return 0 if the search was successful, and -1 if the parameters given were
not variables or the search was not successful.
 
Type is the type of object to search for:
 
    BL_PC - Character object (default)
    BL_NPC - NPC object
    BL_PET - Pet object
    BL_HOM - Homunculus object
    BL_MER - Mercenary object
    BL_ELEM - Elemental object

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  21
  • Reputation:   0
  • Joined:  08/12/17
  • Last Seen:  

9 hours ago, YJ1994 said:

to


getmapxy .@map$,.@x,.@y,BL_PC,.@name$[.@i];
*getmapxy("<variable for map name>",<variable for x>,<variable for y>{,<type>,"<search value>"})
 
This function will locate a character object, NPC object or pet's coordinates
and place their coordinates into the variables specified when calling it. It
will return 0 if the search was successful, and -1 if the parameters given were
not variables or the search was not successful.
 
Type is the type of object to search for:
 
    BL_PC - Character object (default)
    BL_NPC - NPC object
    BL_PET - Pet object
    BL_HOM - Homunculus object
    BL_MER - Mercenary object
    BL_ELEM - Elemental object

 

it gives this error

[Error]: buildin_getmapxy: Player with map id '0' is not found.

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   7
  • Joined:  06/06/19
  • Last Seen:  

5 minutes ago, lzm said:

it gives this error


[Error]: buildin_getmapxy: Player with map id '0' is not found.

 

tested with latest rA hash no problem at all(copy paste whole script) and just need change the type for getmapxy syntax. do the debugmes for map name.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  21
  • Reputation:   0
  • Joined:  08/12/17
  • Last Seen:  

found out that the problem are on my end... I must make mistakes when merge.. thanks

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