Carpet

Carpet

2M Downloads

[Suggestion]Add a tag "carpetBot" to the fake players, remove the tag when kill them, so we can exclude them from scoreboards.

Harveykang opened this issue ยท 5 comments

commented
commented

hmm, couldn't you add that tag yourself after spawning them?

commented

i can but...my server players have no permission

commented

please use the following script instead

__config() -> m( l('stay_loaded', true));
__command() -> 
(
	p = player();
	summon(slice(p,0,12)+'_bot');
	'';
);
global_tag = 'carpetBot';

summon(player_name) ->
(
	player_name = slice(player_name, 0, 16);
	s_player = player();
	if (player(player_name), exit('Player '+player_name+' already exists'));
	player_name = replace(player_name, '\\s','');
	run(str('player %s spawn at %f %f %f', player_name, s_player~'x', s_player~'y', s_player~'z'));
	if (!(player(player_name)), exit('failed to spawn player '+player_name));
	modify(player(player_name), 'tag', global_tag);
	logger('fake player tag added to player '+player_name);
    '';
);

__on_statistic(player, category, stat, value) ->
(
	if (stat == 'deaths' && category == 'custom',
		if (query(player, 'has_tag', global_tag),
			modify(player, 'clear_tag', global_tag);
			logger('fake player tag removed from player '+player);
		)
	)
);

the '__on_statistic` part will be working very soon with the statistics API, but for now it will spawn players with that tag already. If you find another way to detect players death - that would also work.

commented

thanks you so much! i'll try it <3

commented

I fixed the config line in the script above - previous one wansn't working properly