AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Solved] Only specific players can see player's message (https://forums.alliedmods.net/showthread.php?t=220481)

OxidedMaze 07-11-2013 06:37

[Solved] Only specific players can see player's message
 
Hi everyone , is it possible that when players enter a message , only players within a specific distance from that player can see the message , and blocks other players from seeing the message?

SpeeDeeR 07-11-2013 06:45

Re: Only specific players can see player's message
 
Get all alive players using get_players with the proper flags and loop through them checking the distance between you and the player using get_distance or get_distance_f. When a player is in range, send him the message via client_print, colorchat or however you want.

OxidedMaze 07-11-2013 07:22

Re: Only specific players can see player's message
 
Quote:

Originally Posted by SpeeDeeR (Post 1988416)
Get all alive players using get_players with the proper flags and loop through them checking the distance between you and the player using get_distance or get_distance_f. When a player is in range, send him the message via client_print, colorchat or however you want.

thx for reply , but still 1 problem unsolved
what I mean is , when player uses "Say" to say messages , all players can see the message , but I want to block the message from being sent to other players out of range , is it possible?

SpeeDeeR 07-11-2013 07:37

Re: Only specific players can see player's message
 
A way that could work is to hook SayText using register_message and check the distance between sender and receiver and if they are not i range return plugin_handled.

OxidedMaze 07-11-2013 09:08

Re: Only specific players can see player's message
 
Quote:

Originally Posted by SpeeDeeR (Post 1988450)
A way that could work is to hook SayText using register_message and check the distance between sender and receiver and if they are not i range return plugin_handled.

Solved , thank you very much :)


All times are GMT -4. The time now is 06:30.

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