AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Restricting player voice (https://forums.alliedmods.net/showthread.php?t=6742)

XxAvalanchexX 10-12-2004 20:06

Restricting player voice
 
Hello.

I'm trying to get it so that only people within a certain distance of you can hear you. This is the code I have...

Code:

public client_PreThink(id) {
  new origin[3];
  get_user_origin(id,origin);

  new players[32], num;
  get_players(players,num);

  for(new i=0;i<num;i++) {
  new player = players[i], porigin[3];
  get_user_origin(player,porigin);

  if(get_distance(origin,porigin) <= speakdistance) {
    set_client_listen(player,id,1);
  }
  else {
    set_client_listen(player,id,0);
  }
  }
 }

Obviously, however, since it is ran with client_PreThink, it is clunky and causes lag. Ideas?

BAILOPAN 10-12-2004 20:18

maybe it's possible to use fakemeta module to hook when a player starts speaking... not sure.

but on a 32player server this will execute 900 loops every frame or something, probably not a good idea ;]

you could restrict this by finding out who is currently using the mic (somehow)

EKS 10-12-2004 22:51

You could also try to hook when the icon is being placed on the hud or over someones head.

XxAvalanchexX 10-12-2004 23:31

Never thought of that. Any ideas on how to hook the sprite icons?

EKS 10-12-2004 23:49

proberbly via 1 of these events:
Quote:

StatusValue 105 -1
StatusText 106 -1
StatusIcon 107 -1


VEN 10-08-2005 10:51

EKS: nope, unfortunately mic icon != status icon

I tried:
1) catch event
2) catch client command
3) register voice forwards (fakemeta)

No one can catch voice...

PS: Its so hard as catching equiping a shield!

v3x 10-08-2005 10:59

HOLY SHIT!

Way to bump a 1-year-old post..

Anthraxnz 10-08-2005 11:06

lol.

wots wif the ;'s

VEN 10-08-2005 13:51

v3x:
I just tryinig to help people who have the same problem of catching voicerecord
I'm sure there are some of them
I made some researches and just report about results
I leave previous post just in hope it would be useful to people who trying to find a way of solve this task

Is it restricted to post in "old" topics? Nothing agains u vex. If i was wrong with something, please PM me. Thanks.
To man who decrease my karma: please PM me why u do it

XxAvalanchexX 10-08-2005 15:21

Quote:

Originally Posted by VEN
To man who decrease my karma: please PM me why u do it

I'm not sure who did it, but I'm pretty sure the point of it is to be anonymous, otherwise you would be able to view a list of who has affected your karma.


All times are GMT -4. The time now is 17:26.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.