distance based speech?
#1

I have noticed that in a lot of RP game modes that when you are within a certain distance of another player they can "hear you" (displays their text)

I am very interested in what variables determine the distance and how one would go about setting up a filterscript or gamemode addition that would only allow my players to hear each other from a defined distance.

** Also I was unable to locate any documentation or even pieces of code inside the RP gamemodes that define distance from players for speech.

Any help would be MUCH appreciated and +REP!
Reply
#2

You cannot rep but still i will help you.

use IsRangeOfPoint then loop it
Reply
#3

Quote:
Originally Posted by Reklez
Посмотреть сообщение
use IsRangeOfPoint then loop it
Could you give me an example of a method in which I would utilize that to cater to speech?
Reply
#4

pawn Код:
CMD:whisper(playerid, params[])
{
    new string[128], Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "SYNTAX: /w(hisper) [message]");
    if(pInfo[playerid][Mask] == 0) {
        format(string, sizeof(string), "%s "blue"Whispers: "white"%s", GetName(playerid), params);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
             if(IsPlayerInRangeOfPoint(i, 6.0, x, y, z))
             {
                 SendClientMessage(i, COLOR_WHITE, string);
             }
        }
    } else if(pInfo[playerid][Mask] == 1) {
        format(string, sizeof(string), "Stranger "blue"Whispers: "white"%s", params);
        for(new i = 0; i < MAX_PLAYERS; i++) //looping
        {
             if(IsPlayerInRangeOfPoint(i, 6.0, x, y, z)) //is player near in the player talking at distance 6.0
             {
                 SendClientMessage(i, COLOR_RED, string); //will sent to player that near in the player talking in float distance 6.0
             }
        }
    }
    return 1;
}
Reply
#5

Thank you very much! this is exactly what I was looking for.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)