limited broadcast

hideki6

New member
Messages
22
Points
0
hi,is there a way to limit a broadcast so that only level 1-20 players for example will get the broadcast?

 
Not in current scripting AFAIK. It could be feasible with a little workaround if the addrid script command was implemented, but we're having that pull request waiting ATM, don't know why

 
Maybe query all account id's on char table whose base level is < 20 and online <> 0 and then have a loop through those data gathered from the query_sql and attach their rid one by one? Not sure if this will work as i am not in my pc to test
default_tongue.png


 
Not sure if you want precisely only ~20 people to receive a global broadcast or if you're just trying to have only a few people in your vicinity be able to see a local broadcast. In that case, you might find localbroadcast and areabroadcast to be useful.

 
a bit more procisely please, couldnt find anything

i just want a broadcast to reach certain levels, for low level events and stuff

 
Like, when someone leveled up? You have these labels for that:

Code:
OnPCBaseLvUpEvent:OnPCJobLvUpEvent:
 
still dont get it.. could you please make a example. i was thinking of creating new broadcast commands through atcommand.c but dont know how to specify like level 1-20 and let the broadcast work like that

 
I don't get you, so maybe my last reply wasn't accurate.

What do you exactly mean?

a) Make a broadcast to every people in a range of levels;

default_cool.png
Broadcast to any people that reach a level in a range [What I understood because of the post just before my previous one].

 
Last edited by a moderator:
Code:
prontera,150,150,0	script	Sample	100,{	mes "Input your message";	next;	input .@m$;	close2;	if ( .@m$ != "" ) {		query_sql "SELECT `account_id` FROM `char` WHERE `base_level` < 20 AND `online` = '1'",.@aid;		while ( .@i < getarraysize(.@aid) ) {			if ( attachrid( .@aid[.@i] ) )				dispbottom "" + .@m$ + "";			detachrid;			.@i++;		}	}	end;}
 
 this works but only the first person talking could see the message from all players sent.. the others cant
default_sad.png


Code:
prontera,150,150,0	script	Sample	100,{	mes "Input your message";	next;	input .@m$;	close2;	if ( .@m$ != "" ) {		query_sql "SELECT `account_id` FROM `char` WHERE `base_level` < 20 AND `online` = '1'",.@aid;		while ( .@i < getarraysize(.@aid) ) {			if ( attachrid( .@aid[.@i] ) )				dispbottom "" + .@m$ + "";			detachrid;			.@i++;		}	}	end;}
 
Last edited by a moderator:
Tested on my test server and it works fine. How did you test the script?

 
prontera,150,150,0 script Sample 100,{ mes "Input your message"; next; input .@m$; close2; if ( .@m$ != "" ) { query_sql "SELECT `account_id` FROM `char` WHERE `base_level` < 20 AND `online` = '1'",.@aid; while ( .@i < getarraysize(.@aid) ) { if ( attachrid( .@aid[.@i] ) ) dispbottom "" + .@m$ + ""; detachrid; .@i++; } } end;}
Not that it's a big deal or anything, but I'd say message would be more preferable over dispbottom; if a player has /notalkmsg2 on, they won't receive the message.

Usage:

Code:
message strcharinfo(0), "Some message here.";
 
In any way he can replace the dispbottom part. I attached all online player with < 20 base level. So i think the decision is up to the topic starter. I just made an example. Btw an array can store up to 128 values only. So if you have big population the script might not actually do the full work.

 
Back
Top