Jump to content
Mhalicot

[Script Command] addrid

Recommended Posts

File Name: [script Command] addrid

File Submitter: Mhalicot

File Submitted: 04 Dec 2013

File Category: Plugins

 

Converted to plugins since its been a month in pull request e5d29d7 by Dastgir

topic request here

 

HPM addrid complete package.

 

Compatible with Windows System Only

 

if you are using Linux, ignore other files and use only addrid.c

some Linux Systwem got many bugs with files what are all ready compiled under VS2010 .

(Windows Compiled wont work on *nix)

Instructions:

1. Download and extract files using 7z or any application that can extract it.

2. extract it in your server directory ex: C:/RO Server/Hercules/

2.1. edit conf/plugins.conf and add addrid

3. Your done. you can now try your plugins

/*========================================================================= * Attaches a set of RIDs to the current script. [digitalhamster] * addrid(<type>{,<flag>{,<parameters>}}); * <type>: *  0 : All players in the server. *  1 : All players in the map of the invoking player, or the invoking NPC if no player is attached. *  2 : Party members of a specified party ID. *      [ Parameters: <party id> ] *  3 : Guild members of a specified guild ID. *      [ Parameters: <guild id> ] *  4 : All players in a specified area of the map of the invoking player (or NPC). *      [ Parameters: <x0>,<y0>,<x1>,<y1> ] *  Account ID: The specified account ID. * <flag>: *  0 : Players are always attached. (default) *  1 : Players currently running another script will not be attached. *-------------------------------------------------------------------------*/

Quote

A small example to how it works:

-	script	bla	-1,{	end;OnClock0820:	addrid(0);		if (zeny>20000) set zeny,0;	end;}

means 08:20 each player who's currently logged in and has more than 20000 zeny would have his money set to 0;

 

Another example:

prontera,120,120,2	script	bla	120,{	addrid(2000001);		set cake,2;		dispbottom "soup";	end;} 

means that if someone talks with that npc, it'd also add the player with the acc_id 2000001 ,set both of their cake variables to 2 and display soup at the bottom of their chatwindow.

 

And a last one:

prontera,120,120,2	script	bla	120,{	addrid(3,1,getcharid(2));		mes "hey my guild";	close;} 

means that if someone in a guild talks with that npc , his entire guild as long as they aren't involved in a script currently, get a npcwindow with "hey my guild"

 

Main Link~

 

 

Note: It is compiled already, so don't bother to recompile it.

use recompile if you modify the script.

If you want to edit look for src/plugins/addrid.c

If you have any questions feel free to drop a comment.

 

for more info on how to to use HPM visit Here

 

Click here to download this file

Share this post


Link to post
Share on other sites

 

Note: using close mes "" next or input after addrid without Forced set to 1 isnt the smartest idea because if someone is currently talking with a npc and you change his npcwindow you'll get a nice debug msg and that character is stuck.

addrid() basically adds another player to the npc at exactly the position after the command is run, you could compare it with attachrid just that it doesn't detach the rid of the player who currently runs the script(Also works if no player is attached).
 
-digitalhamster

 

A small example to how it works:
 

-	script	bla	-1,{	end;OnClock0820:	addrid(0);		if (zeny>20000) set zeny,0;	end;} 

 

means 08:20 each player who's currently logged in and has more than 20000 zeny would have his money set to 0;

Another example:

prontera,120,120,2	script	bla	120,{	addrid(2000001);		set cake,2;		dispbottom "soup";	end;} 

 

means that if someone talks with that npc, it'd also add the player with the acc_id 2000001 ,set both of their cake variables to 2 and display soup at the bottom of their chatwindow.

And a last one:

prontera,120,120,2	script	bla	120,{	addrid(3,1,getcharid(2));		mes "hey my guild";	close;} 

 

means that if someone in a guild talks with that npc , his entire guild as long as they aren't involved in a script currently, get a npcwindow with "hey my guild"

 

Main Link~

Edited by sevenzz23

Share this post


Link to post
Share on other sites

your are missing  to import the symbols for  mapit->  and map->

 

map = GET_SYMBOL("map");

mapit = GET_SYMBOL("mapit");

 

normaly it should crash without this symbols , not sure if you tested the plugin ingame.

Edited by ossi0110

Share this post


Link to post
Share on other sites

your are missing  to import the symbols for  mapit->  and map->

 

map = GET_SYMBOL("map");

mapit = GET_SYMBOL("mapit");

 

normaly it should crash without this symbols , not sure if you tested the plugin ingame.

Thanks for pointing out, will update it asap :)

Share this post


Link to post
Share on other sites

 

How do I add this on linux?

 

Its Simple. by applying this step.. [WIKI] GCC

 

It says

[Warning]: 'HPM:plugin_load: failed to load 'plugins/HPMHooking.so', skipping...

[Warning]: 'HPM:plugin_load: failed to load 'plugins/addrid.so', skipping...

 

What I did was,

 

1. extracted the whole rar file in hercules' directory.

2. edited the conf/plugin.conf now it looks like

 

plugins_list: [
/* Enable HPMHooking when plugins in use rely on Hooking */
"HPMHooking",
"addrid",
//"db2sql",
//"sample",
//"other",
]
 
3. edited the src/plugins/Makefile.in
 
now it says 
 
MYPLUGINS = addrid
 
4. I compiled it by make plugins, make all and make plugin.my_plugin
 
What am I missing?
 

Share this post


Link to post
Share on other sites

just add this line should work ... tested

#include "../common/HPMDataCheck.h" // should always be the last file included! (if you don't make it last, it'll intentionally break compile time)

Share this post


Link to post
Share on other sites

Will provide sexual favours to the person who can get this working for latest herc. Can pay money too.

+1

 

PS: I'm pretty sure if you know what you're doing you can just loop through all the online characters and perform an action on each account or specific accounts (like the winner of a group of people in an event)

Share this post


Link to post
Share on other sites

Will provide sexual favours to the person who can get this working for latest herc. Can pay money too.

This kind of addrid was rejected from Hercules too. Because this can be dangerous. It can have unexpected behavior when the player is attached to other npc and you call addrid, either that script would stop executing(think doing some quest, the variables changed but you didn't got reward), or the script with addrid would behave oddly(rid not attached but script continued to run)

More info: https://github.com/HerculesWS/Hercules/pull/211

Share this post


Link to post
Share on other sites

 

 

Will provide sexual favours to the person who can get this working for latest herc. Can pay money too.

This kind of addrid was rejected from Hercules too. Because this can be dangerous. It can have unexpected behavior when the player is attached to other npc and you call addrid, either that script would stop executing(think doing some quest, the variables changed but you didn't got reward), or the script with addrid would behave oddly(rid not attached but script continued to run)

More info: https://github.com/HerculesWS/Hercules/pull/211

 

 

Any knowledge on rathena being able to have it and not Herc? I'd like to know if it would be dangerous to use in a script which will check how many guild members are on a map (to limit guild size per woe).

Share this post


Link to post
Share on other sites

You really don't need addrid for that. In

OnPCLoadMapEvent, you can use getmapguildusers to know number of members of specific guild and can warp extra players out.

Share this post


Link to post
Share on other sites

You really don't need addrid for that. In

OnPCLoadMapEvent, you can use getmapguildusers to know number of members of specific guild and can warp extra players out.

Oh wow, I didn't even know this was a thing. I swear I scrolled all the way through script commands doc looking for something like this.

 

Thanks for saving my life Dastgir.

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.