@shower command (bindatcmd)

xlaws27

New member
Messages
225
Points
0
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"

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

mapflags: (
"loadevent",
)

Code:
-	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;}
 
Last edited by a moderator:
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);

 
Last edited by a moderator:
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


 
Last edited by a moderator:
 try this new one , it's no need to modify map_zone_db.conf now
default_smile.png


Code:
-	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;}
 
Last edited by a moderator:
now i type .@shower no more lag but I received nothing
updated, try again...

Code:
-	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;}
 
Last edited by a moderator:
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.

 
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>

Code:
-	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;}
 
Last edited by a moderator:
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?

 
Last edited by a moderator:
Last edited by a moderator:
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?
default_biggrin.png
  you can read  doc/script_commands.txt
80,80 is the required GM Level. Did I get that right?

 
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?
default_biggrin.png
  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

 
Back
Top