Jump to content
  • 0
Sign in to follow this  
xlaws27

@shower command (bindatcmd)

Question

can someone make it? i dont wnt plug in because its very hard to insert thanks

 

example:

i am on prontera then

i type @shower 501 100

all players on prontera will get an 100 pcs of red potion then the player will receive a message "Something has been drop from the sky"

 

Share this post


Link to post
Share on other sites

17 answers to this question

Recommended Posts

  • 0

db/re/map_zone_db.conf
insert the "loadevent" into the mapflags brackets of the zone named "All".

mapflags: (
"loadevent",
)

-	script	asdfghjkl	-1,{  end;OnInit:	bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80;	end;OnShowerCommand:	.@size = query_sql("select account_id from `char` where online = 1 and last_map ='"+strcharinfo(3)+"'",.@aid);	for ( .@i = 0; .@i < .@size; .@i++ ) {		if(!attachrid(.@aid[.@i])) continue;		if(CheckVending()) continue;		getitem 501,100;		announce "Something has been drop from the sky!",bc_self,0xFFC0CB;				}	end;OnPCLoadMapEvent:	query_sql("UPDATE `char` SET last_map='"+strcharinfo(3)+"'");end;}
Edited by Angelmelody

Share this post


Link to post
Share on other sites
  • 0

 

db/re/map_zone_db.conf

insert the "loadevent" into the mapflags brackets of the zone named "All".

 

mapflags: (

"loadevent",

)

-	script	asdfghjkl	-1,{  end;OnInit:	bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80;	end;OnShowerCommand:	.@size = query_sql("select account_id form `char` where online = 1 and last_map ='"+strcharinfo(3)+"'",.@aid);	for ( .@i = 0; .@i < .@size; .@i++ ) {		if(!attachrid(.@aid[.@i])) continue;		if(CheckVending()) continue;		getitem 501,100;		announce "Something has been drop from the sky!",bc_self,0xFFC0CB;				}	end;OnPCLoadMapEvent:	query_sql("UPDATE `char` SET last_map='"+strcharinfo(3)+"'");end;}

The problem in your script is that last_map isn't getting updated real time so some of players may not get the items.

 

-- oh, I see your solution, tho that's madness, imagine server with 200 online. Query'll load server a lot.

 

 

correct line:

.@size = query_sql("select account_id form `char` where online = 1 and last_map ='"+strcharinfo(3)+"'",.@aid);

 

have to be

.@size = query_sql("select account_id FROM `char` where online = 1 and last_map ='"+strcharinfo(3)+"'",.@aid);

Edited by Oxxy

Share this post


Link to post
Share on other sites
  • 0

 

db/re/map_zone_db.conf

insert the "loadevent" into the mapflags brackets of the zone named "All".

 

mapflags: (

"loadevent",

)

-	script	asdfghjkl	-1,{  end;OnInit:	bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80;	end;OnShowerCommand:	.@size = query_sql("select account_id from `char` where online = 1 and last_map ='"+strcharinfo(3)+"'",.@aid);	for ( .@i = 0; .@i < .@size; .@i++ ) {		if(!attachrid(.@aid[.@i])) continue;		if(CheckVending()) continue;		getitem 501,100;		announce "Something has been drop from the sky!",bc_self,0xFFC0CB;				}	end;OnPCLoadMapEvent:	query_sql("UPDATE `char` SET last_map='"+strcharinfo(3)+"'");end;}

zones: (

{

 /* All zone is a dynamic (very special) zone that is forcebly inherited by ALL maps automatically */

 name: "All" /* changing this name requires MAP_ZONE_ALL_NAME to also be changed in src/map/map.h file */

 

 disabled_skills: {

   //both examples below disable napalm beat (id 11) to players

   //MG_NAPALMBEAT: "PLAYER"

   //ID11: "PLAYER"

 }

 

 disabled_items: {

   //Both examples below disable apple (id 501)

   //Apple: true

   //ID501: true

 }

 

 mapflags: (

 "loadevent",

 )

  mapflags: (

 )

 

--------------------------------------------------------------------------------------------------------

this is what i did. is it okay?

 

and

 

theres an error what i did to fix it is i remove the () but i think what i did was wrong .. can u help me

1knk1.jpg

 

 

 

Edited by xlaws27

Share this post


Link to post
Share on other sites
  • 0

 

 

 try this new one , it's no need to modify map_zone_db.conf now :)

 

-	script	asdfgadhjkl	-1,{  end;OnInit:	bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80;	end;OnShowerCommand:	query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` ASC LIMIT 1", .@minaid);	query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` DESC LIMIT 1", .@maxid);	.@showermap$ = strcharinfo(3);	freeloop(1);	while ( .@minaid <= .@maxid ) {		if(!attachrid(.@minaid++)) continue;		if(strcharinfo(3) !=.@showermap$ ) continue;		if(checkvending()) continue;		getitem 501,100;		announce "Something has been drop from the sky!",bc_self,0xFFC0CB;	}	freeloop(0);end;}
Edited by Angelmelody

Share this post


Link to post
Share on other sites
  • 0

now i type .@shower no more lag but I received nothing

updated, try again...

 

-	script	asdfgadhjkl	-1,{  end;OnInit:	bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80;	end;OnShowerCommand:	query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` ASC LIMIT 1", .@minaid);	query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` DESC LIMIT 1", .@maxid);	.@showermap$ = strcharinfo(3);	freeloop(1);	while ( .@minaid <= .@maxid ) {		if(!attachrid(.@minaid++)) continue;		if(strcharinfo(3) !=.@showermap$ ) continue;		if(checkvending()) continue;		getitem 501,100;		announce "Something has been drop from the sky!",bc_self,0xFFC0CB;	}	freeloop(0);end;}
Edited by Angelmelody

Share this post


Link to post
Share on other sites
  • 0

 

now i type .@shower no more lag but I received nothing

updated, try again...

 

-	script	asdfgadhjkl	-1,{  end;OnInit:	bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80;	end;OnShowerCommand:	query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` ASC LIMIT 1", .@minaid);	query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` DESC LIMIT 1", .@maxid);	.@showermap$ = strcharinfo(3);	freeloop(1);	while ( .@minaid <= .@maxid ) {		if(!attachrid(.@minaid++)) continue;		if(strcharinfo(3) !=.@showermap$ ) continue;		if(checkvending()) continue;		getitem 501,100;		announce "Something has been drop from the sky!",bc_self,0xFFC0CB;	}	freeloop(0);end;}

yeah thank u so much its working now..

do you recommend this instead of plug in?

because @@Oxxy said --tho that's madness, imagine server with 200 online. Query'll load server a lot.--

 

btw can u make it like on the plug in?

@shower (itemid) (quantity)

example

@shower 501 100

 

sorry for asking too much.

Share this post


Link to post
Share on other sites
  • 0

yeah thank u so much its working now..

do you recommend this instead of plug in?

because @@Oxxy said --tho that's madness, imagine server with 200 online. Query'll load server a lot.--

 

btw can u make it like on the plug in?

@shower (itemid) (quantity)

example

@shower 501 100

 

sorry for asking too much.

 

frequently query problem wasn't exist on new one , and here you go!  @shower <Item ID> <amount>

-	script	asdfgadhjkl	-1,{  end;OnInit:	bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80;	end;OnShowerCommand:	.@showeritemid = atoi(.@atcmd_parameters$[0]);    	.@showeritamount = atoi(.@atcmd_parameters$[1]);	if ( !.@showeritemid ) {		message strcharinfo(0), "@shower <Item ID> <amount>";        	end;	}    	if ( getiteminfo(.@showeritemid,2) == -1 ) {        	message strcharinfo(0), "Invalid Item ID";		message strcharinfo(0), "@shower <Item ID> <amount>";        	end;    	}	if(.@showeritamount <= 0) {        	message strcharinfo(0), "Invalid Item Amount";		message strcharinfo(0), "@shower <Item ID> <amount>";        	end;    	}	query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` ASC LIMIT 1", .@minaid);	query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` DESC LIMIT 1", .@maxid);	.@showermap$ = strcharinfo(3);	freeloop(1);	while ( .@minaid <= .@maxid ) {		if(!attachrid(.@minaid++)) continue;		if(strcharinfo(3) !=.@showermap$ ) continue;		if(checkvending()) continue;		getitem .@showeritemid,.@showeritamount;		announce "Something has been drop from the sky!",bc_self,0xFFC0CB;	}	freeloop(0);end;}
Edited by Angelmelody

Share this post


Link to post
Share on other sites
  • 0

 

yeah thank u so much its working now..

do you recommend this instead of plug in?

because @@Oxxy said --tho that's madness, imagine server with 200 online. Query'll load server a lot.--

 

btw can u make it like on the plug in?

@shower (itemid) (quantity)

example

@shower 501 100

 

sorry for asking too much.

 

frequently query problem wasn't exist on new one , and here you go!  @shower <Item ID> <amount>

-	script	asdfgadhjkl	-1,{  end;OnInit:	bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80;	end;OnShowerCommand:	.@showeritemid = atoi(.@atcmd_parameters$[0]);    	.@showeritamount = atoi(.@atcmd_parameters$[1]);	if ( !.@showeritemid ) {		message strcharinfo(0), "@shower <Item ID> <amount>";        	end;	}    	if ( getiteminfo(.@showeritemid,2) == -1 ) {        	message strcharinfo(0), "Invalid Item ID";		message strcharinfo(0), "@shower <Item ID> <amount>";        	end;    	}	if(.@showeritamount <= 0) {        	message strcharinfo(0), "Invalid Item Amount";		message strcharinfo(0), "@shower <Item ID> <amount>";        	end;    	}	query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` ASC LIMIT 1", .@minaid);	query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` DESC LIMIT 1", .@maxid);	.@showermap$ = strcharinfo(3);	freeloop(1);	while ( .@minaid <= .@maxid ) {		if(!attachrid(.@minaid++)) continue;		if(strcharinfo(3) !=.@showermap$ ) continue;		if(checkvending()) continue;		getitem .@showeritemid,.@showeritamount;		announce "Something has been drop from the sky!",bc_self,0xFFC0CB;	}	freeloop(0);end;}

 

THANK YOU SO MUCH!!!!

BTW

will i received some lag/error issues if i showered it to 100~200 players?

Edited by xlaws27

Share this post


Link to post
Share on other sites
  • 0

will i received some lag/error issues if i showered it to 100~200 players?

It won't lag if players are over 200 , becoz the freeloop command can prevent the lagging of huge loop

 

 

@@Aurora yeah it has restriction 

 

bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80;

Can you translate this line in english? :D

  you can read  doc/script_commands.txt

 

Edited by Angelmelody

Share this post


Link to post
Share on other sites
  • 0

 

will i received some lag/error issues if i showered it to 100~200 players?

It won't lag if players are over 200 , becoz the freeloop command can prevent the lagging of huge loop

@@Aurora yeah it has restriction 

 

bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80;

Can you translate this line in english? :D

  you can read  doc/script_commands.txt

 

 

80,80 is the required GM Level. Did I get that right?

Share this post


Link to post
Share on other sites
  • 0

 

 

will i received some lag/error issues if i showered it to 100~200 players?

It won't lag if players are over 200 , becoz the freeloop command can prevent the lagging of huge loop

>> 

@@Aurora yeah it has restriction 

 

bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80;

Can you translate this line in english? :D

  you can read  doc/script_commands.txt

 

 

80,80 is the required GM Level. Did I get that right?

 

GM Level 80 and above 80

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
Answer this question...

×   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...
Sign in to follow this  

×
×
  • Create New...

Important Information

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